-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
121 lines (121 loc) · 3.6 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
module.exports = {
env: {
browser: true,
es6: true,
jest: true,
node: true
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
],
ignorePatterns: [
'build'
],
overrides: [
// Base rules to override as needed in the below groups.
{
files: [
'**/*.cjs',
'**/*.js',
'**/*.ts',
'**/*.tsx'
],
rules: {
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-unused-vars': ['error', {
'vars': 'all',
'varsIgnorePattern': '_.*',
'args': 'all',
'ignoreRestSiblings': false,
'argsIgnorePattern': '_.*',
'destructuredArrayIgnorePattern': '_.*',
'caughtErrors': 'all',
'caughtErrorsIgnorePattern': '_.*'
}],
'comma-dangle': ['error', 'never'],
'comma-spacing': ['error', {
'before': false,
'after': true
}],
'eol-last': ['error', 'always'],
'indent': ['error', 2, {
'SwitchCase': 1
}],
'linebreak-style': ['error', 'unix'],
'quotes': ['error', 'single'],
'semi': ['error', 'always']
}
},
// Rules for TS code.
{
files: ['**/*.ts', '**/*.tsx'],
rules: {
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/array-type': ['error', { 'default': 'array' }],
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/ban-ts-comment': ['error', {
'ts-expect-error': false,
'ts-ignore': false,
'ts-nocheck': false,
'ts-check': false
}],
'@typescript-eslint/ban-tslint-comment': 'error',
'@typescript-eslint/comma-dangle': ['error', 'never'],
'@typescript-eslint/comma-spacing': ['error', {
'before': false,
'after': true
}],
// '@typescript-eslint/class-literal-property-style': ['error', 'fields'],
'@typescript-eslint/consistent-generic-constructors': ['error', 'constructor'],
'@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
'@typescript-eslint/consistent-type-assertions': ['error', {
'assertionStyle': 'as',
'objectLiteralTypeAssertions': 'never'
}],
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
'@typescript-eslint/explicit-function-return-type': ['error', {
'allowConciseArrowFunctionExpressionsStartingWithVoid': false,
'allowDirectConstAssertionInArrowFunctions': false,
'allowExpressions': false,
'allowHigherOrderFunctions': false,
'allowTypedFunctionExpressions': true
}],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/semi': ['error', 'always'],
'comma-dangle': 'off',
'comma-spacing': 'off',
'semi': 'off'
}
},
// Rules for unit tests.
{
files: ['**/*.spec.ts', '**/*.spec.tsx'],
rules: {
'@typescript-eslint/ban-ts-comment': ['error', {
'ts-expect-error': true,
'ts-ignore': false,
'ts-nocheck': false,
'ts-check': false
}]
}
}
],
parser: '@typescript-eslint/parser',
parserOptions: {
'ecmaFeatures': {
'jsx': true
},
ecmaVersion: 'latest',
project: [
'./tsconfig.json'
],
sourceType: 'module'
},
plugins: [
'@typescript-eslint'
],
root: true
};