-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
.eslintrc.cjs
executable file
·183 lines (151 loc) · 4.85 KB
/
.eslintrc.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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
module.exports = {
root: true,
env: {
es6: true,
node: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: "module",
ecmaVersion: 12,
},
plugins: ['simple-import-sort', 'import', 'unused-imports'],
extends: [
'airbnb-base',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
settings: {
'import/parsers': {
'@typescript-eslint/parser': [
".ts",
".tsx"
]
},
'import/resolver': {
typescript: {}
}
},
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'semi': ['error', 'never'],
'max-len': ['warn', 200],
'quote-props': ['error', 'as-needed', { numbers: true }],
'import/extensions': [
'error',
'ignorePackages',
{
ts: 'never'
}
],
// Force LF newlines
'linebreak-style': ['error', 'unix'],
// Forces `import type` when possible
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
// Allow `any`
'@typescript-eslint/no-explicit-any': 'off',
// Allow (x: number = 1) => {...}
'@typescript-eslint/no-inferrable-types': 'off',
"no-unused-vars": "off", // or "@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": "off",
"dot-notation": "off",
"@typescript-eslint/dot-notation": ["error", {
allowPrivateClassPropertyAccess: true,
allowProtectedClassPropertyAccess: true,
}],
// Import sorting
'simple-import-sort/imports': ['error', {
groups: [
// Side effect imports.
["^\\u0000"],
// Packages.
[
// Things that start with a letter (or digit or underscore), or `@`.
"^\\w",
// Things that start with `#` not followed by a letter, such as Vue-style `#/foo`.
"^#[^\\w]",
// Things that start with `#` followed by a letter.
"^#\\w",
],
// Absolute imports and other imports such as Vue-style `#/foo`.
// Anything not matched in another group
["^"],
// Relative imports.
// Anything that starts with a dot.
["^\\."],
// Type imports all ends with \u0000
[
// Packages.
// Things that start with a letter (or digit or underscore)
"^\\w.*\u0000",
// Things that start with `@` not followed by a letter, such as Vue-style `#/foo`.
"^@[^\\w].*\u0000",
// Things that start with `@` followed by a letter.
"^@\\w.*\u0000",
// Absolute imports & other imports.
"^.*\u0000",
// Relative imports.
// Anything that starts with a dot.
"^\\..*\u0000",
]
]
}],
'simple-import-sort/exports': 'error',
'sort-imports': 'off',
'import/order': 'off',
// Allow custom method chaining
'newline-per-chained-call': 'off',
// Allow to use const root = this
'@typescript-eslint/no-this-alias': 'off',
// Allow console.log statements
'no-console': 'off',
// I removed this because getters are getting a warning because of this rule
'class-methods-use-this': 'off',
// Allow names starting by underscore
'no-underscore-dangle': 'off',
// Allow for ... of ...
'no-restricted-syntax': 'off',
// Assigning to parameters is the basics of KoaJS
'no-param-reassign': 'off',
// Allow having only 1 export
'import/prefer-default-export': 'off',
'no-continue': 'off',
"no-useless-constructor": "off",
"@typescript-eslint/no-useless-constructor": ["error"],
'default-param-last': 'off',
// Don't use array destructuring for assignement expressions
'prefer-destructuring': [
'error',
{
'VariableDeclarator': {
'array': false,
'object': true
},
'AssignmentExpression': {
'array': false,
'object': false
}
}
],
// Tweaking @typescript-eslint
'@typescript-eslint/member-delimiter-style': 'off', // No semi-colons in types
'@typescript-eslint/explicit-function-return-type': 'off', // Don't force every function to have a return type
'@typescript-eslint/explicit-module-boundary-types': 'off',
// Allow as many classes per file as necessary
'max-classes-per-file': 'off',
// Allow empty arrow functions
'@typescript-eslint/no-empty-function': 'off',
// Allow unused arguments
'@typescript-eslint/no-unused-vars': 'off',
// Allow use after define
'no-use-before-define': 'off',
'multiline-comment-style': ['error', 'starred-block'],
'spaced-comment': ['error', 'always'],
},
}