@pobammer-ts/eslint-cease-nonsense-rules 0.10.0 → 0.11.0
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/rules/ban-react-fc.js +2 -30
- package/dist/rules/ban-react-fc.js.map +1 -1
- package/dist/rules/enforce-ianitor-check-type.js +69 -157
- package/dist/rules/enforce-ianitor-check-type.js.map +1 -1
- package/dist/rules/no-color3-constructor.d.ts +0 -17
- package/dist/rules/no-color3-constructor.js +9 -31
- package/dist/rules/no-color3-constructor.js.map +1 -1
- package/dist/rules/no-instance-methods-without-this.js +2 -3
- package/dist/rules/no-instance-methods-without-this.js.map +1 -1
- package/dist/rules/no-print.d.ts +0 -15
- package/dist/rules/no-print.js +0 -21
- package/dist/rules/no-print.js.map +1 -1
- package/dist/rules/no-shorthand-names.d.ts +0 -24
- package/dist/rules/no-shorthand-names.js +18 -72
- package/dist/rules/no-shorthand-names.js.map +1 -1
- package/dist/rules/no-warn.d.ts +0 -15
- package/dist/rules/no-warn.js +0 -21
- package/dist/rules/no-warn.js.map +1 -1
- package/dist/rules/prefer-sequence-overloads.js +9 -16
- package/dist/rules/prefer-sequence-overloads.js.map +1 -1
- package/dist/rules/prefer-udim2-shorthand.d.ts +0 -14
- package/dist/rules/prefer-udim2-shorthand.js +17 -46
- package/dist/rules/prefer-udim2-shorthand.js.map +1 -1
- package/dist/rules/require-named-effect-functions.js +197 -59
- package/dist/rules/require-named-effect-functions.js.map +1 -1
- package/dist/rules/require-react-component-keys.d.ts +5 -6
- package/dist/rules/require-react-component-keys.js +119 -129
- package/dist/rules/require-react-component-keys.js.map +1 -1
- package/dist/rules/use-exhaustive-dependencies.d.ts +0 -42
- package/dist/rules/use-exhaustive-dependencies.js +100 -227
- package/dist/rules/use-exhaustive-dependencies.js.map +1 -1
- package/package.json +9 -7
|
@@ -1,84 +1,159 @@
|
|
|
1
1
|
import { TSESTree } from "@typescript-eslint/types";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
2
|
+
import Type from "typebox";
|
|
3
|
+
import { Compile } from "typebox/compile";
|
|
5
4
|
const DEFAULT_HOOKS = ["useEffect", "useLayoutEffect", "useInsertionEffect"];
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (optionsInput === undefined) {
|
|
5
|
+
const isRuleOptions = Compile(Type.Object({
|
|
6
|
+
allowAsyncFunctionDeclarations: Type.Boolean(),
|
|
7
|
+
environment: Type.Union([Type.Literal("roblox-ts"), Type.Literal("standard")]),
|
|
8
|
+
hooks: Type.Array(Type.String()),
|
|
9
|
+
}, { additionalProperties: true }));
|
|
10
|
+
function parseOptions(options) {
|
|
11
|
+
if (options === undefined) {
|
|
14
12
|
return {
|
|
13
|
+
allowAsyncFunctionDeclarations: false,
|
|
15
14
|
environment: "roblox-ts",
|
|
16
15
|
hooks: DEFAULT_HOOKS,
|
|
17
16
|
};
|
|
18
17
|
}
|
|
19
|
-
if (
|
|
18
|
+
if (!isRuleOptions.Check(options)) {
|
|
20
19
|
return {
|
|
20
|
+
allowAsyncFunctionDeclarations: false,
|
|
21
21
|
environment: "roblox-ts",
|
|
22
22
|
hooks: DEFAULT_HOOKS,
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return { environment, hooks };
|
|
25
|
+
return {
|
|
26
|
+
allowAsyncFunctionDeclarations: options.allowAsyncFunctionDeclarations,
|
|
27
|
+
environment: options.environment === "standard" ? "standard" : "roblox-ts",
|
|
28
|
+
hooks: options.hooks,
|
|
29
|
+
};
|
|
31
30
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
* @param callExpr - The call expression object.
|
|
36
|
-
* @returns The hook name or undefined.
|
|
37
|
-
*/
|
|
38
|
-
function getHookName(callExpr) {
|
|
39
|
-
const { callee } = callExpr;
|
|
40
|
-
if (callee.type === TSESTree.AST_NODE_TYPES.Identifier && callee.name)
|
|
31
|
+
function getHookName(callExpression) {
|
|
32
|
+
const { callee } = callExpression;
|
|
33
|
+
if (callee.type === TSESTree.AST_NODE_TYPES.Identifier && typeof callee.name === "string" && callee.name.length > 0)
|
|
41
34
|
return callee.name;
|
|
42
35
|
if (callee.type === TSESTree.AST_NODE_TYPES.MemberExpression &&
|
|
43
36
|
callee.property?.type === TSESTree.AST_NODE_TYPES.Identifier &&
|
|
44
|
-
callee.property.name
|
|
37
|
+
typeof callee.property.name === "string" &&
|
|
38
|
+
callee.property.name.length > 0)
|
|
45
39
|
return callee.property.name;
|
|
46
40
|
return undefined;
|
|
47
41
|
}
|
|
42
|
+
function resolveIdentifierToFunction(identifier, context) {
|
|
43
|
+
try {
|
|
44
|
+
const scope = context.sourceCode.getScope?.(identifier);
|
|
45
|
+
if (typeof scope !== "object" || scope === null)
|
|
46
|
+
return undefined;
|
|
47
|
+
const scopeObj = scope;
|
|
48
|
+
const setVal = scopeObj.set;
|
|
49
|
+
if (!(setVal instanceof Map))
|
|
50
|
+
return undefined;
|
|
51
|
+
let variable;
|
|
52
|
+
let currentScope = scope;
|
|
53
|
+
while (typeof currentScope === "object" && currentScope !== null) {
|
|
54
|
+
const current = currentScope;
|
|
55
|
+
variable = current.set.get(identifier.name);
|
|
56
|
+
if (typeof variable === "object" && variable !== null)
|
|
57
|
+
break;
|
|
58
|
+
currentScope = current.upper;
|
|
59
|
+
}
|
|
60
|
+
if (typeof variable !== "object" || variable === null)
|
|
61
|
+
return undefined;
|
|
62
|
+
const castVariable = variable;
|
|
63
|
+
if (!Array.isArray(castVariable.defs) || castVariable.defs.length === 0)
|
|
64
|
+
return undefined;
|
|
65
|
+
for (const definition of castVariable.defs) {
|
|
66
|
+
if (typeof definition !== "object" || definition === null)
|
|
67
|
+
continue;
|
|
68
|
+
const castDefinition = definition;
|
|
69
|
+
const node = castDefinition.node;
|
|
70
|
+
if (typeof node !== "object" || node === null)
|
|
71
|
+
continue;
|
|
72
|
+
const castNode = node;
|
|
73
|
+
if (castNode.type === TSESTree.AST_NODE_TYPES.FunctionDeclaration) {
|
|
74
|
+
const funcNode = node;
|
|
75
|
+
return {
|
|
76
|
+
isAsync: Boolean(funcNode.async),
|
|
77
|
+
node: funcNode,
|
|
78
|
+
type: "function-declaration",
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (castNode.type === TSESTree.AST_NODE_TYPES.VariableDeclarator &&
|
|
82
|
+
typeof castNode.init === "object" &&
|
|
83
|
+
castNode.init !== null) {
|
|
84
|
+
const castInit = castNode.init;
|
|
85
|
+
if (castInit.type === TSESTree.AST_NODE_TYPES.ArrowFunctionExpression) {
|
|
86
|
+
const arrowNode = castNode.init;
|
|
87
|
+
return {
|
|
88
|
+
isAsync: Boolean(arrowNode.async),
|
|
89
|
+
node: arrowNode,
|
|
90
|
+
type: "arrow",
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
if (castInit.type === TSESTree.AST_NODE_TYPES.FunctionExpression) {
|
|
94
|
+
const funcExprNode = castNode.init;
|
|
95
|
+
return {
|
|
96
|
+
isAsync: Boolean(funcExprNode.async),
|
|
97
|
+
node: funcExprNode,
|
|
98
|
+
type: "function-expression",
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
48
109
|
const requireNamedEffectFunctions = {
|
|
49
|
-
/**
|
|
50
|
-
* Creates the ESLint rule visitor.
|
|
51
|
-
*
|
|
52
|
-
* @param context - The ESLint rule context.
|
|
53
|
-
* @returns The visitor object with AST node handlers.
|
|
54
|
-
*/
|
|
55
110
|
create(context) {
|
|
56
|
-
const
|
|
57
|
-
const effectHooks = new Set(
|
|
58
|
-
const isRobloxTsMode =
|
|
111
|
+
const { hooks, environment, allowAsyncFunctionDeclarations } = parseOptions(context.options[0]);
|
|
112
|
+
const effectHooks = new Set(hooks);
|
|
113
|
+
const isRobloxTsMode = environment === "roblox-ts";
|
|
59
114
|
return {
|
|
60
115
|
CallExpression(node) {
|
|
61
|
-
const
|
|
62
|
-
const hookName = getHookName(
|
|
63
|
-
if (
|
|
64
|
-
return;
|
|
65
|
-
const firstArg = callExpr.arguments?.[0];
|
|
66
|
-
if (!firstArg)
|
|
67
|
-
return;
|
|
68
|
-
const argNode = firstArg;
|
|
69
|
-
if (argNode.type === TSESTree.AST_NODE_TYPES.Identifier)
|
|
116
|
+
const callExpression = node;
|
|
117
|
+
const hookName = getHookName(callExpression);
|
|
118
|
+
if (typeof hookName !== "string" || !effectHooks.has(hookName))
|
|
70
119
|
return;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
data: { hook: hookName },
|
|
74
|
-
messageId: "arrowFunction",
|
|
75
|
-
node,
|
|
76
|
-
});
|
|
120
|
+
const firstArgument = callExpression.arguments?.[0];
|
|
121
|
+
if (firstArgument === undefined)
|
|
77
122
|
return;
|
|
78
|
-
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
|
|
123
|
+
const argumentNode = firstArgument;
|
|
124
|
+
if (argumentNode.type === TSESTree.AST_NODE_TYPES.Identifier) {
|
|
125
|
+
const identifier = argumentNode;
|
|
126
|
+
const resolved = resolveIdentifierToFunction(identifier, context);
|
|
127
|
+
if (resolved === undefined)
|
|
128
|
+
return;
|
|
129
|
+
if (resolved.type === "arrow") {
|
|
130
|
+
if (resolved.isAsync) {
|
|
131
|
+
if (!allowAsyncFunctionDeclarations) {
|
|
132
|
+
context.report({
|
|
133
|
+
data: { hook: hookName },
|
|
134
|
+
messageId: "identifierReferencesAsyncArrow",
|
|
135
|
+
node,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
context.report({
|
|
141
|
+
data: { hook: hookName },
|
|
142
|
+
messageId: "identifierReferencesArrow",
|
|
143
|
+
node,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
else if (resolved.type === "function-expression") {
|
|
148
|
+
const funcExpr = resolved.node;
|
|
149
|
+
if (funcExpr.id === undefined) {
|
|
150
|
+
context.report({
|
|
151
|
+
data: { hook: hookName },
|
|
152
|
+
messageId: "anonymousFunction",
|
|
153
|
+
node,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
else if (isRobloxTsMode) {
|
|
82
157
|
context.report({
|
|
83
158
|
data: { hook: hookName },
|
|
84
159
|
messageId: "functionExpression",
|
|
@@ -86,7 +161,60 @@ const requireNamedEffectFunctions = {
|
|
|
86
161
|
});
|
|
87
162
|
}
|
|
88
163
|
}
|
|
164
|
+
else if (resolved.type === "function-declaration" &&
|
|
165
|
+
resolved.isAsync &&
|
|
166
|
+
!allowAsyncFunctionDeclarations) {
|
|
167
|
+
context.report({
|
|
168
|
+
data: { hook: hookName },
|
|
169
|
+
messageId: "identifierReferencesAsyncFunction",
|
|
170
|
+
node,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (argumentNode.type === TSESTree.AST_NODE_TYPES.ArrowFunctionExpression) {
|
|
176
|
+
if (argumentNode.async) {
|
|
177
|
+
context.report({
|
|
178
|
+
data: { hook: hookName },
|
|
179
|
+
messageId: "asyncArrowFunction",
|
|
180
|
+
node,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
89
183
|
else {
|
|
184
|
+
context.report({
|
|
185
|
+
data: { hook: hookName },
|
|
186
|
+
messageId: "arrowFunction",
|
|
187
|
+
node,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (argumentNode.type === TSESTree.AST_NODE_TYPES.FunctionExpression) {
|
|
193
|
+
const functionExpressionNode = argumentNode;
|
|
194
|
+
// oxlint-disable-next-line typescript-eslint/strict-boolean-expressions
|
|
195
|
+
const functionHasId = Boolean(functionExpressionNode.id);
|
|
196
|
+
if (functionHasId && argumentNode.async) {
|
|
197
|
+
context.report({
|
|
198
|
+
data: { hook: hookName },
|
|
199
|
+
messageId: "asyncFunctionExpression",
|
|
200
|
+
node,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
else if (functionHasId && isRobloxTsMode) {
|
|
204
|
+
context.report({
|
|
205
|
+
data: { hook: hookName },
|
|
206
|
+
messageId: "functionExpression",
|
|
207
|
+
node,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
else if (!functionHasId && argumentNode.async) {
|
|
211
|
+
context.report({
|
|
212
|
+
data: { hook: hookName },
|
|
213
|
+
messageId: "asyncAnonymousFunction",
|
|
214
|
+
node,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
else if (!functionHasId) {
|
|
90
218
|
context.report({
|
|
91
219
|
data: { hook: hookName },
|
|
92
220
|
messageId: "anonymousFunction",
|
|
@@ -106,12 +234,24 @@ const requireNamedEffectFunctions = {
|
|
|
106
234
|
messages: {
|
|
107
235
|
anonymousFunction: "Use a named function instead of an anonymous function for better debuggability",
|
|
108
236
|
arrowFunction: "Use a named function instead of an arrow function for better debuggability",
|
|
237
|
+
asyncAnonymousFunction: "Async anonymous functions are not allowed in {{ hook }}. Use an async function declaration instead",
|
|
238
|
+
asyncArrowFunction: "Async arrow functions are not allowed in {{ hook }}. Use an async function declaration instead",
|
|
239
|
+
asyncFunctionDeclaration: "Async function declarations are not allowed in {{ hook }} unless allowAsyncFunctionDeclarations is enabled",
|
|
240
|
+
asyncFunctionExpression: "Async function expressions are not allowed in {{ hook }}. Use an async function declaration instead",
|
|
109
241
|
functionExpression: "Use a named function reference instead of a function expression for better debuggability",
|
|
242
|
+
identifierReferencesArrow: "{{ hook }} called with identifier that references an arrow function. Use a named function declaration instead",
|
|
243
|
+
identifierReferencesAsyncArrow: "{{ hook }} called with identifier that references an async arrow function. Async functions are not allowed unless allowAsyncFunctionDeclarations is enabled",
|
|
244
|
+
identifierReferencesAsyncFunction: "{{ hook }} called with identifier that references an async function. Async functions are not allowed unless allowAsyncFunctionDeclarations is enabled",
|
|
110
245
|
},
|
|
111
246
|
schema: [
|
|
112
247
|
{
|
|
113
248
|
additionalProperties: false,
|
|
114
249
|
properties: {
|
|
250
|
+
allowAsyncFunctionDeclarations: {
|
|
251
|
+
default: false,
|
|
252
|
+
description: "If true, allows async function declarations and identifiers that reference async functions. Other async function types remain disallowed.",
|
|
253
|
+
type: "boolean",
|
|
254
|
+
},
|
|
115
255
|
environment: {
|
|
116
256
|
default: "roblox-ts",
|
|
117
257
|
description: "Environment mode: 'roblox-ts' only allows identifiers, 'standard' allows both identifiers and named function expressions",
|
|
@@ -121,9 +261,7 @@ const requireNamedEffectFunctions = {
|
|
|
121
261
|
hooks: {
|
|
122
262
|
default: DEFAULT_HOOKS,
|
|
123
263
|
description: "Array of hook names to check",
|
|
124
|
-
items: {
|
|
125
|
-
type: "string",
|
|
126
|
-
},
|
|
264
|
+
items: { type: "string" },
|
|
127
265
|
type: "array",
|
|
128
266
|
},
|
|
129
267
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-named-effect-functions.js","sourceRoot":"","sources":["../../src/rules/require-named-effect-functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"require-named-effect-functions.js","sourceRoot":"","sources":["../../src/rules/require-named-effect-functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,MAAM,aAAa,GAAG,CAAC,WAAW,EAAE,iBAAiB,EAAE,oBAAoB,CAAU,CAAC;AAStF,MAAM,aAAa,GAAG,OAAO,CAC5B,IAAI,CAAC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;wBACtB,WAAW,EAAE,8BAA8B;wBAC3C,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;wBACzB,IAAI,EAAE,OAAO;qBACb;iBACD;gBACD,IAAI,EAAE,QAAQ;aACd;SACD;QACD,IAAI,EAAE,SAAS;KACf;CACD,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import type { TSESLint } from "@typescript-eslint/utils";
|
|
2
|
-
/**
|
|
3
|
-
* Configuration options for the require-react-component-keys rule.
|
|
4
|
-
*/
|
|
5
2
|
interface RuleOptions {
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
readonly allowRootKeys?: boolean;
|
|
4
|
+
readonly ignoreCallExpressions?: ReadonlyArray<string>;
|
|
5
|
+
readonly iterationMethods?: ReadonlyArray<string>;
|
|
6
|
+
readonly memoizationHooks?: ReadonlyArray<string>;
|
|
8
7
|
}
|
|
9
8
|
type Options = [RuleOptions?];
|
|
10
9
|
type MessageIds = "missingKey" | "rootComponentWithKey";
|
|
11
10
|
interface RuleDocsWithRecommended extends TSESLint.RuleMetaDataDocs {
|
|
12
|
-
recommended?: boolean;
|
|
11
|
+
readonly recommended?: boolean;
|
|
13
12
|
}
|
|
14
13
|
declare const requireReactComponentKeys: TSESLint.RuleModuleWithMetaDocs<MessageIds, Options, RuleDocsWithRecommended>;
|
|
15
14
|
export default requireReactComponentKeys;
|