-
Notifications
You must be signed in to change notification settings - Fork 39
/
.eslintrc.js
95 lines (93 loc) · 2.02 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
// A set of rules to easen misuse in the existing codebase
// We should fix these warnigns when possible
const warnRules = {
'import/prefer-default-export': 'warn',
'no-param-reassign': 'warn',
'import/no-cycle': 'warn',
'import/no-named-default': 'warn',
'import/no-named-as-default': 'warn',
};
// A set of common rules applicable to both JS and TS files
const commonRules = {
'no-await-in-loop': 'off',
};
module.exports = {
extends: [
'airbnb-base',
],
root: true,
env: {
node: true,
mocha: true,
},
rules: {
...warnRules,
...commonRules,
},
overrides: [
// TypeScript general rules
{
files: [
'**/*.ts',
],
extends: [
'airbnb-base',
'airbnb-typescript/base',
],
parserOptions: {
project: ['./tsconfig.json'],
},
rules: {
'@typescript-eslint/return-await': 'warn',
...warnRules,
...commonRules,
},
},
// TypeScript tests
{
files: [
'src/**/*.spec.ts',
'src/test/**/*.ts',
'tests/**/*.ts',
],
rules: {
// Ignore dirty-chai errors
'@typescript-eslint/no-unused-expressions': 0,
// Ignore require('dev-dependency') errors for tests and mocks
'import/no-extraneous-dependencies': 0,
},
parserOptions: {
project: ['./tsconfig.mocha.json'],
},
},
// Typings tests
{
files: [
'test-d/**/*.ts',
],
parserOptions: {
project: ['./tsconfig.tsd.json'],
},
},
// JS tests
{
files: [
'src/test/**/*.js',
'tests/**/*.js',
'*.config.js',
],
rules: {
// Ignore dirty-chai errors
'no-unused-expressions': 0,
// Ignore require('dev-dependency') errors for tests and mocks
'import/no-extraneous-dependencies': 0,
},
},
],
ignorePatterns: [
// TODO: why do we have d.ts files in typescript project at all?
'*.d.ts',
'build',
'dist',
],
};