-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
122 lines (121 loc) · 3.93 KB
/
Copy patheslint.config.js
File metadata and controls
122 lines (121 loc) · 3.93 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import prettierConfig from 'eslint-config-prettier';
export default [
{ ignores: ['dist/**', 'node_modules/**', '*.min.js', '.npm-cache/**'] },
// Script Node (không dùng globals browser như file TSX)
{
files: ['scripts/**/*.mjs'],
languageOptions: {
sourceType: 'module',
globals: {
console: 'readonly',
process: 'readonly',
},
},
},
eslint.configs.recommended,
...tseslint.configs.recommended,
prettierConfig,
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: { jsx: true },
},
globals: {
React: 'readonly',
JSX: 'readonly',
console: 'readonly',
fetch: 'readonly',
window: 'readonly',
document: 'readonly',
import: 'readonly',
module: 'readonly',
require: 'readonly',
process: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
Buffer: 'readonly',
global: 'readonly',
setTimeout: 'readonly',
clearTimeout: 'readonly',
setInterval: 'readonly',
clearInterval: 'readonly',
URL: 'readonly',
URLSearchParams: 'readonly',
FormData: 'readonly',
Blob: 'readonly',
File: 'readonly',
AbortController: 'readonly',
ResizeObserver: 'readonly',
IntersectionObserver: 'readonly',
MutationObserver: 'readonly',
performance: 'readonly',
requestAnimationFrame: 'readonly',
cancelAnimationFrame: 'readonly',
localStorage: 'readonly',
sessionStorage: 'readonly',
navigator: 'readonly',
location: 'readonly',
history: 'readonly',
CustomEvent: 'readonly',
Event: 'readonly',
MouseEvent: 'readonly',
KeyboardEvent: 'readonly',
HTMLElement: 'readonly',
Element: 'readonly',
Node: 'readonly',
NodeList: 'readonly',
},
},
plugins: {
react,
'react-hooks': reactHooks,
'jsx-a11y': jsxA11y,
},
settings: {
react: { version: '19.0' },
},
rules: {
...react.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
...Object.fromEntries(
Object.entries(jsxA11y.configs.recommended.rules || {}).map(([k, v]) => [k, v === 'error' ? 'warn' : v]),
),
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'react/display-name': 'off',
'no-useless-assignment': 'warn',
'prefer-const': 'warn',
'no-case-declarations': 'warn',
'react-hooks/rules-of-hooks': 'warn',
'react-hooks/refs': 'warn',
'react-hooks/set-state-in-effect': 'warn',
'react-hooks/exhaustive-deps': 'warn',
'react-hooks/preserve-manual-memoization': 'warn',
'react-hooks/static-components': 'warn',
'react-hooks/incompatible-library': 'warn',
'react-hooks/immutability': 'warn',
'react-hooks/purity': 'warn',
'jsx-a11y/no-static-element-interactions': 'warn',
'jsx-a11y/click-events-have-key-events': 'warn',
'jsx-a11y/label-has-associated-control': 'warn',
'jsx-a11y/no-autofocus': 'warn',
'jsx-a11y/anchor-is-valid': 'warn',
'jsx-a11y/no-noninteractive-element-interactions': 'warn',
'jsx-a11y/interactive-supports-focus': 'warn',
'@typescript-eslint/no-unused-expressions': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-require-imports': 'warn',
'no-constant-binary-expression': 'warn',
},
},
];