-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.cjs
86 lines (84 loc) · 2.22 KB
/
eslint.config.cjs
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
const common = require('./common.config.cjs')
const globals = require('globals')
const google = require('eslint-config-google')
const js = require('@eslint/js')
const prettier = require('eslint-config-prettier')
const react = common.withReact ? require('eslint-plugin-react') : undefined
const tseslint = require('typescript-eslint')
const unusedImports = require('eslint-plugin-unused-imports')
module.exports = tseslint.config(
js.configs.recommended,
...(common.withReact ? [react.configs.flat.recommended] : []),
google,
prettier,
{
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: common.withReact,
},
},
sourceType: 'module',
globals: {
...globals.browser,
...globals.node,
...globals.es6,
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
},
plugins: {
...(common.withReact ? [react] : []),
'unused-imports': unusedImports,
},
rules: {
curly: ['error', 'multi-line'],
eqeqeq: ['error', 'always'],
'no-constant-condition': ['error', {checkLoops: false}],
'no-invalid-this': 'off',
'no-multi-str': 'off',
'require-jsdoc': 'off',
'valid-jsdoc': 'off',
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
'no-unuseds-vars': 'off',
'unused-imports/no-unused-imports': 'warn',
// Redundant with no-unused-vars
'unused-imports/no-unused-vars': 'off',
},
settings: {
react: {
version: 'detect',
},
},
},
{
files: ['**/*.ts', '**/*.tsx'],
extends: [
tseslint.configs.strictTypeChecked,
tseslint.configs.stylisticTypeChecked,
],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: __dirname,
},
},
rules: {
// Redundant with @typescript-eslint/no-unused-vars
'unused-imports/no-unused-vars': 'off',
'@typescript-eslint/no-unnecessary-condition': [
'error',
{
allowConstantLoopConditions: true,
},
],
'@typescript-eslint/restrict-template-expressions': [
'error',
{
allowNumber: true,
},
],
},
}
)