-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.cjs
More file actions
86 lines (77 loc) · 3.07 KB
/
Copy patheslint.config.cjs
File metadata and controls
86 lines (77 loc) · 3.07 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
const { defineConfig, globalIgnores } = require('eslint/config');
const globals = require('globals');
const { fixupConfigRules } = require('@eslint/compat');
const tsParser = require('@typescript-eslint/parser');
const reactRefreshPlugin = require('eslint-plugin-react-refresh').default;
const stylistic = require('@stylistic/eslint-plugin');
const js = require('@eslint/js');
const { FlatCompat } = require('@eslint/eslintrc');
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});
module.exports = defineConfig([
{
languageOptions: {
globals: {
...globals.browser,
},
parser: tsParser,
},
extends: fixupConfigRules(
compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
),
),
plugins: {
'react-refresh': reactRefreshPlugin,
'@stylistic': stylistic,
},
rules: {
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'interface',
format: ['PascalCase'],
custom: { regex: '^I[A-Z]', match: false },
},
],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': [
'error',
{ ignoreRestArgs: true, fixToUnknown: true },
],
'eol-last': ['error', 'always'],
'max-statements-per-line': ['error', { max: 3 }],
'max-len': ['error', 120],
'no-console': 'error',
'new-cap': ['error', { newIsCap: true, properties: false, capIsNew: false }],
curly: ['error', 'all'],
'@stylistic/curly-newline': ['error', 'always'],
'padding-line-between-statements': [
'error',
{ blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
{ blankLine: 'any', prev: ['const', 'let', 'var'], next: ['const', 'let', 'var'] },
{ blankLine: 'always', prev: 'block', next: '*' },
{ blankLine: 'always', prev: ['if', 'for', 'while', 'switch', 'try'], next: '*' },
{ blankLine: 'always', prev: '*', next: 'return' },
{ blankLine: 'always', prev: '*', next: 'throw' },
{ blankLine: 'always', prev: '*', next: 'if' },
{ blankLine: 'always', prev: '*', next: 'for' },
{ blankLine: 'always', prev: '*', next: 'while' },
{ blankLine: 'always', prev: '*', next: 'switch' },
{ blankLine: 'always', prev: '*', next: 'try' },
{ blankLine: 'any', prev: 'expression', next: 'expression' },
],
'key-spacing': ['error', { afterColon: true, mode: 'strict' }],
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
'max-classes-per-file': ['error', { ignoreExpressions: true }],
},
},
globalIgnores(['**/dist', '**/dist-zip', '**/backups', '**/.eslintrc.cjs', '**/eslint.config.cjs', '**/.prettierrc.cjs']),
]);