@andrewt03/eslint-typescript-rules 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eslint-rules/eslint.rules.d.mts +25 -0
- package/dist/eslint-rules/eslint.rules.d.ts +25 -0
- package/dist/eslint-rules/eslint.rules.js +257 -0
- package/dist/eslint-rules/eslint.rules.mjs +231 -0
- package/dist/eslint-rules/index.d.mts +2 -0
- package/dist/eslint-rules/index.d.ts +2 -0
- package/dist/eslint-rules/index.js +1 -0
- package/dist/eslint-rules/index.mjs +0 -0
- package/dist/index.js +3 -1
- package/dist/index.mjs +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint Ruleset Configuration (Exported At Bottom of File)
|
|
3
|
+
*/
|
|
4
|
+
type ESLintOverrideRuleOptions = {
|
|
5
|
+
[key: string]: string | number | boolean | string[];
|
|
6
|
+
};
|
|
7
|
+
type ConsistentGenericConstructorOverrideRuleOptions = "constructor" | "type-annotation";
|
|
8
|
+
type ConsistentTypeDefinitionsOverrideRuleOptions = "interface" | "type";
|
|
9
|
+
type ConfigRules = {
|
|
10
|
+
[key: string]: "off" | "warn" | "error" | ["warn" | "error", ESLintOverrideRuleOptions] | ["warn" | "error", ...ESLintOverrideRuleOptions[]] | ["warn" | "error", "always" | "never"] | ["warn" | "error", "always" | "never", ESLintOverrideRuleOptions] | ["warn" | "error", ConsistentGenericConstructorOverrideRuleOptions] | ["warn" | "error", ConsistentTypeDefinitionsOverrideRuleOptions];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @tutorial [ESLint-Reference](https://eslint.org/docs/latest/rules/)
|
|
14
|
+
*/
|
|
15
|
+
declare const STANDARD_ESLINT_CONFIG_RULES: ConfigRules;
|
|
16
|
+
/**
|
|
17
|
+
* @tutorial [TS-ESLint-Reference](https://typescript-eslint.io/rules/)
|
|
18
|
+
*/
|
|
19
|
+
declare const TYPESCRIPT_ESLINT_CONFIG_RULES: ConfigRules;
|
|
20
|
+
/**
|
|
21
|
+
* @tutorial [Unicorn-Reference](https://github.com/sindresorhus/eslint-plugin-unicorn/tree/main?tab=readme-ov-file)
|
|
22
|
+
*/
|
|
23
|
+
declare const UNICORN_ESLINT_CONFIG_RULES: ConfigRules;
|
|
24
|
+
|
|
25
|
+
export { STANDARD_ESLINT_CONFIG_RULES, TYPESCRIPT_ESLINT_CONFIG_RULES, UNICORN_ESLINT_CONFIG_RULES };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint Ruleset Configuration (Exported At Bottom of File)
|
|
3
|
+
*/
|
|
4
|
+
type ESLintOverrideRuleOptions = {
|
|
5
|
+
[key: string]: string | number | boolean | string[];
|
|
6
|
+
};
|
|
7
|
+
type ConsistentGenericConstructorOverrideRuleOptions = "constructor" | "type-annotation";
|
|
8
|
+
type ConsistentTypeDefinitionsOverrideRuleOptions = "interface" | "type";
|
|
9
|
+
type ConfigRules = {
|
|
10
|
+
[key: string]: "off" | "warn" | "error" | ["warn" | "error", ESLintOverrideRuleOptions] | ["warn" | "error", ...ESLintOverrideRuleOptions[]] | ["warn" | "error", "always" | "never"] | ["warn" | "error", "always" | "never", ESLintOverrideRuleOptions] | ["warn" | "error", ConsistentGenericConstructorOverrideRuleOptions] | ["warn" | "error", ConsistentTypeDefinitionsOverrideRuleOptions];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @tutorial [ESLint-Reference](https://eslint.org/docs/latest/rules/)
|
|
14
|
+
*/
|
|
15
|
+
declare const STANDARD_ESLINT_CONFIG_RULES: ConfigRules;
|
|
16
|
+
/**
|
|
17
|
+
* @tutorial [TS-ESLint-Reference](https://typescript-eslint.io/rules/)
|
|
18
|
+
*/
|
|
19
|
+
declare const TYPESCRIPT_ESLINT_CONFIG_RULES: ConfigRules;
|
|
20
|
+
/**
|
|
21
|
+
* @tutorial [Unicorn-Reference](https://github.com/sindresorhus/eslint-plugin-unicorn/tree/main?tab=readme-ov-file)
|
|
22
|
+
*/
|
|
23
|
+
declare const UNICORN_ESLINT_CONFIG_RULES: ConfigRules;
|
|
24
|
+
|
|
25
|
+
export { STANDARD_ESLINT_CONFIG_RULES, TYPESCRIPT_ESLINT_CONFIG_RULES, UNICORN_ESLINT_CONFIG_RULES };
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var eslint_rules_exports = {};
|
|
20
|
+
__export(eslint_rules_exports, {
|
|
21
|
+
STANDARD_ESLINT_CONFIG_RULES: () => STANDARD_ESLINT_CONFIG_RULES,
|
|
22
|
+
TYPESCRIPT_ESLINT_CONFIG_RULES: () => TYPESCRIPT_ESLINT_CONFIG_RULES,
|
|
23
|
+
UNICORN_ESLINT_CONFIG_RULES: () => UNICORN_ESLINT_CONFIG_RULES
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(eslint_rules_exports);
|
|
26
|
+
const STANDARD_ESLINT_CONFIG_RULES = {
|
|
27
|
+
semi: "error",
|
|
28
|
+
"no-console": "warn",
|
|
29
|
+
// FE - Warn, BE - Error
|
|
30
|
+
"no-debugger": "warn",
|
|
31
|
+
// FE - Warn, BE - Error
|
|
32
|
+
"no-var": "error",
|
|
33
|
+
"no-void": "error",
|
|
34
|
+
"prefer-const": "error",
|
|
35
|
+
"getter-return": "error",
|
|
36
|
+
"no-setter-return": "error",
|
|
37
|
+
"no-class-assign": "error",
|
|
38
|
+
"no-const-assign": "error",
|
|
39
|
+
"no-constant-binary-expression": "error",
|
|
40
|
+
"no-dupe-args": "error",
|
|
41
|
+
"no-dupe-else-if": "error",
|
|
42
|
+
"no-duplicate-case": "error",
|
|
43
|
+
"no-duplicate-imports": "error",
|
|
44
|
+
"no-ex-assign": "error",
|
|
45
|
+
"no-fallthrough": "error",
|
|
46
|
+
"no-inner-declarations": "error",
|
|
47
|
+
"no-octal": "error",
|
|
48
|
+
"no-octal-escape": "error",
|
|
49
|
+
"no-nonoctal-decimal-escape": "error",
|
|
50
|
+
"no-delete-var": "error",
|
|
51
|
+
"no-empty": "error",
|
|
52
|
+
// "no-empty-function": "error",
|
|
53
|
+
"no-empty-static-block": "error",
|
|
54
|
+
"no-eval": "error",
|
|
55
|
+
"no-implied-eval": "error",
|
|
56
|
+
"no-extend-native": "error",
|
|
57
|
+
"no-extra-bind": "error",
|
|
58
|
+
"no-extra-boolean-cast": "error",
|
|
59
|
+
"no-extra-label": "error",
|
|
60
|
+
"no-global-assign": "error",
|
|
61
|
+
"no-implicit-coercion": "error",
|
|
62
|
+
"no-label-var": "error",
|
|
63
|
+
"no-labels": "error",
|
|
64
|
+
"no-lone-blocks": "error",
|
|
65
|
+
"no-lonely-if": "error",
|
|
66
|
+
"no-multi-assign": "error",
|
|
67
|
+
"no-nested-ternary": "error",
|
|
68
|
+
"no-new": "error",
|
|
69
|
+
"no-new-func": "error",
|
|
70
|
+
"no-new-wrappers": "error",
|
|
71
|
+
"no-param-reassign": "error",
|
|
72
|
+
"no-proto": "error",
|
|
73
|
+
"no-return-assign": "error",
|
|
74
|
+
"no-script-url": "error",
|
|
75
|
+
"no-sequences": "error",
|
|
76
|
+
"no-compare-neg-zero": "error",
|
|
77
|
+
"no-underscore-dangle": "error",
|
|
78
|
+
"no-throw-literal": "error",
|
|
79
|
+
"no-unused-labels": "error",
|
|
80
|
+
"no-undefined": "error",
|
|
81
|
+
"no-useless-call": "error",
|
|
82
|
+
"no-useless-concat": "error",
|
|
83
|
+
"prefer-template": "error",
|
|
84
|
+
"no-useless-escape": "error",
|
|
85
|
+
"no-useless-return": "error",
|
|
86
|
+
"operator-assignment": ["error", "always"],
|
|
87
|
+
"prefer-exponentiation-operator": "error",
|
|
88
|
+
"prefer-object-has-own": "error",
|
|
89
|
+
"require-yield": "error",
|
|
90
|
+
yoda: "error",
|
|
91
|
+
"no-else-return": [
|
|
92
|
+
"error",
|
|
93
|
+
{
|
|
94
|
+
allowElseIf: true
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"max-len": [
|
|
98
|
+
"error",
|
|
99
|
+
{
|
|
100
|
+
code: 120,
|
|
101
|
+
tabWidth: 2,
|
|
102
|
+
ignoreComments: true,
|
|
103
|
+
ignoreTrailingComments: true,
|
|
104
|
+
ignoreUrls: true,
|
|
105
|
+
ignoreStrings: true,
|
|
106
|
+
ignoreTemplateLiterals: true
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"max-lines": [
|
|
110
|
+
"error",
|
|
111
|
+
{
|
|
112
|
+
max: 1e3,
|
|
113
|
+
skipBlankLines: true,
|
|
114
|
+
skipComments: true
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
"logical-assignment-operators": [
|
|
118
|
+
"error",
|
|
119
|
+
"always",
|
|
120
|
+
{ enforceForIfStatements: true }
|
|
121
|
+
],
|
|
122
|
+
"no-restricted-syntax": [
|
|
123
|
+
"error",
|
|
124
|
+
{
|
|
125
|
+
selector: "TSEnumDeclaration:not([const=true])",
|
|
126
|
+
message: "Avoid declaring non-const enums. Use const-types instead."
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
selector: "TSEnumDeclaration[const=true]",
|
|
130
|
+
message: "Avoid declaring const enums. Use const-types instead."
|
|
131
|
+
},
|
|
132
|
+
/**
|
|
133
|
+
* @tutorial [No-Explicit-Void-Return-Type](https://typescript-eslint.io/play/#ts=5.7.2&showAST=es&fileType=.tsx&code=GYVwdgxgLglg9mABAZwIYE8ASMAUBKALkQDc4YATRAbwChFEIFk4AbAUwDoW4BzHAImz88AbhoBfGjUZhkUFBmwAmIvkQBeAHwkyldYjVbqdBk1adufQTGFjJ0pvLRYYAZlV4N20hQ2JQkLAIarT0MszsXLwCQqISUhAsqMjIiACCxvTOyvhEPpSh9Kay5lFWsWL0kvZsAB4ADnAATvKJyakAIqhQqADCcAC2jWBsYPKF4VBNINDNIYj29DxsUGksLF09uTq%2BhWFmkZYxNnFV8Q6y8r1JKUp%2BhTxNbCseXplF4aVH1rYm4gA08SAA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQHYHsBaaFAF2gEsBjUxAE0OQE9dSBDAD3TAG1xsciaNHzRIAGn4CsA7JGSIkNUd0gAxWLhoV8uACKIq8NtDakduMAD4wAFQDKtpgAdEAQVwF253dbv2ANXwKOgBpRCYAd1E6CSlZSABbFGQ2AHNEVTcAN2C6MEQOZ3hqClJ4JjBIynNcNLAAHUhckKawElJYaEsAawjo6HyAChJ6ukMASgA6SHiIAF9JWUw5uQUlUhUMdU1tXQBRIpJkZAs-BydXDy8zM5sHIJDwqJi45Zxkk-TM7Zy8gqKJSoZQqVRqFDqjWaeTaHS6vX6MTAI0Q9UKzmms2Wi1WMmW8kUhk2Ym2Dg0Wh8uEuiHOjhc7k8%2BG8d38jzCiMGb3eSRS3yyLXy6KBIMq1TKEPqTQFsMQnW6YD6L0GyNGYBMIkimNW83iAF1%2BDr5kA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false)
|
|
134
|
+
* New Rule: Intended for developers to stop explicitly writing "void" return type explicitly (developed using ESTree ASTs).
|
|
135
|
+
*/
|
|
136
|
+
{
|
|
137
|
+
selector: "FunctionDeclaration > TSTypeAnnotation > TSVoidKeyword",
|
|
138
|
+
message: '[FunctionDeclaration] Avoid explicitly declaring a "void" return type.'
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
selector: "FunctionExpression > TSTypeAnnotation > TSVoidKeyword",
|
|
142
|
+
message: '[FunctionExpression] Avoid explicitly declaring a "void" return type.'
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
selector: "TSFunctionType > TSTypeAnnotation > TSVoidKeyword",
|
|
146
|
+
message: '[FunctionType] Avoid explicitly declaring a "void" return type.'
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
};
|
|
150
|
+
const TYPESCRIPT_ESLINT_CONFIG_RULES = {
|
|
151
|
+
// "void" keyword is allowed
|
|
152
|
+
// Issue: https://github.com/typescript-eslint/typescript-eslint/issues/7250
|
|
153
|
+
// "@typescript-eslint/explicit-function-return-type": ["warn", {
|
|
154
|
+
// allowExpressions: true,
|
|
155
|
+
// allowTypedFunctionExpressions: true
|
|
156
|
+
// }],
|
|
157
|
+
"@typescript-eslint/no-explicit-any": "error",
|
|
158
|
+
"@typescript-eslint/no-unused-vars": "error",
|
|
159
|
+
"@typescript-eslint/prefer-readonly": "error",
|
|
160
|
+
"@typescript-eslint/array-type": "error",
|
|
161
|
+
"@typescript-eslint/ban-tslint-comment": "error",
|
|
162
|
+
"@typescript-eslint/consistent-generic-constructors": [
|
|
163
|
+
"error",
|
|
164
|
+
"constructor"
|
|
165
|
+
],
|
|
166
|
+
"consistent-return": "off",
|
|
167
|
+
// "@typescript-eslint/consistent-return": "error",
|
|
168
|
+
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
|
169
|
+
"default-param-last": "off",
|
|
170
|
+
"@typescript-eslint/default-param-last": "error",
|
|
171
|
+
"@typescript-eslint/no-array-delete": "error",
|
|
172
|
+
"no-dupe-class-members": "off",
|
|
173
|
+
"@typescript-eslint/no-dupe-class-members": "error",
|
|
174
|
+
"@typescript-eslint/no-duplicate-enum-values": "error",
|
|
175
|
+
"@typescript-eslint/no-deprecated": "error",
|
|
176
|
+
"@typescript-eslint/no-dynamic-delete": "error",
|
|
177
|
+
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
|
178
|
+
"@typescript-eslint/no-for-in-array": "error",
|
|
179
|
+
"no-loop-func": "off",
|
|
180
|
+
"@typescript-eslint/no-loop-func": "error",
|
|
181
|
+
"no-loss-of-precision": "off",
|
|
182
|
+
"@typescript-eslint/no-loss-of-precision": "error",
|
|
183
|
+
"@typescript-eslint/no-meaningless-void-operator": "error",
|
|
184
|
+
"@typescript-eslint/no-misused-new": "error",
|
|
185
|
+
"@typescript-eslint/no-mixed-enums": "error",
|
|
186
|
+
"@typescript-eslint/no-namespace": "error",
|
|
187
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
188
|
+
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
|
|
189
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
190
|
+
"no-redeclare": "off",
|
|
191
|
+
"@typescript-eslint/no-redeclare": "error",
|
|
192
|
+
"@typescript-eslint/no-require-imports": "error",
|
|
193
|
+
"@typescript-eslint/no-this-alias": "error",
|
|
194
|
+
"@typescript-eslint/no-unnecessary-condition": "error",
|
|
195
|
+
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
196
|
+
"@typescript-eslint/no-unnecessary-template-expression": "error",
|
|
197
|
+
"@typescript-eslint/no-unnecessary-type-arguments": "error",
|
|
198
|
+
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
|
199
|
+
"@typescript-eslint/no-unsafe-declaration-merging": "error",
|
|
200
|
+
"@typescript-eslint/no-unsafe-enum-comparison": "error",
|
|
201
|
+
"@typescript-eslint/no-unsafe-function-type": "error",
|
|
202
|
+
"@typescript-eslint/no-unsafe-return": "error",
|
|
203
|
+
"@typescript-eslint/no-unsafe-unary-minus": "error",
|
|
204
|
+
"no-useless-constructor": "off",
|
|
205
|
+
"@typescript-eslint/no-useless-constructor": "error",
|
|
206
|
+
"@typescript-eslint/no-useless-empty-export": "error",
|
|
207
|
+
"@typescript-eslint/no-var-requires": "error",
|
|
208
|
+
"@typescript-eslint/no-wrapper-object-types": "error",
|
|
209
|
+
"@typescript-eslint/prefer-as-const": "error",
|
|
210
|
+
"@typescript-eslint/prefer-find": "error",
|
|
211
|
+
"@typescript-eslint/prefer-for-of": "error",
|
|
212
|
+
"@typescript-eslint/prefer-function-type": "error",
|
|
213
|
+
"@typescript-eslint/prefer-includes": "error",
|
|
214
|
+
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
215
|
+
"@typescript-eslint/prefer-nullish-coalescing": "error",
|
|
216
|
+
"@typescript-eslint/prefer-optional-chain": "error",
|
|
217
|
+
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
|
218
|
+
"@typescript-eslint/related-getter-setter-pairs": "error",
|
|
219
|
+
"@typescript-eslint/prefer-ts-expect-error": "error",
|
|
220
|
+
"@typescript-eslint/require-array-sort-compare": "error",
|
|
221
|
+
"require-await": "off",
|
|
222
|
+
"@typescript-eslint/require-await": "error",
|
|
223
|
+
"@typescript-eslint/no-invalid-void-type": "error"
|
|
224
|
+
// "@typescript-eslint/sort-type-constituents": "error"
|
|
225
|
+
};
|
|
226
|
+
const UNICORN_ESLINT_CONFIG_RULES = {
|
|
227
|
+
"unicorn/no-console-spaces": "error",
|
|
228
|
+
"unicorn/no-empty-file": "error",
|
|
229
|
+
"unicorn/no-array-for-each": "error",
|
|
230
|
+
"unicorn/no-array-push-push": "error",
|
|
231
|
+
"unicorn/no-array-reduce": [
|
|
232
|
+
"error",
|
|
233
|
+
{
|
|
234
|
+
allowSimpleOperations: true
|
|
235
|
+
}
|
|
236
|
+
],
|
|
237
|
+
"unicorn/no-for-loop": "error",
|
|
238
|
+
"unicorn/no-instanceof-array": "error",
|
|
239
|
+
"unicorn/no-new-array": "error",
|
|
240
|
+
"unicorn/no-new-buffer": "error",
|
|
241
|
+
"unicorn/no-this-assignment": "error",
|
|
242
|
+
"unicorn/prefer-string-slice": "error",
|
|
243
|
+
"unicorn/prefer-module": "error",
|
|
244
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
245
|
+
"unicorn/prefer-string-trim-start-end": "error",
|
|
246
|
+
"unicorn/prefer-negative-index": "error",
|
|
247
|
+
"unicorn/consistent-existence-index-check": "error",
|
|
248
|
+
"unicorn/switch-case-braces": "error",
|
|
249
|
+
"unicorn/empty-brace-spaces": "error",
|
|
250
|
+
"unicorn/require-number-to-fixed-digits-argument": "error"
|
|
251
|
+
};
|
|
252
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
253
|
+
0 && (module.exports = {
|
|
254
|
+
STANDARD_ESLINT_CONFIG_RULES,
|
|
255
|
+
TYPESCRIPT_ESLINT_CONFIG_RULES,
|
|
256
|
+
UNICORN_ESLINT_CONFIG_RULES
|
|
257
|
+
});
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
const STANDARD_ESLINT_CONFIG_RULES = {
|
|
2
|
+
semi: "error",
|
|
3
|
+
"no-console": "warn",
|
|
4
|
+
// FE - Warn, BE - Error
|
|
5
|
+
"no-debugger": "warn",
|
|
6
|
+
// FE - Warn, BE - Error
|
|
7
|
+
"no-var": "error",
|
|
8
|
+
"no-void": "error",
|
|
9
|
+
"prefer-const": "error",
|
|
10
|
+
"getter-return": "error",
|
|
11
|
+
"no-setter-return": "error",
|
|
12
|
+
"no-class-assign": "error",
|
|
13
|
+
"no-const-assign": "error",
|
|
14
|
+
"no-constant-binary-expression": "error",
|
|
15
|
+
"no-dupe-args": "error",
|
|
16
|
+
"no-dupe-else-if": "error",
|
|
17
|
+
"no-duplicate-case": "error",
|
|
18
|
+
"no-duplicate-imports": "error",
|
|
19
|
+
"no-ex-assign": "error",
|
|
20
|
+
"no-fallthrough": "error",
|
|
21
|
+
"no-inner-declarations": "error",
|
|
22
|
+
"no-octal": "error",
|
|
23
|
+
"no-octal-escape": "error",
|
|
24
|
+
"no-nonoctal-decimal-escape": "error",
|
|
25
|
+
"no-delete-var": "error",
|
|
26
|
+
"no-empty": "error",
|
|
27
|
+
// "no-empty-function": "error",
|
|
28
|
+
"no-empty-static-block": "error",
|
|
29
|
+
"no-eval": "error",
|
|
30
|
+
"no-implied-eval": "error",
|
|
31
|
+
"no-extend-native": "error",
|
|
32
|
+
"no-extra-bind": "error",
|
|
33
|
+
"no-extra-boolean-cast": "error",
|
|
34
|
+
"no-extra-label": "error",
|
|
35
|
+
"no-global-assign": "error",
|
|
36
|
+
"no-implicit-coercion": "error",
|
|
37
|
+
"no-label-var": "error",
|
|
38
|
+
"no-labels": "error",
|
|
39
|
+
"no-lone-blocks": "error",
|
|
40
|
+
"no-lonely-if": "error",
|
|
41
|
+
"no-multi-assign": "error",
|
|
42
|
+
"no-nested-ternary": "error",
|
|
43
|
+
"no-new": "error",
|
|
44
|
+
"no-new-func": "error",
|
|
45
|
+
"no-new-wrappers": "error",
|
|
46
|
+
"no-param-reassign": "error",
|
|
47
|
+
"no-proto": "error",
|
|
48
|
+
"no-return-assign": "error",
|
|
49
|
+
"no-script-url": "error",
|
|
50
|
+
"no-sequences": "error",
|
|
51
|
+
"no-compare-neg-zero": "error",
|
|
52
|
+
"no-underscore-dangle": "error",
|
|
53
|
+
"no-throw-literal": "error",
|
|
54
|
+
"no-unused-labels": "error",
|
|
55
|
+
"no-undefined": "error",
|
|
56
|
+
"no-useless-call": "error",
|
|
57
|
+
"no-useless-concat": "error",
|
|
58
|
+
"prefer-template": "error",
|
|
59
|
+
"no-useless-escape": "error",
|
|
60
|
+
"no-useless-return": "error",
|
|
61
|
+
"operator-assignment": ["error", "always"],
|
|
62
|
+
"prefer-exponentiation-operator": "error",
|
|
63
|
+
"prefer-object-has-own": "error",
|
|
64
|
+
"require-yield": "error",
|
|
65
|
+
yoda: "error",
|
|
66
|
+
"no-else-return": [
|
|
67
|
+
"error",
|
|
68
|
+
{
|
|
69
|
+
allowElseIf: true
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"max-len": [
|
|
73
|
+
"error",
|
|
74
|
+
{
|
|
75
|
+
code: 120,
|
|
76
|
+
tabWidth: 2,
|
|
77
|
+
ignoreComments: true,
|
|
78
|
+
ignoreTrailingComments: true,
|
|
79
|
+
ignoreUrls: true,
|
|
80
|
+
ignoreStrings: true,
|
|
81
|
+
ignoreTemplateLiterals: true
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"max-lines": [
|
|
85
|
+
"error",
|
|
86
|
+
{
|
|
87
|
+
max: 1e3,
|
|
88
|
+
skipBlankLines: true,
|
|
89
|
+
skipComments: true
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"logical-assignment-operators": [
|
|
93
|
+
"error",
|
|
94
|
+
"always",
|
|
95
|
+
{ enforceForIfStatements: true }
|
|
96
|
+
],
|
|
97
|
+
"no-restricted-syntax": [
|
|
98
|
+
"error",
|
|
99
|
+
{
|
|
100
|
+
selector: "TSEnumDeclaration:not([const=true])",
|
|
101
|
+
message: "Avoid declaring non-const enums. Use const-types instead."
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
selector: "TSEnumDeclaration[const=true]",
|
|
105
|
+
message: "Avoid declaring const enums. Use const-types instead."
|
|
106
|
+
},
|
|
107
|
+
/**
|
|
108
|
+
* @tutorial [No-Explicit-Void-Return-Type](https://typescript-eslint.io/play/#ts=5.7.2&showAST=es&fileType=.tsx&code=GYVwdgxgLglg9mABAZwIYE8ASMAUBKALkQDc4YATRAbwChFEIFk4AbAUwDoW4BzHAImz88AbhoBfGjUZhkUFBmwAmIvkQBeAHwkyldYjVbqdBk1adufQTGFjJ0pvLRYYAZlV4N20hQ2JQkLAIarT0MszsXLwCQqISUhAsqMjIiACCxvTOyvhEPpSh9Kay5lFWsWL0kvZsAB4ADnAATvKJyakAIqhQqADCcAC2jWBsYPKF4VBNINDNIYj29DxsUGksLF09uTq%2BhWFmkZYxNnFV8Q6y8r1JKUp%2BhTxNbCseXplF4aVH1rYm4gA08SAA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQHYHsBaaFAF2gEsBjUxAE0OQE9dSBDAD3TAG1xsciaNHzRIAGn4CsA7JGSIkNUd0gAxWLhoV8uACKIq8NtDakduMAD4wAFQDKtpgAdEAQVwF253dbv2ANXwKOgBpRCYAd1E6CSlZSABbFGQ2AHNEVTcAN2C6MEQOZ3hqClJ4JjBIynNcNLAAHUhckKawElJYaEsAawjo6HyAChJ6ukMASgA6SHiIAF9JWUw5uQUlUhUMdU1tXQBRIpJkZAs-BydXDy8zM5sHIJDwqJi45Zxkk-TM7Zy8gqKJSoZQqVRqFDqjWaeTaHS6vX6MTAI0Q9UKzmms2Wi1WMmW8kUhk2Ym2Dg0Wh8uEuiHOjhc7k8%2BG8d38jzCiMGb3eSRS3yyLXy6KBIMq1TKEPqTQFsMQnW6YD6L0GyNGYBMIkimNW83iAF1%2BDr5kA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false)
|
|
109
|
+
* New Rule: Intended for developers to stop explicitly writing "void" return type explicitly (developed using ESTree ASTs).
|
|
110
|
+
*/
|
|
111
|
+
{
|
|
112
|
+
selector: "FunctionDeclaration > TSTypeAnnotation > TSVoidKeyword",
|
|
113
|
+
message: '[FunctionDeclaration] Avoid explicitly declaring a "void" return type.'
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
selector: "FunctionExpression > TSTypeAnnotation > TSVoidKeyword",
|
|
117
|
+
message: '[FunctionExpression] Avoid explicitly declaring a "void" return type.'
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
selector: "TSFunctionType > TSTypeAnnotation > TSVoidKeyword",
|
|
121
|
+
message: '[FunctionType] Avoid explicitly declaring a "void" return type.'
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
};
|
|
125
|
+
const TYPESCRIPT_ESLINT_CONFIG_RULES = {
|
|
126
|
+
// "void" keyword is allowed
|
|
127
|
+
// Issue: https://github.com/typescript-eslint/typescript-eslint/issues/7250
|
|
128
|
+
// "@typescript-eslint/explicit-function-return-type": ["warn", {
|
|
129
|
+
// allowExpressions: true,
|
|
130
|
+
// allowTypedFunctionExpressions: true
|
|
131
|
+
// }],
|
|
132
|
+
"@typescript-eslint/no-explicit-any": "error",
|
|
133
|
+
"@typescript-eslint/no-unused-vars": "error",
|
|
134
|
+
"@typescript-eslint/prefer-readonly": "error",
|
|
135
|
+
"@typescript-eslint/array-type": "error",
|
|
136
|
+
"@typescript-eslint/ban-tslint-comment": "error",
|
|
137
|
+
"@typescript-eslint/consistent-generic-constructors": [
|
|
138
|
+
"error",
|
|
139
|
+
"constructor"
|
|
140
|
+
],
|
|
141
|
+
"consistent-return": "off",
|
|
142
|
+
// "@typescript-eslint/consistent-return": "error",
|
|
143
|
+
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
|
144
|
+
"default-param-last": "off",
|
|
145
|
+
"@typescript-eslint/default-param-last": "error",
|
|
146
|
+
"@typescript-eslint/no-array-delete": "error",
|
|
147
|
+
"no-dupe-class-members": "off",
|
|
148
|
+
"@typescript-eslint/no-dupe-class-members": "error",
|
|
149
|
+
"@typescript-eslint/no-duplicate-enum-values": "error",
|
|
150
|
+
"@typescript-eslint/no-deprecated": "error",
|
|
151
|
+
"@typescript-eslint/no-dynamic-delete": "error",
|
|
152
|
+
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
|
153
|
+
"@typescript-eslint/no-for-in-array": "error",
|
|
154
|
+
"no-loop-func": "off",
|
|
155
|
+
"@typescript-eslint/no-loop-func": "error",
|
|
156
|
+
"no-loss-of-precision": "off",
|
|
157
|
+
"@typescript-eslint/no-loss-of-precision": "error",
|
|
158
|
+
"@typescript-eslint/no-meaningless-void-operator": "error",
|
|
159
|
+
"@typescript-eslint/no-misused-new": "error",
|
|
160
|
+
"@typescript-eslint/no-mixed-enums": "error",
|
|
161
|
+
"@typescript-eslint/no-namespace": "error",
|
|
162
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
163
|
+
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
|
|
164
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
165
|
+
"no-redeclare": "off",
|
|
166
|
+
"@typescript-eslint/no-redeclare": "error",
|
|
167
|
+
"@typescript-eslint/no-require-imports": "error",
|
|
168
|
+
"@typescript-eslint/no-this-alias": "error",
|
|
169
|
+
"@typescript-eslint/no-unnecessary-condition": "error",
|
|
170
|
+
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
171
|
+
"@typescript-eslint/no-unnecessary-template-expression": "error",
|
|
172
|
+
"@typescript-eslint/no-unnecessary-type-arguments": "error",
|
|
173
|
+
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
|
174
|
+
"@typescript-eslint/no-unsafe-declaration-merging": "error",
|
|
175
|
+
"@typescript-eslint/no-unsafe-enum-comparison": "error",
|
|
176
|
+
"@typescript-eslint/no-unsafe-function-type": "error",
|
|
177
|
+
"@typescript-eslint/no-unsafe-return": "error",
|
|
178
|
+
"@typescript-eslint/no-unsafe-unary-minus": "error",
|
|
179
|
+
"no-useless-constructor": "off",
|
|
180
|
+
"@typescript-eslint/no-useless-constructor": "error",
|
|
181
|
+
"@typescript-eslint/no-useless-empty-export": "error",
|
|
182
|
+
"@typescript-eslint/no-var-requires": "error",
|
|
183
|
+
"@typescript-eslint/no-wrapper-object-types": "error",
|
|
184
|
+
"@typescript-eslint/prefer-as-const": "error",
|
|
185
|
+
"@typescript-eslint/prefer-find": "error",
|
|
186
|
+
"@typescript-eslint/prefer-for-of": "error",
|
|
187
|
+
"@typescript-eslint/prefer-function-type": "error",
|
|
188
|
+
"@typescript-eslint/prefer-includes": "error",
|
|
189
|
+
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
190
|
+
"@typescript-eslint/prefer-nullish-coalescing": "error",
|
|
191
|
+
"@typescript-eslint/prefer-optional-chain": "error",
|
|
192
|
+
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
|
193
|
+
"@typescript-eslint/related-getter-setter-pairs": "error",
|
|
194
|
+
"@typescript-eslint/prefer-ts-expect-error": "error",
|
|
195
|
+
"@typescript-eslint/require-array-sort-compare": "error",
|
|
196
|
+
"require-await": "off",
|
|
197
|
+
"@typescript-eslint/require-await": "error",
|
|
198
|
+
"@typescript-eslint/no-invalid-void-type": "error"
|
|
199
|
+
// "@typescript-eslint/sort-type-constituents": "error"
|
|
200
|
+
};
|
|
201
|
+
const UNICORN_ESLINT_CONFIG_RULES = {
|
|
202
|
+
"unicorn/no-console-spaces": "error",
|
|
203
|
+
"unicorn/no-empty-file": "error",
|
|
204
|
+
"unicorn/no-array-for-each": "error",
|
|
205
|
+
"unicorn/no-array-push-push": "error",
|
|
206
|
+
"unicorn/no-array-reduce": [
|
|
207
|
+
"error",
|
|
208
|
+
{
|
|
209
|
+
allowSimpleOperations: true
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
"unicorn/no-for-loop": "error",
|
|
213
|
+
"unicorn/no-instanceof-array": "error",
|
|
214
|
+
"unicorn/no-new-array": "error",
|
|
215
|
+
"unicorn/no-new-buffer": "error",
|
|
216
|
+
"unicorn/no-this-assignment": "error",
|
|
217
|
+
"unicorn/prefer-string-slice": "error",
|
|
218
|
+
"unicorn/prefer-module": "error",
|
|
219
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
220
|
+
"unicorn/prefer-string-trim-start-end": "error",
|
|
221
|
+
"unicorn/prefer-negative-index": "error",
|
|
222
|
+
"unicorn/consistent-existence-index-check": "error",
|
|
223
|
+
"unicorn/switch-case-braces": "error",
|
|
224
|
+
"unicorn/empty-brace-spaces": "error",
|
|
225
|
+
"unicorn/require-number-to-fixed-digits-argument": "error"
|
|
226
|
+
};
|
|
227
|
+
export {
|
|
228
|
+
STANDARD_ESLINT_CONFIG_RULES,
|
|
229
|
+
TYPESCRIPT_ESLINT_CONFIG_RULES,
|
|
230
|
+
UNICORN_ESLINT_CONFIG_RULES
|
|
231
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
File without changes
|
package/dist/index.js
CHANGED
|
@@ -18,9 +18,11 @@ module.exports = __toCommonJS(index_exports);
|
|
|
18
18
|
__reExport(index_exports, require("./hello"), module.exports);
|
|
19
19
|
__reExport(index_exports, require("./number"), module.exports);
|
|
20
20
|
__reExport(index_exports, require("./class"), module.exports);
|
|
21
|
+
__reExport(index_exports, require("./eslint-rules"), module.exports);
|
|
21
22
|
// Annotate the CommonJS export names for ESM import in node:
|
|
22
23
|
0 && (module.exports = {
|
|
23
24
|
...require("./hello"),
|
|
24
25
|
...require("./number"),
|
|
25
|
-
...require("./class")
|
|
26
|
+
...require("./class"),
|
|
27
|
+
...require("./eslint-rules")
|
|
26
28
|
});
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andrewt03/eslint-typescript-rules",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "Recommended ESLint Rules for general TypeScript, Node.js/Express.js, Angular, and React.js Projects",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "tsup",
|
|
16
16
|
"release": "npm run build && changeset publish",
|
|
17
|
-
"version:patch": "npm run
|
|
18
|
-
"version:minor": "npm run
|
|
19
|
-
"version:major": "npm run
|
|
17
|
+
"version:patch": "npm run prettier && npm run lint && npm run build && npm version patch && npm install && npm run publish",
|
|
18
|
+
"version:minor": "npm run prettier && npm run lint && npm run build && npm version minor && npm install && npm run publish",
|
|
19
|
+
"version:major": "npm run prettier && npm run lint && npm run build && npm version major && npm install && npm run publish",
|
|
20
20
|
"publish": "npm publish --access public",
|
|
21
21
|
"lint": "tsc",
|
|
22
22
|
"prettier": "prettier --write .",
|