-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheslint.config.js
More file actions
114 lines (112 loc) · 3.01 KB
/
eslint.config.js
File metadata and controls
114 lines (112 loc) · 3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import { FlatCompat } from "@eslint/eslintrc";
import boundaries from "eslint-plugin-boundaries";
import tseslint from "typescript-eslint";
const compat = new FlatCompat({
baseDirectory: import.meta.dirname,
});
export default tseslint.config(
{
ignores: [".next", "next-env.d.ts", "postcss.config.js", "prettier.config.js", "coverage"],
},
{
files: ["src/**/*.{ts,tsx}"],
plugins: { boundaries },
settings: {
"boundaries/elements": [
{ type: "features", pattern: "src/features/*" },
{ type: "server", pattern: "src/server/*" },
{ type: "lib", pattern: "src/lib/*" },
{ type: "ui", pattern: "src/components/ui/*" },
],
},
rules: {
"boundaries/element-types": [
"warn",
{
default: "allow",
rules: [
{
from: ["features"],
disallow: ["server"],
message: "UI must not import server.*",
},
],
},
],
},
},
{
files: ["src/**/*.{ts,tsx}"],
ignores: ["src/app/**"],
rules: {
"no-restricted-imports": [
"error",
{
patterns: [
{ regex: "^@components/(?!ui($|/))", message: "Use feature modules or @components/ui/*." },
{ regex: "^@features/(?!shared($|/))", message: "Cross-feature imports are restricted to @features/shared/*." },
],
},
],
},
},
{
files: ["src/app/**/*.{ts,tsx}"],
rules: {
"no-restricted-imports": [
"error",
{
patterns: [
{ regex: "^@components/(?!ui($|/))", message: "Use feature modules or @components/ui/*." },
],
},
],
},
},
...compat.extends("next/core-web-vitals"),
{
files: ["**/*.ts", "**/*.tsx"],
extends: [
...tseslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked,
],
rules: {
"@typescript-eslint/array-type": "off",
"@typescript-eslint/consistent-type-definitions": "off",
"@typescript-eslint/consistent-type-imports": [
"warn",
{ prefer: "type-imports", fixStyle: "inline-type-imports" },
],
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_" },
],
"@typescript-eslint/require-await": "off",
"@typescript-eslint/no-misused-promises": [
"error",
{ checksVoidReturn: { attributes: false } },
],
},
},
{
files: ["**/*.test.ts", "**/*.test.tsx", "src/test/**/*.ts"],
rules: {
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/unbound-method": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-explicit-any": "off",
},
},
{
linterOptions: {
reportUnusedDisableDirectives: true,
},
languageOptions: {
parserOptions: {
projectService: true,
},
},
},
);