-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.mjs
More file actions
112 lines (101 loc) · 4.22 KB
/
eslint.config.mjs
File metadata and controls
112 lines (101 loc) · 4.22 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
import { defineConfig } from 'eslint/config';
import eslint from '@eslint/js';
import globals from 'globals';
import stylistic from '@stylistic/eslint-plugin';
import tsPlugin from 'typescript-eslint';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
export default defineConfig(
// Base config
eslint.configs.recommended,
stylistic.configs.recommended,
...tsPlugin.configs.strict,
...tsPlugin.configs.stylistic,
reactPlugin.configs.flat.recommended,
reactHooksPlugin.configs.flat.recommended,
{
settings: {
react: {
version: '19.0.0',
},
},
rules: {
// Style
'@stylistic/array-bracket-spacing': [ 'error', 'always' ],
'@stylistic/arrow-parens': [ 'error', 'as-needed' ],
'@stylistic/indent': [ 'error', 4, { SwitchCase: 1 } ],
'@stylistic/indent-binary-ops': [ 'error', 4 ],
'@stylistic/linebreak-style': [ 'error', 'unix' ],
'@stylistic/max-statements-per-line': 'off',
'@stylistic/member-delimiter-style': [ 'error', { singleline: { delimiter: 'comma' }, multiline: { delimiter: 'comma' } } ],
'@stylistic/no-multiple-empty-lines': [ 'error', { max: 2 } ],
'@stylistic/operator-linebreak': 'off',
'@stylistic/padded-blocks': 'off',
'@stylistic/quotes': [ 'error', 'single' ],
'@stylistic/semi': [ 'error', 'always' ],
// Style (JSX)
'@stylistic/jsx-indent-props': [ 'error', 4 ],
'@stylistic/jsx-max-props-per-line': 'off',
'@stylistic/jsx-one-expression-per-line': 'off',
// Core rules (possible problems)
'no-constructor-return': 'error',
'no-duplicate-imports': 'error',
'no-self-compare': 'error',
'no-unmodified-loop-condition': 'error',
// Core rules (suggestions)
'camelcase': 'error',
'curly': 'error',
'eqeqeq': 'error',
'no-alert': 'error',
'no-console': 'error',
'no-eval': 'error',
'no-extend-native': 'error',
'no-implicit-coercion': 'error',
'no-implied-eval': 'error',
'no-invalid-this': 'error',
'no-labels': 'error',
'no-lone-blocks': 'error',
'no-new': 'error',
'no-new-func': 'error',
'no-new-wrappers': 'error',
'no-octal-escape': 'error',
'no-return-assign': [ 'error', 'always' ],
'no-throw-literal': 'error',
'no-useless-computed-key': 'error',
'no-useless-concat': 'error',
'no-useless-rename': 'error',
'no-useless-return': 'error',
'no-var': 'error',
'no-warning-comments': [ 'warn', { location: 'anywhere', terms: [ 'TODO' ] }],
'prefer-arrow-callback': 'error',
'prefer-const': 'error',
'prefer-regex-literals': 'error',
'prefer-rest-params': 'error',
// Typescript rules
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/no-empty-function': [ 'error', { allow: [ 'private-constructors', 'protected-constructors' ] } ],
'@typescript-eslint/no-extraneous-class': [ 'error', { allowEmpty: true } ],
'@typescript-eslint/no-loop-func': 'error',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/unified-signatures': [ 'error', { ignoreDifferentlyNamedParameters: true } ],
// React rules
'react/prop-types': 'off',
},
},
{
files: [ 'test/**' ],
ignores: [ 'test/graphic_test_app/**' ],
languageOptions: {
globals: {
...globals.node,
...globals.mocha,
},
},
rules: {
'no-invalid-this': 'off', // This rule is incompatible with the use of Mocha contexts.
'@typescript-eslint/no-require-imports': 'off',
},
},
);