-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy patheslint.config.mjs
More file actions
107 lines (99 loc) · 3.21 KB
/
Copy patheslint.config.mjs
File metadata and controls
107 lines (99 loc) · 3.21 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
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat';
import react from 'eslint-plugin-react';
import _import from 'eslint-plugin-import';
import reactHooks from 'eslint-plugin-react-hooks';
import babel from '@babel/eslint-plugin';
import globals from 'globals';
import babelParser from '@babel/eslint-parser';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default [{
}, ...fixupConfigRules(
compat.extends('eslint:recommended', 'standard', 'plugin:react/recommended', 'prettier'),
), {
ignores: ['node_modules/*', 'public/*'],
plugins: {
react: fixupPluginRules(react),
'react-hooks': reactHooks,
import: fixupPluginRules(_import),
babel,
},
languageOptions: {
parser: babelParser,
parserOptions: {
requireConfigFile: false,
babelOptions: {
babelrc: true,
configFile: false,
presets: ['@babel/preset-react', '@babel/preset-env']
}
},
globals: {
...globals.browser,
...globals.node,
...globals.mocha,
__DEVELOPMENT__: true,
__CLIENT__: true,
__SERVER__: true,
__DISABLE_SSR__: true,
__DEVTOOLS__: true,
socket: true,
webpackIsomorphicTools: true,
__dirname: true,
},
},
settings: {
'import/parsers': {
'@babel/eslint-parser': [ '.js', '.jsx', '.ts', '.tsx' ]
},
'import/ignore': ['node_modules', '.less$'],
react: {
version: '19.2.0',
},
},
rules: {
'import/default': 2,
'import/no-duplicates': 2,
'import/named': 2,
'import/namespace': 2,
'import/no-deprecated': 2,
'import/no-unresolved': 2,
'import/no-named-as-default': 2,
'react/no-did-update-set-state': 0,
'react/display-name': 0,
quotes: [2, 'single'],
'jsx-quotes': [2, 'prefer-double'],
'no-console': 1,
'no-unused-vars': 2,
'no-alert': 2,
'no-labels': 2,
'@/semi': [2, 'always'],
'standard/computed-property-even-spacing': 0,
'space-before-function-paren': 0,
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react-hooks/config': 'error',
'react-hooks/error-boundaries': 'error',
'react-hooks/gating': 'error',
'react-hooks/globals': 'error',
'react-hooks/immutability': 'error',
'react-hooks/preserve-manual-memoization': 'error',
'react-hooks/purity': 'error',
'react-hooks/refs': 'error',
'react-hooks/set-state-in-effect': 'error',
'react-hooks/set-state-in-render': 'error',
'react-hooks/static-components': 'error',
'react-hooks/unsupported-syntax': 'warn',
'react-hooks/use-memo': 'error',
'react-hooks/incompatible-library': 'warn',
},
}];