-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
60 lines (58 loc) · 1.66 KB
/
Copy patheslint.config.js
File metadata and controls
60 lines (58 loc) · 1.66 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
/**
* ESLint flat config (v9+): lint rules for JS/JSX.
* - Base: @eslint/js recommended. Parser: Babel (for JSX and modern syntax).
* - React and React Hooks plugins; react-in-jsx-scope off (React 17+ automatic runtime).
*/
import { createRequire } from 'node:module';
import js from '@eslint/js';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
const require = createRequire(import.meta.url);
export default [
{ ignores: ['dist', 'node_modules', '*.config.js'] },
js.configs.recommended,
{
files: ['**/*.js', '**/*.jsx'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
parser: require('@babel/eslint-parser'),
parserOptions: {
requireConfigFile: false,
babelOptions: {
presets: ['@babel/preset-react'],
},
},
globals: {
React: 'readonly',
ReactDOM: 'readonly',
console: 'readonly',
document: 'readonly',
window: 'readonly',
fetch: 'readonly',
module: 'readonly',
require: 'readonly',
process: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
exports: 'writable',
global: 'readonly',
},
},
plugins: {
react,
'react-hooks': reactHooks,
},
rules: {
...react.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
'react/react-in-jsx-scope': 'off', /* not needed with React 17+ JSX transform */
'react/prop-types': 'off', /* project uses JS only; enable if you add PropTypes */
},
settings: {
react: {
version: 'detect',
},
},
},
];