-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy patheslint.config.mjs
88 lines (81 loc) · 2.47 KB
/
eslint.config.mjs
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
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat';
import react from 'eslint-plugin-react';
import _import from 'eslint-plugin-import';
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),
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: '18.3.1',
},
},
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,
'babel/semi': [2, 'always'],
'standard/computed-property-even-spacing': 0,
'space-before-function-paren': 0,
},
}];