Repository navigation
Expand file tree
/
Copy patheslint.config.js
More file actions
104 lines (103 loc) · 2.82 KB
/
Copy patheslint.config.js
File metadata and controls
104 lines (103 loc) · 2.82 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
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
import js from '@eslint/js';
import globals from 'globals';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import tseslint from 'typescript-eslint';
import prettier from 'eslint-config-prettier';
/**
* ESLint flat config for CLAI frontend.
*
* `rules-of-hooks` and the React 19 compiler rules of
* eslint-plugin-react-hooks v7 are errors. Deliberate exceptions are
* suppressed inline with `eslint-disable-next-line` and a justification.
*
* Keep the two rule blocks (TS and JS) in sync when changing rules.
*/
export default [
js.configs.recommended,
...tseslint.configs.recommended.map((config) => ({
...config,
files: ['**/*.{ts,tsx}'],
})),
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
globals: {
...globals.browser,
...globals.es2021,
},
},
plugins: {
react,
'react-hooks': reactHooks,
},
rules: {
...react.configs.recommended.rules,
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'react/display-name': 'off',
'react/no-unescaped-entities': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/set-state-in-effect': 'error',
'react-hooks/exhaustive-deps': 'error',
'react-hooks/preserve-manual-memoization': 'error',
'react-hooks/refs': 'error',
'react-hooks/immutability': 'error',
'react-hooks/use-memo': 'error',
'react-hooks/purity': 'error',
},
settings: {
react: { version: 'detect' },
},
},
{
files: ['**/*.{js,jsx}'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.browser,
...globals.es2021,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
plugins: {
react,
'react-hooks': reactHooks,
},
rules: {
...react.configs.recommended.rules,
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'react/display-name': 'off',
'react/no-unescaped-entities': 'off',
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/set-state-in-effect': 'error',
'react-hooks/exhaustive-deps': 'error',
'react-hooks/preserve-manual-memoization': 'error',
'react-hooks/refs': 'error',
'react-hooks/immutability': 'error',
'react-hooks/use-memo': 'error',
'react-hooks/purity': 'error',
},
settings: {
react: {
version: 'detect',
},
},
},
{
files: ['**/*.config.{js,mjs,cjs}'],
languageOptions: {
globals: globals.node,
},
},
prettier,
];