Skip to content

Commit 812871d

Browse files
committed
chore: update eslint configuration to be the same as api-typings
1 parent f2eefe6 commit 812871d

File tree

1 file changed

+18
-26
lines changed

1 file changed

+18
-26
lines changed

.eslintrc.js

+18-26
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
module.exports = {
22
root: true,
33
parser: '@typescript-eslint/parser',
4+
parserOptions: {
5+
project: './tsconfig.json'
6+
},
47
plugins: [
58
'@typescript-eslint',
69
],
@@ -15,31 +18,19 @@ module.exports = {
1518
'@typescript-eslint/ban-ts-comment': ['off'],
1619
'@typescript-eslint/adjacent-overload-signatures': ['error'],
1720
'@typescript-eslint/ban-types': ['error', {
21+
extendDefaults: true,
1822
types: {
19-
Object: {
20-
message: 'Avoid using the `Object` type. Did you mean `object`?',
21-
fixWith: 'object'
22-
},
23-
Function: {
24-
message: 'Avoid using the `Function` type. Prefer a specific function type, like `() => void`.',
25-
fixWith: 'function'
26-
},
27-
Boolean: {
28-
message: 'Avoid using the `Boolean` type. Did you mean `boolean`?',
29-
fixWith: 'boolean'
30-
},
31-
Number: {
32-
message: 'Avoid using the `Number` type. Did you mean `number`?',
33-
fixWith: 'number'
34-
},
35-
String: {
36-
message: 'Avoid using the `String` type. Did you mean `string`?',
37-
fixWith: 'string'
38-
},
39-
Symbol: {
40-
message: 'Avoid using the `Symbol` type. Did you mean `symbol`?',
41-
fixWith: 'symbol'
42-
},
23+
/**
24+
* we are using `{}` as noop
25+
* e.g. `type A<P> = B & (P extends Q ? C : {})`
26+
* will get `B & C` when `P extends Q` and `B` otherwise
27+
*/
28+
'{}': false,
29+
/**
30+
* we actually need a type accepting any function-like value
31+
* e.g. `type Methods = Record<string, Function>`
32+
*/
33+
'Function': false,
4334
}
4435
}],
4536
'@typescript-eslint/member-delimiter-style': ['error', {
@@ -54,7 +45,7 @@ module.exports = {
5445
}],
5546
'@typescript-eslint/naming-convention': ['error', {
5647
selector: 'enum',
57-
format: ['UPPER_CASE'],
48+
format: ['PascalCase', 'UPPER_CASE'],
5849
leadingUnderscore: 'forbid',
5950
trailingUnderscore: 'forbid',
6051
}, {
@@ -66,6 +57,7 @@ module.exports = {
6657
'@typescript-eslint/array-type': ['error', {
6758
default: 'array-simple',
6859
readonly: 'array-simple'
69-
}]
60+
}],
61+
'@typescript-eslint/no-unnecessary-qualifier': ['error'],
7062
},
7163
}

0 commit comments

Comments
 (0)