-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
eslint.config.js
161 lines (154 loc) · 3.86 KB
/
eslint.config.js
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import tseslint from 'typescript-eslint'
import unicorn from 'eslint-plugin-unicorn'
import stylistic from '@stylistic/eslint-plugin-ts'
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
/**
* Default list of files to include
*/
export const INCLUDE_LIST = ['**/*.ts']
/**
* Default set of files to ignore
*/
export const IGNORE_LIST = [
'eslint.config.js',
'eslint.config.ts',
'*.min.*',
'*.d.ts',
'CHANGELOG.md',
'dist/',
'LICENSE*',
'output/',
'coverage/',
'temp/',
'build/',
'dist/',
'public/assets/',
'pnpm-lock.yaml',
'yarn.lock',
'package-lock.json',
'__snapshots__/',
'!.github',
'!.vscode',
]
/**
* Default set of plugins to apply to the config
*/
export const PLUGINS_LIST = {
'@unicorn': unicorn,
'@stylistic': stylistic,
...eslintPluginPrettierRecommended.plugins,
}
/**
* Default list of rules to apply
*/
export const RULES_LIST = {
'quotes': 'off',
'indent': 'off',
'space-before-function-paren': 'off',
'no-irregular-whitespace': ['error'],
'no-multiple-empty-lines': ['error', { max: 1 }],
'one-var': ['error', 'never'],
'eol-last': ['error', 'always'],
'no-cond-assign': ['error', 'except-parens'],
'comma-dangle': ['error', 'always-multiline'],
'eqeqeq': ['error', 'always'],
'new-parens': ['error', 'always'],
'no-caller': ['error'],
'no-constant-condition': ['error'],
'no-control-regex': ['error'],
'no-debugger': ['error'],
'no-duplicate-case': ['error'],
'no-eval': ['error'],
'no-ex-assign': ['error'],
'no-extra-boolean-cast': ['error'],
'no-fallthrough': ['error'],
'no-inner-declarations': ['error'],
'no-invalid-regexp': ['error', { allowConstructorFlags: ['u', 'y'] }],
'no-proto': ['error'],
'no-shadow': ['off'],
'no-regex-spaces': ['error'],
'no-self-compare': ['error'],
'no-sparse-arrays': ['error'],
'no-mixed-spaces-and-tabs': ['error'],
'no-unsafe-negation': ['error'],
'no-new-wrappers': ['error'],
'no-self-assign': ['error'],
'no-this-before-super': ['error'],
'no-with': ['error'],
'rest-spread-spacing': ['error', 'never'],
'no-trailing-spaces': ['error', { ignoreComments: true }],
'no-undef-init': ['error'],
'no-unsafe-finally': ['error'],
'padded-blocks': ['error', 'never'],
'space-in-parens': ['error', 'never'],
'use-isnan': ['error'],
'valid-typeof': ['error', { requireStringLiterals: true }],
'brace-style': ['error', '1tbs'],
'curly': ['error', 'all'],
'handle-callback-err': ['error', '^(err|error)$'],
'max-len': [
'error',
{
code: 100,
comments: 120,
ignoreUrls: true,
ignoreTemplateLiterals: true,
},
],
'no-array-constructor': ['error'],
'no-unreachable': ['error'],
'no-multi-spaces': ['error'],
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
},
{
selector: 'typeLike',
format: ['PascalCase'],
},
{
selector: 'class',
format: ['PascalCase'],
},
{
selector: 'interface',
format: ['PascalCase'],
custom: {
regex: '^I[A-Z]',
match: false,
},
},
],
'@unicorn/prefer-module': 'error',
'@unicorn/prefer-node-protocol': 'error',
'@unicorn/filename-case': [
'error',
{
case: 'snakeCase',
},
],
'@unicorn/no-await-expression-member': 'error',
'@unicorn/no-for-loop': 'error',
'@unicorn/no-instanceof-array': 'error',
'@unicorn/prefer-number-properties': 'error',
...eslintPluginPrettierRecommended.rules,
'prettier/prettier': ['error', { endOfLine: 'auto' }],
}
export default tseslint.config(
{
ignores: IGNORE_LIST,
},
tseslint.configs.base,
{
name: 'Plugins list',
plugins: PLUGINS_LIST,
},
{
name: 'Pkg defaults',
files: INCLUDE_LIST,
rules: RULES_LIST,
}
)