-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheslint.config.js
67 lines (63 loc) · 1.79 KB
/
eslint.config.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
import tselPlugin from '@typescript-eslint/eslint-plugin';
import tselParser from '@typescript-eslint/parser';
const tselRules = tselPlugin.configs.recommended.rules;
function mapRuleNamespace(rules, sourceNamespace, targetNamespace) {
const pattern = new RegExp(sourceNamespace);
return Object.keys(rules).reduce((result, key) => {
const newKey = key.replace(pattern, targetNamespace);
result[newKey] = rules[key];
return result;
}, {});
}
const commonRules = {
semi: 'error',
'no-trailing-spaces': 'error',
};
export default [
'eslint:recommended',
{
files: ['**/*.js', '**/*.jsx'],
languageOptions: {
globals: {
console: true,
it: true,
describe: true,
setInterval: true,
clearInterval: true,
beforeEach: true,
setTimeout: true,
},
},
rules: {
...commonRules,
'no-unused-vars': ['error', { args: 'none' }],
},
},
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: tselParser,
globals: {
console: true,
it: true,
describe: true,
setInterval: true,
clearInterval: true,
beforeEach: true,
afterEach: true,
process: true,
setTimeout: true,
},
},
plugins: {
tsel: tselPlugin,
},
rules: Object.assign(
mapRuleNamespace(tselRules, '@typescript-eslint', 'tsel'),
{
...commonRules,
'tsel/no-unused-vars': ['error', { args: 'none' }],
}
),
},
];