-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
79 lines (75 loc) · 2.54 KB
/
eslint.config.js
File metadata and controls
79 lines (75 loc) · 2.54 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
import js from "@eslint/js";
import globals from "globals";
import react from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
import importPlugin from "eslint-plugin-import";
export default [
{ ignores: ["dist", "build", "node_modules", ".git", "*.min.js"] },
js.configs.recommended,
{
files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
languageOptions: {
ecmaVersion: 2025,
sourceType: "module",
globals: {
...globals.browser,
...globals.es2021,
...globals.node,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
plugins: {
react,
"react-hooks": reactHooks,
import: importPlugin,
},
settings: {
react: {
version: "detect",
},
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
},
},
rules: {
// React core rules
"react/jsx-uses-react": "off", // Not needed with React 18+ and automatic JSX transform
"react/react-in-jsx-scope": "off", // Not needed with React 18+ and automatic JSX transform
"react/no-unknown-property": ["error", { ignore: [] }], // Catches class vs className
"react/prop-types": "off", // Use TypeScript for prop validation instead
"react/jsx-key": "error", // Required key prop in iterators
"react/jsx-no-duplicate-props": "error",
"react/jsx-no-undef": "error",
"react/jsx-pascal-case": "error", // Enforce PascalCase for components
"react/no-array-index-key": "warn", // Warn when using array index as key
"react/no-direct-mutation-state": "error",
"react/no-unsafe": "error", // Prevent unsafe lifecycle methods
"react/self-closing-comp": "error", // Enforce self-closing tags
"react/display-name": "warn",
// React Hooks rules
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
// Import rules
"import/no-unresolved": "error",
"import/named": "error",
"import/default": "error",
"import/no-duplicates": "error",
"import/no-cycle": "warn",
// General JavaScript rules
"no-console": ["warn", { allow: ["warn", "error"] }],
"no-debugger": "warn",
"prefer-const": "error",
eqeqeq: ["error", "always", { null: "ignore" }],
"no-var": "error",
"no-unused-vars": ["error", { varsIgnorePattern: "^[A-Z_]" }],
},
},
// Add TypeScript specific config if using TypeScript
// ...typescriptEslint.configs.recommended
];