forked from stryker-mutator/stryker-js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eslintrc.cjs
155 lines (140 loc) · 5.2 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
module.exports = {
root: true,
env: {
node: true,
},
parserOptions: {
sourceType: 'module',
project: [require.resolve('./tsconfig.lint.json')],
},
parser: '@typescript-eslint/parser',
extends: ['plugin:@typescript-eslint/all', 'prettier'],
plugins: ['@typescript-eslint', 'prettier', 'import', 'unicorn'],
settings: {
'import/resolver': {
typescript: true,
node: true,
},
},
rules: {
// unicorn rules
'unicorn/filename-case': [
'error',
{
case: 'kebabCase',
},
],
// import rules
'import/newline-after-import': 1,
'import/order': [
'error',
{
'newlines-between': 'always-and-inside-groups',
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
},
],
'import/no-default-export': 'error',
'import/no-duplicates': 'error',
'import/no-extraneous-dependencies': ['error', { devDependencies: false, optionalDependencies: false, peerDependencies: true }],
// prettier rules
'prettier/prettier': ['error'],
'@typescript-eslint/lines-around-comment': 'off',
// customized typescript-eslint rules
'@typescript-eslint/array-type': [
'error',
{
default: 'array-simple',
},
],
'@typescript-eslint/no-extra-parens': ['error', 'functions'],
'@typescript-eslint/quotes': ['error', 'single', { avoidEscape: true }],
'@typescript-eslint/explicit-member-accessibility': [
'error',
{
overrides: {
constructors: 'no-public',
properties: 'explicit',
},
},
],
'@typescript-eslint/method-signature-style': ['error', 'method'],
'@typescript-eslint/no-this-alias': [
'error',
{
allowDestructuring: true,
allowedNames: ['self'],
},
],
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_*', ignoreRestSiblings: true, varsIgnorePattern: '^_' }],
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/class-methods-use-this': 'off',
// disabled typescript-eslint rules we should enable in some way
// fix - separate PR
'@typescript-eslint/naming-convention': 'off',
// fix - separate PR
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/promise-function-async': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/return-await': 'off',
'@typescript-eslint/await-thenable': 'off',
// fix - separate PR
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/no-unnecessary-condition': 'off',
// fix - separate PR
'@typescript-eslint/no-base-to-string': 'off',
// fix - separate PR
'@typescript-eslint/init-declarations': 'off',
// Long term to fix
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-magic-numbers': 'off',
'@typescript-eslint/parameter-properties': 'off',
// disabled typescript-eslint rules
// handled by prettier / our style
'@typescript-eslint/member-ordering': 'off', // we do not need it
'@typescript-eslint/lines-between-class-members': 'off', // not our style
// useful
'@typescript-eslint/no-type-alias': 'off', // it is useful!
'@typescript-eslint/no-use-before-define': 'off', // we use it e.x in injections
'@typescript-eslint/no-confusing-void-expression': 'off', // sometimes usable
'@typescript-eslint/no-invalid-this': 'off', // we promise to be careful
'@typescript-eslint/no-dynamic-delete': 'off', // we promise to be careful
'@typescript-eslint/no-non-null-assertion': 'off', // sometimes usable
// can't do nothing about it
'@typescript-eslint/consistent-type-imports': 'off',
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/strict-boolean-expressions': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
// we do not care
'@typescript-eslint/max-params': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/prefer-enum-initializers': 'off',
'@typescript-eslint/no-invalid-void-type': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/no-implicit-any-catch': 'off',
'@typescript-eslint/no-extraneous-class': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/default-param-last': 'off',
},
overrides: [
{
files: ['*.js'],
rules: {
// These do not work with jsdoc: https://github.com/typescript-eslint/typescript-eslint/issues/906
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
},
},
{
files: ['packages/*/test/**/*.+(ts|cts|mts)', 'tasks/*.js', 'packages/test-helpers/**/*.+(ts|cts|mts)'],
rules: {
'import/no-extraneous-dependencies': 'off',
},
},
],
};