Skip to content

Commit 0c91022

Browse files
committed
chore: refactor eslintrc
1 parent 3beb27a commit 0c91022

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

.eslintrc.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ const parserOptions = {
55
sourceType: 'module',
66
};
77

8+
const tsCommonRules = {
9+
// This rule triggers false positives and doesn't add real type-safety value.
10+
// See: https://typescript-eslint.io/rules/no-redundant-type-constituents/#when-not-to-use-it
11+
'@typescript-eslint/no-redundant-type-constituents': 'off',
12+
};
13+
814
module.exports = {
915
root: true,
1016
extends: ['@metamask/eslint-config', '@metamask/eslint-config-nodejs'],
@@ -56,12 +62,10 @@ module.exports = {
5662
extends: ['@metamask/eslint-config-typescript'],
5763
parserOptions,
5864
rules: {
65+
...tsCommonRules,
66+
5967
// Enable rules that are disabled in `@metamask/eslint-config-typescript`
6068
'@typescript-eslint/no-explicit-any': 'error',
61-
62-
// This rule triggers false positives and doesn't add real type-safety value.
63-
// See: https://typescript-eslint.io/rules/no-redundant-type-constituents/#when-not-to-use-it
64-
'@typescript-eslint/no-redundant-type-constituents': 'off',
6569
},
6670
},
6771
{
@@ -76,6 +80,8 @@ module.exports = {
7680
extends: ['@metamask/eslint-config-typescript'],
7781
parserOptions,
7882
rules: {
83+
...tsCommonRules,
84+
7985
// TODO: re-lint everything once the migration is done
8086
'@typescript-eslint/no-explicit-any': 'off',
8187
},
@@ -86,6 +92,8 @@ module.exports = {
8692
extends: ['@metamask/eslint-config-typescript'],
8793
parserOptions,
8894
rules: {
95+
...tsCommonRules,
96+
8997
// TODO: re-lint everything once the migration is done
9098
'import/order': 'off',
9199
'jsdoc/newline-after-description': 'off',
@@ -97,14 +105,12 @@ module.exports = {
97105
extends: ['@metamask/eslint-config-typescript'],
98106
parserOptions,
99107
rules: {
108+
...tsCommonRules,
109+
100110
// FIXME: for some reason, it seems eslint is not able to infere those (this
101111
// works on the original repository, so there might be some side-effects now that
102112
// we are building in a monorepo)
103113
'@typescript-eslint/restrict-template-expressions': 'off',
104-
105-
// This rule triggers false positives and doesn't add real type-safety value.
106-
// See: https://typescript-eslint.io/rules/no-redundant-type-constituents/#when-not-to-use-it
107-
'@typescript-eslint/no-redundant-type-constituents': 'off',
108114
},
109115
},
110116
// @metamask/keyring-eth-hd
@@ -164,6 +170,8 @@ module.exports = {
164170
extends: ['@metamask/eslint-config-typescript'],
165171
parserOptions,
166172
rules: {
173+
...tsCommonRules,
174+
167175
// TODO: re-lint everything once the migration is done
168176
'@typescript-eslint/consistent-type-definitions': 'off',
169177
'@typescript-eslint/consistent-type-imports': 'off',
@@ -183,10 +191,6 @@ module.exports = {
183191
'jsdoc/tag-lines': 'off',
184192
'n/no-callback-literal': 'off',
185193
'promise/no-multiple-resolved': 'off',
186-
187-
// This rule triggers false positives and doesn't add real type-safety value.
188-
// See: https://typescript-eslint.io/rules/no-redundant-type-constituents/#when-not-to-use-it
189-
'@typescript-eslint/no-redundant-type-constituents': 'off',
190194
},
191195
},
192196
// @metamask/keyring-snap-bridge
@@ -195,16 +199,14 @@ module.exports = {
195199
extends: ['@metamask/eslint-config-typescript'],
196200
parserOptions,
197201
rules: {
202+
...tsCommonRules,
203+
198204
// TODO: re-lint everything once the migration is done
199205
'@typescript-eslint/no-explicit-any': 'off',
200206
// FIXME: for some reason, it seems eslint is not able to infere those (this
201207
// works on the original repository, so there might be some side-effects now that
202208
// we are building in a monorepo)
203209
'@typescript-eslint/restrict-template-expressions': 'off',
204-
205-
// This rule triggers false positives and doesn't add real type-safety value.
206-
// See: https://typescript-eslint.io/rules/no-redundant-type-constituents/#when-not-to-use-it
207-
'@typescript-eslint/no-redundant-type-constituents': 'off',
208210
},
209211
},
210212
// @metamask/keyring-snap-sdk
@@ -225,16 +227,14 @@ module.exports = {
225227
extends: ['@metamask/eslint-config-typescript'],
226228
parserOptions,
227229
rules: {
230+
...tsCommonRules,
231+
228232
// TODO: re-lint everything once the migration is done
229233
'@typescript-eslint/no-explicit-any': 'off',
230234
// FIXME: for some reason, it seems eslint is not able to infere those (this
231235
// works on the original repository, so there might be some side-effects now that
232236
// we are building in a monorepo)
233237
'@typescript-eslint/restrict-template-expressions': 'off',
234-
235-
// This rule triggers false positives and doesn't add real type-safety value.
236-
// See: https://typescript-eslint.io/rules/no-redundant-type-constituents/#when-not-to-use-it
237-
'@typescript-eslint/no-redundant-type-constituents': 'off',
238238
},
239239
},
240240
],

0 commit comments

Comments
 (0)