generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.eslintrc.json
173 lines (172 loc) · 6.1 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
{
"plugins": ["jest", "@typescript-eslint"],
"extends": [
"airbnb-base",
"plugin:jest/recommended",
"plugin:jest/style",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:prettier/recommended" // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.],
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"project": "./tsconfig.lint.json"
},
"rules": {
"no-plusplus": "off",
"import/no-named": "off",
"import/extensions": "off",
"import/no-unresolved": "off",
"import/prefer-default-export": "off",
"consistent-return": "off", // doesn't play well with TypeScript
"@typescript-eslint/explicit-module-boundary-types": "off", // implicit types are fine
"@typescript-eslint/explicit-function-return-type": "off", // allow implied
// TODO: Use fewer any types and re-enable
"@typescript-eslint/restrict-template-expressions": "off", // Too noisy
"@typescript-eslint/no-unsafe-member-access": "off", // Too noisy
"@typescript-eslint/no-unsafe-assignment": "off", // Too noisy
"@typescript-eslint/no-unsafe-return": "off", // Too noisy
"@typescript-eslint/no-unsafe-call": "off", // Too noisy
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/__tests__/**"]}],
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/no-empty-function": "warn",
"@typescript-eslint/prefer-as-const": "error",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/no-floating-promises": ["error", {"ignoreIIFE": true}],
// Copy-pasted from Airbnb so we can disable the ForOfStatement rule
// https://github.com/airbnb/javascript/blob/aa43bb23987a14baaa795cf795540a3f2eb41872/packages/eslint-config-airbnb-base/rules/style.js#L339
"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."
},
// Disabled because this is Node.js (which natively supports iterators/generators without a runtime)
// {
// selector: 'ForOfStatement',
// message: 'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.',
// },
{
"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."
}
],
// handled by @typescript-eslint/no-unused-vars
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", {"argsIgnorePattern": "^_"}],
// handled by @typescript-eslint/no-shadow
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
// handled by @typescript-eslint/no-use-before-define
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": "warn",
// handled by @typescript-eslint/no-useless-constructor
"no-useless-constructor": "off",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/array-type": ["error", {"default": "array-simple"}],
// handled by @typescript-eslint/naming-convention
"camelcase": "off",
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "default",
"format": ["camelCase"],
"leadingUnderscore": "allow"
},
{
"selector": "variableLike",
"format": ["camelCase", "UPPER_CASE", "PascalCase"],
"leadingUnderscore": "allow"
},
{
"selector": "parameter",
"format": null
},
{
"selector": "property",
"format": ["camelCase", "PascalCase", "UPPER_CASE", "snake_case"],
"leadingUnderscore": "allow"
},
{
"selector": "memberLike",
"format": ["camelCase"],
"leadingUnderscore": "allow"
},
{
"selector": "memberLike",
"modifiers": ["private"],
"format": ["camelCase"],
"leadingUnderscore": "require"
},
{
"selector": "typeLike",
"format": ["PascalCase"]
},
{
"selector": "typeParameter",
"format": ["PascalCase"]
},
{
"selector": "interface",
"format": ["PascalCase"],
"custom": {
"regex": "^I[A-Z]",
"match": false
}
},
{
"selector": "typeAlias",
"format": ["PascalCase"],
"custom": {
"regex": "Type$",
"match": false
}
},
{
"selector": "enum",
"format": ["PascalCase"],
"custom": {
"regex": "Enum$",
"match": false
}
},
{
"selector": "enumMember",
"format": ["PascalCase"]
}
],
"prefer-arrow-callback": ["error", {"allowNamedFunctions": true}],
"quotes": ["error", "single", {"allowTemplateLiterals": true, "avoidEscape": true}],
// Stricter than Airbnb
"constructor-super": "error",
"prefer-const": "error",
"no-class-assign": "error",
"no-this-before-super": "error",
"no-eq-null": "error",
"new-cap": "error",
"arrow-spacing": "error",
"block-spacing": "error",
"spaced-comment": "error",
"prefer-object-spread": "error",
"no-debugger": "error",
"no-extra-boolean-cast": "error",
"no-extra-bind": "error",
"no-useless-return": "error",
"yoda": "error",
"no-lonely-if": "error",
"no-unneeded-ternary": "error",
"prefer-spread": "error"
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
}
}