-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheslint.config.js
112 lines (104 loc) · 3.14 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
import typescriptPlugin from "@typescript-eslint/eslint-plugin";
import reactPlugin from "eslint-plugin-react";
import reactHooksPlugin from "eslint-plugin-react-hooks";
import jsxA11yPlugin from "eslint-plugin-jsx-a11y";
import importPlugin from "eslint-plugin-import";
import unusedImportsPlugin from "eslint-plugin-unused-imports";
import prettierConfig from "eslint-config-prettier";
export default [
{
ignores: ["node_modules/", "dist/", "build/", ".vite/", "coverage/"],
},
{
files: ["*.js", "*.jsx", "*.ts", "*.tsx"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
react: {
version: "detect",
},
},
plugins: {
react: reactPlugin,
reactHooks: reactHooksPlugin,
"@typescript-eslint": typescriptPlugin,
"jsx-a11y": jsxA11yPlugin,
import: importPlugin,
"unused-imports": unusedImportsPlugin,
},
rules: {
// Prettier-related rules (disables conflicting ESLint rules)
...prettierConfig.rules,
// TypeScript rules
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_" },
],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "warn",
// React rules
"react/prop-types": "off", // TypeScript handles this
"react/react-in-jsx-scope": "off", // Not needed with React 17+
"react/jsx-filename-extension": [
"warn",
{ extensions: [".jsx", ".tsx"] },
],
"react/jsx-props-no-spreading": "off",
// React Hooks rules
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
// Accessibility rules
"jsx-a11y/no-noninteractive-element-interactions": "warn",
// Import rules
"import/order": [
"warn",
{
groups: [
"builtin",
"external",
"internal",
["parent", "sibling", "index"],
],
"newlines-between": "always",
alphabetize: { order: "asc", caseInsensitive: true },
},
],
"import/no-extraneous-dependencies": ["error", { devDependencies: true }],
"import/no-unresolved": "error",
"import/no-duplicates": "error",
// Unused imports rules
"unused-imports/no-unused-imports": "warn",
"unused-imports/no-unused-vars": [
"warn",
{
vars: "all",
varsIgnorePattern: "^_",
args: "after-used",
argsIgnorePattern: "^_",
},
],
// Code style rules
quotes: ["error", "single", { avoidEscape: true }],
semi: ["error", "always"],
"comma-dangle": ["error", "only-multiline"],
"no-multiple-empty-lines": ["warn", { max: 1, maxEOF: 0 }],
"eol-last": ["error", "always"],
"no-trailing-spaces": "warn",
},
},
{
files: ["*.ts", "*.tsx"],
rules: {
"no-undef": "off",
},
},
];