-
Notifications
You must be signed in to change notification settings - Fork 3
/
.eslintrc.json
117 lines (111 loc) · 3.75 KB
/
.eslintrc.json
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{
"env": {
"es6": true,
"jest": true,
"node": true
},
"extends": [
"eslint:recommended",
"airbnb-base",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:jest/all",
"plugin:node/recommended",
"plugin:prettier/recommended" // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"import",
"jest", // relevancy to ensure correct unit tests to be evaluated
"node",
"prefer-arrow",
"prettier"
],
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
// use <root>/tsconfig.json
"typescript": {
"alwaysTryTypes": true // always try to resolve types under `<roo/>@types` directory even it doesn't contain any source code, like `@types/unist`
}
},
"node": {
"tryExtensions": [".ts", ".js", ".json"]
}
},
"reportUnusedDisableDirectives": true,
"rules": {
"@typescript-eslint/interface-name-prefix": 0,
"@typescript-eslint/no-use-before-define": 1,
"class-methods-use-this": 1,
// "func-names": 0,
"global-require": 1,
"guard-for-in": 1,
"max-classes-per-file": 0,
"no-array-constructor": 1,
"no-continue": 1,
"no-nested-ternary": 1,
"no-param-reassign": 1,
"no-plusplus": 1,
"no-process-exit": 1,
"no-proto": 1,
"no-restricted-syntax": [
"error",
{
"selector": "ForInStatement",
"message": "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array."
},
{
"selector": "LabeledStatement",
"message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
},
{
"selector": "WithStatement",
"message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
}
],
"no-return-assign": 1,
"no-underscore-dangle": 1,
"no-unreachable": 1,
"no-unused-vars": 0,
"no-use-before-define": 0,
"prefer-destructuring": 1,
// "prefer-object-spread": 0,
"prefer-rest-params": 1,
"prefer-spread": 1,
"strict": 0,
"valid-typeof": 1,
"vars-on-top": 1,
// eslint-plugin-es - https://mysticatea.github.io/eslint-plugin-es/
// eslint-plugin-import rules - https://github.com/benmosher/eslint-plugin-import/blob/master/README.md
"import/extensions": ["error", { "ts": "never" }],
"import/no-dynamic-require": 1,
"import/no-extraneous-dependencies": 0,
"import/prefer-default-export": 0,
// eslint-plugin-jest - https://github.com/jest-community/eslint-plugin-jest/blob/master/README.md
"jest/expect-expect": 1,
"jest/no-test-return-statement": 1,
"jest/no-truthy-falsy": 1,
"jest/prefer-called-with": 1,
"jest/prefer-expect-assertions": 0,
"jest/require-to-throw-message": 1,
"jest/require-top-level-describe": 1,
"jest/no-export": 1,
// for reference. Might be useful with switch to Typescript
// eslint-plugin-jsdoc - https://github.com/gajus/eslint-plugin-jsdoc/blob/master/README.md
// eslint-plugin-node - https://github.com/mysticatea/eslint-plugin-node
"node/no-extraneous-import": ["error", { "allowModules": ["ts-essentials"] }],
"node/no-unpublished-require": 1,
"node/no-unsupported-features/es-syntax": 0,
"node/no-deprecated-api": 1,
"prettier/prettier": "error"
}
}