forked from renovatebot/renovate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
174 lines (162 loc) · 4.73 KB
/
.eslintrc.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
162
163
164
165
166
167
168
169
170
171
172
173
174
module.exports = {
root: true,
env: {
node: true,
},
plugins: ['@renovate'],
extends: [
'airbnb-typescript/base',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:jest/recommended',
'plugin:jest/style',
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin/src/configs
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:promise/recommended',
'prettier',
],
parserOptions: {
ecmaVersion: 9,
tsconfigRootDir: __dirname,
project: ['./tsconfig.lint.json'],
extraFileExtensions: ['.mjs'],
},
rules: {
/*
* checks done by typescript.
*
* https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#eslint-plugin-import
*/
'import/default': 0,
'import/named': 0,
'import/namespace': 0,
'import/no-named-as-default-member': 0,
// other rules
'import/prefer-default-export': 0, // no benefit
'no-restricted-syntax': 0,
'no-await-in-loop': 0,
'prefer-destructuring': 0,
'prefer-template': 0,
'no-underscore-dangle': 0,
'no-negated-condition': 'error',
'sort-imports': [
'error',
{
ignoreCase: false,
ignoreDeclarationSort: true, // conflicts with our other import ordering rules
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
},
],
// mdast is a types only package `@types/mdast`
'import/no-unresolved': ['error', { ignore: ['^mdast$'] }],
'import/order': [
'error',
{
alphabetize: {
order: 'asc',
},
},
],
// disallow direct `nock` module usage as it causes memory issues.
'no-restricted-imports': [2, { paths: ['nock'] }],
// Makes no sense to allow type inference for expression parameters, but require typing the response
'@typescript-eslint/explicit-function-return-type': [
'error',
{ allowExpressions: true, allowTypedFunctionExpressions: true },
],
// TODO: fix lint
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-non-null-assertion': 2,
'@typescript-eslint/no-unused-vars': [
2,
{
vars: 'all',
args: 'none',
ignoreRestSiblings: false,
},
],
'@typescript-eslint/prefer-optional-chain': 2,
'@typescript-eslint/prefer-nullish-coalescing': 2,
curly: [2, 'all'],
'require-await': 2,
// next 2 rules disabled due to https://github.com/microsoft/TypeScript/issues/20024
'@typescript-eslint/no-unsafe-assignment': 0,
'@typescript-eslint/no-unsafe-member-access': 0,
// TODO: fix me
'@typescript-eslint/no-unsafe-return': 0,
'@typescript-eslint/no-unsafe-call': 0,
'@typescript-eslint/restrict-template-expressions': [
1,
{ allowNumber: true, allowBoolean: true },
],
'@typescript-eslint/restrict-plus-operands': 2,
'@typescript-eslint/naming-convention': 2,
'@typescript-eslint/unbound-method': 2,
'@typescript-eslint/ban-types': 2,
'@renovate/jest-root-describe': 2,
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts'],
},
},
overrides: [
{
files: ['**/*.spec.ts', 'test/**'],
env: {
jest: true,
},
rules: {
'prefer-destructuring': 0,
'prefer-promise-reject-errors': 0,
'import/no-dynamic-require': 0,
'global-require': 0,
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/no-object-literal-type-assertion': 0,
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/unbound-method': 0,
'jest/valid-title': [0, { ignoreTypeOfDescribeName: true }],
'max-classes-per-file': 0,
'class-methods-use-this': 0,
},
},
{
files: ['**/*.{js,mjs}'],
rules: {
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/restrict-template-expressions': 0,
},
},
{
files: ['tools/**/*.{ts,js,mjs}'],
env: {
node: true,
},
rules: {
'import/no-extraneous-dependencies': [
'error',
{ devDependencies: true },
],
},
},
{
files: ['tools/**/*.js'],
rules: {
// need commonjs
'@typescript-eslint/no-var-requires': 'off',
},
},
{
files: ['*.mjs'],
rules: {
// esm always requires extensions
'import/extensions': 0,
},
},
],
};