-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eslintrc.json
169 lines (160 loc) · 6.74 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
{
"env": {
"node": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module",
"project": "tsconfig.eslint.json"
},
"ignorePatterns": ["*.js", "test/**/input", "test/**/output"],
"plugins": ["@typescript-eslint", "ordered-imports", "unicorn", "jsdoc"],
"rules": {
// Possible errors
"no-await-in-loop": "error",
"no-extra-semi": "off", // in favor of @typescript-eslint/no-extra-semi (part of recommended)
"no-promise-executor-return": "error",
"no-template-curly-in-string": "error",
"no-unreachable-loop": "error",
"no-useless-backreference": "error",
"require-atomic-updates": "error",
// Best practices
"class-methods-use-this": "error",
"consistent-return": "error",
"curly": "error",
"default-case-last": "error",
"eqeqeq": "error",
"no-constructor-return": "error",
"no-else-return": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-label": "error",
"no-floating-decimal": "error",
"no-implicit-coercion": "error",
"no-iterator": "error",
"no-lone-blocks": "error",
"no-multi-str": "error",
"no-new": "error",
"no-new-wrappers": "error",
"no-octal-escape": "error",
"no-proto": "error",
"no-redeclare": "off", // in favor of @typescript-eslint/no-redeclare
"no-return-assign": "error",
"no-self-compare": "error",
"no-sequences": "error",
"no-throw-literal": "error",
"no-unmodified-loop-condition": "error",
"no-useless-call": "error",
"no-useless-concat": "error",
"no-useless-return": "error",
"no-void": "error",
"no-warning-comments": ["warn", { "terms": ["todo"], "location": "anywhere" }],
"radix": "error",
"wrap-iife": "error",
"yoda": "error",
// Variables
"no-label-var": "error",
"no-undef-init": "error",
"no-unused-vars": "off", // in favor of @typescript-eslint/no-unused-vars (part of recommended)
// Stylistic issues
"id-denylist": [
"error",
"any",
"Number",
"number",
"String",
"string",
"Boolean",
"boolean",
"Undefined",
"undefined"
],
"max-len": ["error", { "code": 120, "ignoreComments": false, "ignoreTrailingComments": false }], // length should match Prettier config
"no-lonely-if": "error",
"no-nested-ternary": "error",
"no-unneeded-ternary": "error",
"unicode-bom": "error",
// ECMAScript 6
"no-confusing-arrow": "error",
"no-dupe-class-members": "off", // in favor of @typescript-eslint/no-dupe-class-members
"no-duplicate-imports": "error",
"no-var": "error",
"prefer-const": "error",
"prefer-rest-params": "error",
"no-useless-rename": "error",
// plugin: @typescript-eslint - basic rules
"@typescript-eslint/naming-convention": "error",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/explicit-function-return-type": ["error"],
"@typescript-eslint/explicit-member-accessibility": ["error"],
"@typescript-eslint/no-confusing-non-null-assertion": ["error"],
"@typescript-eslint/no-extraneous-class": ["error"],
"@typescript-eslint/no-invalid-void-type": ["error"],
"@typescript-eslint/no-unnecessary-boolean-literal-compare": ["error"],
"@typescript-eslint/no-unnecessary-condition": ["error"],
"@typescript-eslint/no-unnecessary-qualifier": ["error"],
"@typescript-eslint/no-unnecessary-type-arguments": ["error"],
"@typescript-eslint/parameter-properties": ["error"],
"@typescript-eslint/prefer-enum-initializers": ["error"],
"@typescript-eslint/prefer-for-of": ["error"],
"@typescript-eslint/prefer-literal-enum-member": ["error"],
"@typescript-eslint/prefer-readonly": ["error"],
"@typescript-eslint/promise-function-async": ["error"],
// plugin: @typescript-eslint - extension rules
"@typescript-eslint/default-param-last": ["error"],
"@typescript-eslint/no-dupe-class-members": ["error"],
"@typescript-eslint/no-invalid-this": ["error"],
"@typescript-eslint/no-loop-func": ["error"],
"@typescript-eslint/no-loss-of-precision": ["error"],
"@typescript-eslint/no-redeclare": ["error"],
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/no-unused-expressions": ["error"],
"@typescript-eslint/no-use-before-define": ["error"],
"@typescript-eslint/no-useless-constructor": ["error"],
"@typescript-eslint/return-await": ["error"],
// plugin: ordered-imports
"ordered-imports/ordered-imports": [
"error",
{
"symbols-first": false,
"declaration-ordering": ["source", "case-insensitive"],
"specifier-ordering": "case-insensitive"
}
],
// plugin: unicorn
"unicorn/custom-error-definition": ["error"],
"unicorn/explicit-length-check": ["error"],
"unicorn/filename-case": ["error", { "case": "snakeCase" }],
"unicorn/new-for-builtins": ["error"],
"unicorn/no-abusive-eslint-disable": ["error"],
"unicorn/no-instanceof-array": ["error"],
"unicorn/no-null": ["error"],
"unicorn/no-unused-properties": ["error"],
"unicorn/prefer-includes": ["error"],
"unicorn/prefer-string-starts-ends-with": ["error"],
"unicorn/prefer-ternary": ["error"],
"unicorn/prefer-dom-node-text-content": ["error"],
// plugin: jsdoc
"jsdoc/check-param-names": ["error"],
"jsdoc/check-tag-names": ["error"],
"jsdoc/empty-tags": ["error"],
"jsdoc/no-types": ["error"],
"jsdoc/require-description-complete-sentence": ["error"],
"jsdoc/require-jsdoc": ["error"],
"jsdoc/require-param-description": ["error"],
"jsdoc/require-param-name": ["error"],
"jsdoc/require-param": ["error"],
"jsdoc/require-returns-check": ["error"],
"jsdoc/require-returns-description": ["error"],
"jsdoc/require-returns": ["error"],
"jsdoc/require-throws": ["error"]
}
}