-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
76 lines (71 loc) · 1.93 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
module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:@typescript-eslint/strict-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
'prettier',
],
plugins: ['@typescript-eslint'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
},
rules: {
// Base
'no-shadow': 'error',
'no-warning-comments': 'off',
'no-console': 'warn', // doesn't seem to be enabled in any preset
// Import
'import/newline-after-import': 'error',
'import/order': [
'error',
{
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: false,
},
},
],
'import/exports-last': 'error',
'import/group-exports': 'error',
'import/consistent-type-specifier-style': ['error', 'prefer-inline'],
// typescript-eslint
'@typescript-eslint/array-type': [
'warn',
{
default: 'generic',
},
],
'@typescript-eslint/consistent-type-exports': [
'error',
{
fixMixedExportsWithInlineTypeSpecifier: true,
},
],
'@typescript-eslint/consistent-type-imports': [
'error',
{
fixStyle: 'inline-type-imports',
},
],
// Disabling because of index errors on interfaces,
// which works fine in type aliases:
// https://bobbyhadz.com/blog/typescript-index-signature-for-type-is-missing-in-type
'@typescript-eslint/consistent-type-definitions': 'off',
// Disabling because it's too strict:
// we are interested in using || operator multiple times to avoid empty strings.
'@typescript-eslint/prefer-nullish-coalescing': 'off',
},
overrides: [
{
// https://typescript-eslint.io/linting/troubleshooting/#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file
files: ['./**/*.js'],
extends: ['plugin:@typescript-eslint/disable-type-checked'],
},
],
}