-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy patheslint.config.js
128 lines (125 loc) · 3.46 KB
/
eslint.config.js
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import eslintConfigPrettier from "eslint-config-prettier";
import * as importPlugin from "eslint-plugin-import";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import pluginReact from "eslint-plugin-react";
import reactCompiler from "eslint-plugin-react-compiler";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import unusedImports from "eslint-plugin-unused-imports";
import globals from "globals";
import tseslint from "typescript-eslint";
export default [
{
plugins: {
"react-compiler": reactCompiler
},
rules: {
"react-compiler/react-compiler": "error"
}
},
{ files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"] },
{ ignores: [".yarn/*", "dist/*", ".pnp.*", "storybook-static/", "public/*"] },
{ languageOptions: { globals: { ...globals.browser, ...globals.commonjs } } },
...tseslint.configs.recommended,
{
...pluginReact.configs.flat?.recommended,
settings: {
react: {
version: "detect"
}
}
},
{
plugins: {
import: importPlugin
},
settings: {
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".ts", ".tsx"]
}
}
},
rules: {
"import/extensions": [
"error",
"never",
{
mp3: "always",
json: "always",
md: "always",
aac: "always",
css: "always"
}
],
"import/no-useless-path-segments": ["error", { noUselessIndex: true }]
}
},
eslintConfigPrettier,
{
plugins: {
"simple-import-sort": simpleImportSort
},
rules: {
"react/prop-types": "off", // Does not work nicely with React.FC TS declarations
// Enable these if your TSConfig is preserve and you don't need a React import in scope for JSX
"react/react-in-jsx-scope": "off",
"react/jsx-uses-react": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", caughtErrorsIgnorePattern: "^ignore" }
],
"simple-import-sort/exports": "error",
"simple-import-sort/imports": [
"error",
{
groups: [
// Packages `react` related packages come first.
["^react", "^@?\\w"],
// Internal packages.
["^(@/ui)(/.*|$)"],
["^(@|components)(/.*|$)"],
// Side effect imports.
["^\\u0000"],
// Parent imports. Put `..` last.
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
// Other relative imports. Put same-folder imports and `.` last.
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
// Style imports.
["^.+\\.?(css)$"]
]
}
],
"max-len": [
"error",
{
code: 100,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true,
ignoreComments: true
}
]
}
},
{
plugins: {
"unused-imports": unusedImports
},
rules: {
"no-unused-vars": "off", // or "@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
{
vars: "all",
varsIgnorePattern: "^_",
args: "after-used",
argsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^ignore"
}
]
}
},
eslintPluginPrettierRecommended
];