-
Notifications
You must be signed in to change notification settings - Fork 12
/
eslint.config.js
63 lines (60 loc) · 1.78 KB
/
eslint.config.js
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
export default [
{
// Flat config: ignore patterns
ignores: [
"node_modules",
"scripts/*",
"config/*",
"pnpm-lock.yaml",
"pnpm-workspace.yaml",
".DS_Store",
"package.json",
"tsconfig.json",
"**/*.md",
"build",
".eslintrc.cjs",
"eslint.config.js",
"**/.*" // Ignore all dotfiles (like .gitignore)
],
},
{
// Language options (ES Modules, JSX)
languageOptions: {
ecmaVersion: 2021, // ES2021 syntax support
sourceType: 'module',
globals: {
window: 'readonly', // For browser-based globals
document: 'readonly',
Edit: 'writable',
console: 'writable',
_: 'writable',
$: 'writable',
},
ecmaFeatures: {
jsx: true, // Enable JSX parsing
},
},
// Plugins to be used
plugins: {
react: require('eslint-plugin-react'),
'react-hooks': require('eslint-plugin-react-hooks'),
prettier: require('eslint-plugin-prettier'),
'@typescript-eslint': require('@typescript-eslint/eslint-plugin'),
'react-refresh': require('eslint-plugin-react-refresh'),
import: require('eslint-plugin-import'),
},
// ESLint rule configurations (extends equivalent in Flat Config)
rules: {
...require('eslint-plugin-react').configs.recommended.rules,
...require('eslint-plugin-react-hooks').configs.recommended.rules,
...require('@typescript-eslint/eslint-plugin').configs.recommended.rules,
...require('eslint-plugin-prettier').configs.recommended.rules,
'prettier/prettier': 'error', // Prettier formatting as an ESLint rule
},
settings: {
react: {
version: 'detect', // Automatically detect the React version
},
},
},
];