-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patheslint.config.mjs
More file actions
49 lines (43 loc) · 1.22 KB
/
eslint.config.mjs
File metadata and controls
49 lines (43 loc) · 1.22 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
// eslint.config.mjs
import js from '@eslint/js';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import globals from 'globals';
export default [
// 1) GLOBAL IGNORES (apply to everything ESLint scans)
{
ignores: [
'**/dist/**', // compiled output
'**/node_modules/**',
'public/**', // adjust if you keep assets here
'*.min.js'
]
},
// 2) Make the React version setting GLOBAL so the plugin never warns
{ settings: { react: { version: 'detect' } } },
// 3) Base JS rules
js.configs.recommended,
// 4) React preset (flat)
react.configs.flat.recommended, // <- provides JSX-aware rules like react/jsx-uses-vars
// 5) React (JS/JSX) in src/
{
files: ['src/**/*.{js,jsx}'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {
ecmaFeatures: { jsx: true }, // enable JSX parsing
},
globals: { ...globals.browser },
},
plugins: {
react,
'react-hooks': reactHooks,
},
rules: {
'react/react-in-jsx-scope': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
}
}
];