Skip to content

Commit 13f17df

Browse files
committed
feat: created separate configs for typescript and non-typescript configs
1 parent 36ba04c commit 13f17df

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

src/index.js

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,22 @@
44
'use strict';
55
const requireIndex = require('requireindex');
66

7-
const recommended = {
7+
const configs = {};
8+
configs.recommended = {
89
plugins: ['th-rules', 'sonarjs'],
910
extends: [
10-
'plugin:@typescript-eslint/strict-type-checked',
11-
'plugin:@typescript-eslint/stylistic-type-checked',
1211
'plugin:sonarjs/recommended-legacy',
1312
],
1413
rules: {
1514
'th-rules/no-destructuring': 'error',
1615
'th-rules/no-default-export': 'error',
1716
'unicorn/prefer-module': 'warn',
18-
'@typescript-eslint/naming-convention': 'warn',
1917
'unicorn/filename-case': 'off',
2018
'unicorn/no-array-callback-reference': 'off',
2119
'import/extensions': 'off',
22-
'@typescript-eslint/consistent-type-definitions': 'off',
2320
'unicorn/no-static-only-class': 'off',
24-
'@typescript-eslint/no-extraneous-class': 'off',
2521
'unicorn/no-await-expression-member': 'off',
26-
'@typescript-eslint/no-duplicate-type-constituents': 'off',
2722
'new-cap': 'off',
28-
'@typescript-eslint/no-non-null-assertion': 'off',
29-
'@typescript-eslint/require-await': 'off',
30-
'@typescript-eslint/no-unsafe-member-access': 'off',
31-
'@typescript-eslint/no-unsafe-call': 'off',
32-
'@typescript-eslint/no-unsafe-return': 'off',
33-
'@typescript-eslint/no-unsafe-argument': 'off',
3423
'no-await-in-loop': 'off',
3524
camelcase: 'warn',
3625
},
@@ -41,9 +30,31 @@ const recommended = {
4130
},
4231
};
4332

33+
for (const configName of Object.keys(configs)) {
34+
configs[configName + '-typescript'] = {
35+
...configs[configName],
36+
extends: [
37+
'plugin:@typescript-eslint/strict-type-checked',
38+
'plugin:@typescript-eslint/stylistic-type-checked',
39+
...configs[configName].extends,
40+
],
41+
rules: {
42+
...configs[configName].rules,
43+
'@typescript-eslint/naming-convention': 'warn',
44+
'@typescript-eslint/consistent-type-definitions': 'off',
45+
'@typescript-eslint/no-extraneous-class': 'off',
46+
'@typescript-eslint/no-duplicate-type-constituents': 'off',
47+
'@typescript-eslint/no-non-null-assertion': 'off',
48+
'@typescript-eslint/require-await': 'off',
49+
'@typescript-eslint/no-unsafe-member-access': 'off',
50+
'@typescript-eslint/no-unsafe-call': 'off',
51+
'@typescript-eslint/no-unsafe-return': 'off',
52+
'@typescript-eslint/no-unsafe-argument': 'off',
53+
},
54+
};
55+
}
56+
4457
module.exports = {
4558
rules: requireIndex(`${__dirname}/rules`),
46-
configs: {
47-
recommended,
48-
},
59+
configs,
4960
};

0 commit comments

Comments
 (0)