@timmo001/oxlint-rules 0.2.1 → 0.3.1
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/README.md +2 -2
- package/dist/cli.js +344 -147
- package/dist/configs/{effect.js → recommended-effect.js} +246 -49
- package/dist/configs/recommended.js +237 -40
- package/dist/upstream/anti-slop.js +230 -33
- package/package.json +6 -6
- package/skills/install-timmo-oxlint-rules/SKILL.md +3 -2
- package/vendor/anti-slop/src/index.ts +4 -0
- package/vendor/anti-slop/src/rules/no-array-filter-map.ts +28 -0
- package/vendor/anti-slop/src/rules/no-reduce-accumulator-copy.ts +109 -0
- package/vendor/anti-slop/src/shared/array-method.ts +94 -0
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// node_modules/oxlint/dist/index.js
|
|
2
|
+
function defineConfig(config) {
|
|
3
|
+
return config;
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
// src/effect/index.ts
|
|
2
7
|
import { eslintCompatPlugin } from "@oxlint/plugins";
|
|
3
8
|
|
|
@@ -158,11 +163,211 @@ var antiSlopEffectPlugin = eslintCompatPlugin2({
|
|
|
158
163
|
}
|
|
159
164
|
});
|
|
160
165
|
var effect_default2 = antiSlopEffectPlugin;
|
|
166
|
+
// src/configs/enable-plugin-rules.ts
|
|
167
|
+
function enablePluginRules(namespace, plugin) {
|
|
168
|
+
return Object.fromEntries(Object.keys(plugin.rules).sort().map((rule) => [`${namespace}/${rule}`, "error"]));
|
|
169
|
+
}
|
|
170
|
+
|
|
161
171
|
// vendor/anti-slop/src/index.ts
|
|
162
172
|
import { eslintCompatPlugin as eslintCompatPlugin3 } from "@oxlint/plugins";
|
|
163
173
|
|
|
164
|
-
// vendor/anti-slop/src/rules/no-
|
|
174
|
+
// vendor/anti-slop/src/rules/no-array-filter-map.ts
|
|
165
175
|
import { defineRule as defineRule3 } from "@oxlint/plugins";
|
|
176
|
+
|
|
177
|
+
// vendor/anti-slop/src/shared/array-method.ts
|
|
178
|
+
function unwrapArrayExpression(node) {
|
|
179
|
+
while (node.type === "ParenthesizedExpression" || node.type === "ChainExpression" || node.type === "TSAsExpression" || node.type === "TSTypeAssertion" || node.type === "TSNonNullExpression" || node.type === "TSSatisfiesExpression") {
|
|
180
|
+
node = node.expression;
|
|
181
|
+
}
|
|
182
|
+
return node;
|
|
183
|
+
}
|
|
184
|
+
function resolveArrayBinding(sourceCode, node) {
|
|
185
|
+
node = unwrapArrayExpression(node);
|
|
186
|
+
if (node.type !== "Identifier")
|
|
187
|
+
return null;
|
|
188
|
+
let scope = sourceCode.getScope(node);
|
|
189
|
+
while (scope !== null) {
|
|
190
|
+
const variable = scope.set.get(node.name);
|
|
191
|
+
if (variable !== undefined)
|
|
192
|
+
return variable;
|
|
193
|
+
scope = scope.upper;
|
|
194
|
+
}
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
function arrayMethodTarget(node) {
|
|
198
|
+
node = unwrapArrayExpression(node);
|
|
199
|
+
if (node.type !== "MemberExpression")
|
|
200
|
+
return null;
|
|
201
|
+
const property = node.property;
|
|
202
|
+
if (!node.computed && property.type === "Identifier") {
|
|
203
|
+
return { name: property.name, object: node.object };
|
|
204
|
+
}
|
|
205
|
+
if (node.computed && property.type === "Literal" && typeof property.value === "string") {
|
|
206
|
+
return { name: property.value, object: node.object };
|
|
207
|
+
}
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
function isArrayAnnotation(type) {
|
|
211
|
+
if (type.type === "TSArrayType" || type.type === "TSTupleType")
|
|
212
|
+
return true;
|
|
213
|
+
if (type.type === "TSParenthesizedType")
|
|
214
|
+
return isArrayAnnotation(type.typeAnnotation);
|
|
215
|
+
if (type.type === "TSTypeOperator" && type.operator === "readonly") {
|
|
216
|
+
return isArrayAnnotation(type.typeAnnotation);
|
|
217
|
+
}
|
|
218
|
+
return type.type === "TSTypeReference" && type.typeName.type === "Identifier" && (type.typeName.name === "Array" || type.typeName.name === "ReadonlyArray");
|
|
219
|
+
}
|
|
220
|
+
function isKnownArrayExpression(sourceCode, node, visited = new Set) {
|
|
221
|
+
node = unwrapArrayExpression(node);
|
|
222
|
+
if (node.type === "ArrayExpression")
|
|
223
|
+
return true;
|
|
224
|
+
if (node.type === "CallExpression") {
|
|
225
|
+
const method = arrayMethodTarget(node.callee);
|
|
226
|
+
return method !== null && ["map", "filter", "flatMap", "slice", "concat", "toSorted", "toReversed", "toSpliced"].includes(method.name) && isKnownArrayExpression(sourceCode, method.object, visited);
|
|
227
|
+
}
|
|
228
|
+
if (node.type !== "Identifier")
|
|
229
|
+
return false;
|
|
230
|
+
const variable = resolveArrayBinding(sourceCode, node);
|
|
231
|
+
if (variable === null || visited.has(variable))
|
|
232
|
+
return false;
|
|
233
|
+
visited.add(variable);
|
|
234
|
+
if (variable.references.some((reference) => reference.isWrite() && !reference.init))
|
|
235
|
+
return false;
|
|
236
|
+
for (const identifier of variable.identifiers) {
|
|
237
|
+
const annotation = identifier.typeAnnotation?.typeAnnotation;
|
|
238
|
+
if (annotation !== undefined)
|
|
239
|
+
return isArrayAnnotation(annotation);
|
|
240
|
+
}
|
|
241
|
+
for (const definition of variable.defs) {
|
|
242
|
+
if (definition.type === "Variable" && definition.node.type === "VariableDeclarator" && definition.node.id.type === "Identifier" && definition.node.init !== null && definition.node.parent.type === "VariableDeclaration" && definition.node.parent.kind === "const") {
|
|
243
|
+
return isKnownArrayExpression(sourceCode, definition.node.init, visited);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// vendor/anti-slop/src/rules/no-array-filter-map.ts
|
|
250
|
+
var noArrayFilterMapRule = defineRule3({
|
|
251
|
+
meta: {
|
|
252
|
+
type: "suggestion",
|
|
253
|
+
docs: { description: "Disallow adjacent array filter/map passes in favor of lazy iterator helpers or a single transformation." },
|
|
254
|
+
messages: {
|
|
255
|
+
arrayFilterMap: "Avoid consecutive array `{{first}}` and `{{second}}` passes. Prefer `.values().{{first}}(...).{{second}}(...).toArray()` where iterator helpers are supported, or a single `flatMap`/mutating reducer. Preserve callback ordering, indexes, and filtering semantics."
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
createOnce(context) {
|
|
259
|
+
return {
|
|
260
|
+
CallExpression(node) {
|
|
261
|
+
const outer = arrayMethodTarget(node.callee);
|
|
262
|
+
if (outer === null || outer.name !== "map" && outer.name !== "filter")
|
|
263
|
+
return;
|
|
264
|
+
const innerCall = unwrapArrayExpression(outer.object);
|
|
265
|
+
if (innerCall.type !== "CallExpression")
|
|
266
|
+
return;
|
|
267
|
+
const inner = arrayMethodTarget(innerCall.callee);
|
|
268
|
+
if (inner === null || inner.name !== (outer.name === "map" ? "filter" : "map"))
|
|
269
|
+
return;
|
|
270
|
+
if (!isKnownArrayExpression(context.sourceCode, inner.object))
|
|
271
|
+
return;
|
|
272
|
+
context.report({ node, messageId: "arrayFilterMap", data: { first: inner.name, second: outer.name } });
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
// vendor/anti-slop/src/rules/no-reduce-accumulator-copy.ts
|
|
279
|
+
import { defineRule as defineRule4 } from "@oxlint/plugins";
|
|
280
|
+
function enclosingReducer(node) {
|
|
281
|
+
let parent = node.parent;
|
|
282
|
+
while (parent !== null) {
|
|
283
|
+
if (parent.type === "FunctionDeclaration")
|
|
284
|
+
return null;
|
|
285
|
+
if (parent.type === "ArrowFunctionExpression" || parent.type === "FunctionExpression") {
|
|
286
|
+
const callback = parent;
|
|
287
|
+
let owner = callback.parent;
|
|
288
|
+
while (owner !== null && unwrapArrayExpression(owner) === callback)
|
|
289
|
+
owner = owner.parent;
|
|
290
|
+
if (owner?.type !== "CallExpression")
|
|
291
|
+
return null;
|
|
292
|
+
const method = arrayMethodTarget(owner.callee);
|
|
293
|
+
const firstArgument = owner.arguments[0];
|
|
294
|
+
if (method === null || method.name !== "reduce" && method.name !== "reduceRight" || owner.arguments.length > 2 || firstArgument === undefined || unwrapArrayExpression(firstArgument) !== callback)
|
|
295
|
+
return null;
|
|
296
|
+
const firstParameter = callback.params[0];
|
|
297
|
+
const accumulator = firstParameter?.type === "AssignmentPattern" ? firstParameter.left : firstParameter;
|
|
298
|
+
if (accumulator?.type !== "Identifier")
|
|
299
|
+
return null;
|
|
300
|
+
return { callback, accumulator, initialValue: owner.arguments[1] };
|
|
301
|
+
}
|
|
302
|
+
parent = parent.parent;
|
|
303
|
+
}
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
function referencesAccumulator(sourceCode, node, accumulator, visited = new Set) {
|
|
307
|
+
const variable = resolveArrayBinding(sourceCode, node);
|
|
308
|
+
if (variable === null || visited.has(variable))
|
|
309
|
+
return false;
|
|
310
|
+
if (variable === accumulator)
|
|
311
|
+
return true;
|
|
312
|
+
visited.add(variable);
|
|
313
|
+
if (variable.references.some((reference) => reference.isWrite() && !reference.init))
|
|
314
|
+
return false;
|
|
315
|
+
for (const definition of variable.defs) {
|
|
316
|
+
if (definition.type === "Variable" && definition.node.type === "VariableDeclarator" && definition.node.id.type === "Identifier" && definition.node.init !== null && definition.node.parent.type === "VariableDeclaration" && definition.node.parent.kind === "const") {
|
|
317
|
+
return referencesAccumulator(sourceCode, definition.node.init, accumulator, visited);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
function isGlobalCopyOwner(sourceCode, node, name) {
|
|
323
|
+
node = unwrapArrayExpression(node);
|
|
324
|
+
if (node.type !== "Identifier" || node.name !== name)
|
|
325
|
+
return false;
|
|
326
|
+
const variable = resolveArrayBinding(sourceCode, node);
|
|
327
|
+
return variable === null || variable.defs.length === 0;
|
|
328
|
+
}
|
|
329
|
+
var noReduceAccumulatorCopyRule = defineRule4({
|
|
330
|
+
meta: {
|
|
331
|
+
type: "problem",
|
|
332
|
+
docs: { description: "Disallow copying growing reducer accumulators with Object.assign, Array.from, or array copy methods." },
|
|
333
|
+
messages: {
|
|
334
|
+
accumulatorCopy: "Do not copy the reducer accumulator on every iteration; growing copies can cause quadratic work. Mutate a fresh, locally owned accumulator and return it, or use an iterator pipeline/flatMap."
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
createOnce(context) {
|
|
338
|
+
return {
|
|
339
|
+
CallExpression(node) {
|
|
340
|
+
const method = arrayMethodTarget(node.callee);
|
|
341
|
+
if (method === null)
|
|
342
|
+
return;
|
|
343
|
+
const reducer = enclosingReducer(node);
|
|
344
|
+
if (reducer === null)
|
|
345
|
+
return;
|
|
346
|
+
const accumulator = context.sourceCode.getDeclaredVariables(reducer.callback).find((variable) => variable.identifiers.some((identifier) => identifier.start === reducer.accumulator.start));
|
|
347
|
+
if (accumulator === undefined)
|
|
348
|
+
return;
|
|
349
|
+
const isAccumulator = (expression) => referencesAccumulator(context.sourceCode, expression, accumulator);
|
|
350
|
+
let copiesAccumulator = false;
|
|
351
|
+
if (method.name === "assign" && isGlobalCopyOwner(context.sourceCode, method.object, "Object")) {
|
|
352
|
+
const target = node.arguments[0];
|
|
353
|
+
copiesAccumulator = target !== undefined && unwrapArrayExpression(target).type === "ObjectExpression" && node.arguments.slice(1).some(isAccumulator);
|
|
354
|
+
} else if (method.name === "from" && isGlobalCopyOwner(context.sourceCode, method.object, "Array")) {
|
|
355
|
+
const source = node.arguments[0];
|
|
356
|
+
copiesAccumulator = source !== undefined && isAccumulator(source);
|
|
357
|
+
} else if (["concat", "slice", "toSpliced", "toSorted", "toReversed", "with"].includes(method.name)) {
|
|
358
|
+
const initialValue = reducer.initialValue;
|
|
359
|
+
const arrayAccumulator = initialValue !== undefined && isKnownArrayExpression(context.sourceCode, initialValue);
|
|
360
|
+
copiesAccumulator = arrayAccumulator && isAccumulator(method.object);
|
|
361
|
+
}
|
|
362
|
+
if (copiesAccumulator)
|
|
363
|
+
context.report({ node, messageId: "accumulatorCopy" });
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
// vendor/anti-slop/src/rules/no-chained-type-assertions.ts
|
|
370
|
+
import { defineRule as defineRule5 } from "@oxlint/plugins";
|
|
166
371
|
function isTypeAssertionExpression(node) {
|
|
167
372
|
return node.type === "TSAsExpression" || node.type === "TSTypeAssertion";
|
|
168
373
|
}
|
|
@@ -197,7 +402,7 @@ function isForbiddenAssertionChain(node) {
|
|
|
197
402
|
}
|
|
198
403
|
return assertionCount > 1 && hasNonConstAssertion;
|
|
199
404
|
}
|
|
200
|
-
var noChainedTypeAssertionsRule =
|
|
405
|
+
var noChainedTypeAssertionsRule = defineRule5({
|
|
201
406
|
meta: {
|
|
202
407
|
type: "problem",
|
|
203
408
|
docs: {
|
|
@@ -221,7 +426,7 @@ var noChainedTypeAssertionsRule = defineRule3({
|
|
|
221
426
|
});
|
|
222
427
|
|
|
223
428
|
// vendor/anti-slop/src/rules/no-conditional-empty-object-spread.ts
|
|
224
|
-
import { defineRule as
|
|
429
|
+
import { defineRule as defineRule6 } from "@oxlint/plugins";
|
|
225
430
|
function unwrapParentheses(node) {
|
|
226
431
|
let current = node;
|
|
227
432
|
while (current.type === "ParenthesizedExpression") {
|
|
@@ -236,7 +441,7 @@ function isConditionalEmptyObjectSpread(node) {
|
|
|
236
441
|
const conditional = unwrapParentheses(node);
|
|
237
442
|
return conditional.type === "ConditionalExpression" && (isEmptyObjectExpression(conditional.consequent) || isEmptyObjectExpression(conditional.alternate));
|
|
238
443
|
}
|
|
239
|
-
var noConditionalEmptyObjectSpreadRule =
|
|
444
|
+
var noConditionalEmptyObjectSpreadRule = defineRule6({
|
|
240
445
|
meta: {
|
|
241
446
|
type: "suggestion",
|
|
242
447
|
docs: {
|
|
@@ -260,7 +465,7 @@ var noConditionalEmptyObjectSpreadRule = defineRule4({
|
|
|
260
465
|
});
|
|
261
466
|
|
|
262
467
|
// vendor/anti-slop/src/rules/no-known-value-widening.ts
|
|
263
|
-
import { defineRule as
|
|
468
|
+
import { defineRule as defineRule7 } from "@oxlint/plugins";
|
|
264
469
|
|
|
265
470
|
// vendor/anti-slop/src/shared/lexical-type-parameters.ts
|
|
266
471
|
function isNode(value) {
|
|
@@ -663,9 +868,9 @@ function classifyWideningTarget(type, environment) {
|
|
|
663
868
|
if (alias === null)
|
|
664
869
|
return null;
|
|
665
870
|
if ((alias.typeParameters?.params.length ?? 0) > 0) {
|
|
666
|
-
const
|
|
667
|
-
const
|
|
668
|
-
return
|
|
871
|
+
const substitutions = aliasSubstitution(alias, unwrapped, new Map);
|
|
872
|
+
const resolved = substitutions === null ? null : classifyAliasBroadTarget(alias.typeAnnotation, environment, substitutions, new Set([name]));
|
|
873
|
+
return resolved?.kind === "open dictionary" ? { kind: "generic container" } : null;
|
|
669
874
|
}
|
|
670
875
|
const substitutions = aliasSubstitution(alias, unwrapped, new Map);
|
|
671
876
|
if (substitutions === null)
|
|
@@ -959,7 +1164,7 @@ function isDictionaryAccumulatorTarget(destination) {
|
|
|
959
1164
|
function hasParentAssertion(node) {
|
|
960
1165
|
return node.parent?.type === "TSAsExpression" || node.parent?.type === "TSTypeAssertion";
|
|
961
1166
|
}
|
|
962
|
-
var noKnownValueWideningRule =
|
|
1167
|
+
var noKnownValueWideningRule = defineRule7({
|
|
963
1168
|
meta: {
|
|
964
1169
|
type: "problem",
|
|
965
1170
|
docs: {
|
|
@@ -1072,7 +1277,7 @@ var noKnownValueWideningRule = defineRule5({
|
|
|
1072
1277
|
});
|
|
1073
1278
|
|
|
1074
1279
|
// vendor/anti-slop/src/rules/no-module-mocking.ts
|
|
1075
|
-
import { defineRule as
|
|
1280
|
+
import { defineRule as defineRule8 } from "@oxlint/plugins";
|
|
1076
1281
|
var moduleMockMethods = new Set(["doMock", "mock", "unstable_mockModule"]);
|
|
1077
1282
|
function resolveVariable3(sourceCode, identifier) {
|
|
1078
1283
|
let scope = sourceCode.getScope(identifier);
|
|
@@ -1117,7 +1322,7 @@ function moduleMockCall(sourceCode, callee) {
|
|
|
1117
1322
|
const method = callee.computed ? property.type === "Literal" && (property.value === "doMock" || property.value === "mock" || property.value === "unstable_mockModule") ? property.value : null : property.type === "Identifier" ? property.name : null;
|
|
1118
1323
|
return method !== null && moduleMockMethods.has(method);
|
|
1119
1324
|
}
|
|
1120
|
-
var noModuleMockingRule =
|
|
1325
|
+
var noModuleMockingRule = defineRule8({
|
|
1121
1326
|
meta: {
|
|
1122
1327
|
type: "problem",
|
|
1123
1328
|
docs: {
|
|
@@ -1141,8 +1346,8 @@ var noModuleMockingRule = defineRule6({
|
|
|
1141
1346
|
});
|
|
1142
1347
|
|
|
1143
1348
|
// vendor/anti-slop/src/rules/no-object-parameters.ts
|
|
1144
|
-
import { defineRule as
|
|
1145
|
-
var noObjectParametersRule =
|
|
1349
|
+
import { defineRule as defineRule9 } from "@oxlint/plugins";
|
|
1350
|
+
var noObjectParametersRule = defineRule9({
|
|
1146
1351
|
meta: {
|
|
1147
1352
|
type: "problem",
|
|
1148
1353
|
docs: {
|
|
@@ -1195,7 +1400,7 @@ var noObjectParametersRule = defineRule7({
|
|
|
1195
1400
|
});
|
|
1196
1401
|
|
|
1197
1402
|
// vendor/anti-slop/src/rules/no-reflect-apply.ts
|
|
1198
|
-
import { defineRule as
|
|
1403
|
+
import { defineRule as defineRule10 } from "@oxlint/plugins";
|
|
1199
1404
|
|
|
1200
1405
|
// vendor/anti-slop/src/shared/reflect-method.ts
|
|
1201
1406
|
function resolveVariable4(sourceCode, identifier) {
|
|
@@ -1226,7 +1431,7 @@ function isGlobalReflectMethodCall(sourceCode, callee, methodName) {
|
|
|
1226
1431
|
}
|
|
1227
1432
|
|
|
1228
1433
|
// vendor/anti-slop/src/rules/no-reflect-apply.ts
|
|
1229
|
-
var noReflectApplyRule =
|
|
1434
|
+
var noReflectApplyRule = defineRule10({
|
|
1230
1435
|
meta: {
|
|
1231
1436
|
type: "problem",
|
|
1232
1437
|
docs: {
|
|
@@ -1250,8 +1455,8 @@ var noReflectApplyRule = defineRule8({
|
|
|
1250
1455
|
});
|
|
1251
1456
|
|
|
1252
1457
|
// vendor/anti-slop/src/rules/no-reflect-get.ts
|
|
1253
|
-
import { defineRule as
|
|
1254
|
-
var noReflectGetRule =
|
|
1458
|
+
import { defineRule as defineRule11 } from "@oxlint/plugins";
|
|
1459
|
+
var noReflectGetRule = defineRule11({
|
|
1255
1460
|
meta: {
|
|
1256
1461
|
type: "problem",
|
|
1257
1462
|
docs: {
|
|
@@ -1275,7 +1480,7 @@ var noReflectGetRule = defineRule9({
|
|
|
1275
1480
|
});
|
|
1276
1481
|
|
|
1277
1482
|
// vendor/anti-slop/src/rules/no-runtime-typeof.ts
|
|
1278
|
-
import { defineRule as
|
|
1483
|
+
import { defineRule as defineRule12 } from "@oxlint/plugins";
|
|
1279
1484
|
function isRuntimeFunction(node) {
|
|
1280
1485
|
return node.type === "ArrowFunctionExpression" || node.type === "FunctionDeclaration" || node.type === "FunctionExpression";
|
|
1281
1486
|
}
|
|
@@ -1298,7 +1503,7 @@ function isExistenceProbe(node) {
|
|
|
1298
1503
|
const other = parent.left === node ? parent.right : parent.left;
|
|
1299
1504
|
return other.type === "Literal" && other.value === "undefined";
|
|
1300
1505
|
}
|
|
1301
|
-
var noRuntimeTypeofRule =
|
|
1506
|
+
var noRuntimeTypeofRule = defineRule12({
|
|
1302
1507
|
meta: {
|
|
1303
1508
|
type: "problem",
|
|
1304
1509
|
docs: {
|
|
@@ -1332,7 +1537,7 @@ var noRuntimeTypeofRule = defineRule10({
|
|
|
1332
1537
|
});
|
|
1333
1538
|
|
|
1334
1539
|
// vendor/anti-slop/src/rules/no-shape-in-symbol-names.ts
|
|
1335
|
-
import { defineRule as
|
|
1540
|
+
import { defineRule as defineRule13 } from "@oxlint/plugins";
|
|
1336
1541
|
var FORBIDDEN_SYMBOL_NAME = "shape";
|
|
1337
1542
|
function containsForbiddenSymbolName(name) {
|
|
1338
1543
|
return name.toLowerCase().includes(FORBIDDEN_SYMBOL_NAME);
|
|
@@ -1343,7 +1548,7 @@ function isBorrowedMemberName(node) {
|
|
|
1343
1548
|
return false;
|
|
1344
1549
|
return parent.property === node && parent.computed === false;
|
|
1345
1550
|
}
|
|
1346
|
-
var noForbiddenTermInSymbolNamesRule =
|
|
1551
|
+
var noForbiddenTermInSymbolNamesRule = defineRule13({
|
|
1347
1552
|
meta: {
|
|
1348
1553
|
type: "problem",
|
|
1349
1554
|
docs: {
|
|
@@ -1372,12 +1577,12 @@ var noForbiddenTermInSymbolNamesRule = defineRule11({
|
|
|
1372
1577
|
});
|
|
1373
1578
|
|
|
1374
1579
|
// vendor/anti-slop/src/rules/no-unknown-parameters.ts
|
|
1375
|
-
import { defineRule as
|
|
1580
|
+
import { defineRule as defineRule14 } from "@oxlint/plugins";
|
|
1376
1581
|
function isTypePredicateSubject(owner, parameterName) {
|
|
1377
1582
|
const predicate = owner.returnType?.typeAnnotation;
|
|
1378
1583
|
return predicate?.type === "TSTypePredicate" && predicate.parameterName.type === "Identifier" && predicate.parameterName.name === parameterName;
|
|
1379
1584
|
}
|
|
1380
|
-
var noUnknownParametersRule =
|
|
1585
|
+
var noUnknownParametersRule = defineRule14({
|
|
1381
1586
|
meta: {
|
|
1382
1587
|
type: "problem",
|
|
1383
1588
|
docs: {
|
|
@@ -1421,8 +1626,8 @@ var noUnknownParametersRule = defineRule12({
|
|
|
1421
1626
|
});
|
|
1422
1627
|
|
|
1423
1628
|
// vendor/anti-slop/src/rules/no-unknown-returns.ts
|
|
1424
|
-
import { defineRule as
|
|
1425
|
-
var noUnknownReturnsRule =
|
|
1629
|
+
import { defineRule as defineRule15 } from "@oxlint/plugins";
|
|
1630
|
+
var noUnknownReturnsRule = defineRule15({
|
|
1426
1631
|
meta: {
|
|
1427
1632
|
type: "problem",
|
|
1428
1633
|
docs: {
|
|
@@ -1475,8 +1680,8 @@ var noUnknownReturnsRule = defineRule13({
|
|
|
1475
1680
|
});
|
|
1476
1681
|
|
|
1477
1682
|
// vendor/anti-slop/src/rules/no-unknown-type-aliases.ts
|
|
1478
|
-
import { defineRule as
|
|
1479
|
-
var noUnknownTypeAliasesRule =
|
|
1683
|
+
import { defineRule as defineRule16 } from "@oxlint/plugins";
|
|
1684
|
+
var noUnknownTypeAliasesRule = defineRule16({
|
|
1480
1685
|
meta: {
|
|
1481
1686
|
type: "problem",
|
|
1482
1687
|
docs: {
|
|
@@ -1514,7 +1719,7 @@ var noUnknownTypeAliasesRule = defineRule14({
|
|
|
1514
1719
|
});
|
|
1515
1720
|
|
|
1516
1721
|
// vendor/anti-slop/src/rules/no-unsafe-dictionary-type.ts
|
|
1517
|
-
import { defineRule as
|
|
1722
|
+
import { defineRule as defineRule17 } from "@oxlint/plugins";
|
|
1518
1723
|
var typeNodeKinds = new Set([
|
|
1519
1724
|
"JSDocNonNullableType",
|
|
1520
1725
|
"JSDocNullableType",
|
|
@@ -1601,7 +1806,7 @@ function shouldReportType(node, environment) {
|
|
|
1601
1806
|
}
|
|
1602
1807
|
return true;
|
|
1603
1808
|
}
|
|
1604
|
-
var noUnsafeDictionaryTypeRule =
|
|
1809
|
+
var noUnsafeDictionaryTypeRule = defineRule17({
|
|
1605
1810
|
meta: {
|
|
1606
1811
|
type: "problem",
|
|
1607
1812
|
docs: {
|
|
@@ -1643,7 +1848,7 @@ var noUnsafeDictionaryTypeRule = defineRule15({
|
|
|
1643
1848
|
});
|
|
1644
1849
|
|
|
1645
1850
|
// vendor/anti-slop/src/rules/no-widen-then-assert.ts
|
|
1646
|
-
import { defineRule as
|
|
1851
|
+
import { defineRule as defineRule18 } from "@oxlint/plugins";
|
|
1647
1852
|
var functionBoundaryTypes = new Set([
|
|
1648
1853
|
"ArrowFunctionExpression",
|
|
1649
1854
|
"FunctionDeclaration",
|
|
@@ -1839,7 +2044,7 @@ function assertionIsNarrower(sourceText, broadKind, evidence, assertedType) {
|
|
|
1839
2044
|
return isDefinitelyObjectType(assertedType);
|
|
1840
2045
|
return isDefinitelyNarrowerRecordType(assertedType);
|
|
1841
2046
|
}
|
|
1842
|
-
var noWidenThenAssertRule =
|
|
2047
|
+
var noWidenThenAssertRule = defineRule18({
|
|
1843
2048
|
meta: {
|
|
1844
2049
|
type: "problem",
|
|
1845
2050
|
docs: {
|
|
@@ -1879,7 +2084,7 @@ var noWidenThenAssertRule = defineRule16({
|
|
|
1879
2084
|
});
|
|
1880
2085
|
|
|
1881
2086
|
// vendor/anti-slop/src/rules/require-safety-comment-for-type-assertion.ts
|
|
1882
|
-
import { defineRule as
|
|
2087
|
+
import { defineRule as defineRule19 } from "@oxlint/plugins";
|
|
1883
2088
|
var DEFAULT_SAFETY_MARKERS = ["SAFETY"];
|
|
1884
2089
|
var commentOwnerKinds = new Set([
|
|
1885
2090
|
"ExpressionStatement",
|
|
@@ -1922,7 +2127,7 @@ function hasSafetyComment(sourceCode, node, pattern) {
|
|
|
1922
2127
|
current = current.parent;
|
|
1923
2128
|
}
|
|
1924
2129
|
}
|
|
1925
|
-
var requireSafetyCommentForTypeAssertionRule =
|
|
2130
|
+
var requireSafetyCommentForTypeAssertionRule = defineRule19({
|
|
1926
2131
|
meta: {
|
|
1927
2132
|
type: "problem",
|
|
1928
2133
|
docs: {
|
|
@@ -1975,6 +2180,8 @@ var requireSafetyCommentForTypeAssertionRule = defineRule17({
|
|
|
1975
2180
|
var antiSlopPlugin = eslintCompatPlugin3({
|
|
1976
2181
|
meta: { name: "anti-slop" },
|
|
1977
2182
|
rules: {
|
|
2183
|
+
"no-array-filter-map": noArrayFilterMapRule,
|
|
2184
|
+
"no-reduce-accumulator-copy": noReduceAccumulatorCopyRule,
|
|
1978
2185
|
"no-chained-type-assertions": noChainedTypeAssertionsRule,
|
|
1979
2186
|
"no-conditional-empty-object-spread": noConditionalEmptyObjectSpreadRule,
|
|
1980
2187
|
"no-known-value-widening": noKnownValueWideningRule,
|
|
@@ -1997,7 +2204,7 @@ var src_default = antiSlopPlugin;
|
|
|
1997
2204
|
import { eslintCompatPlugin as eslintCompatPlugin4 } from "@oxlint/plugins";
|
|
1998
2205
|
|
|
1999
2206
|
// src/generic/rules/prefer-event-parameter-type.ts
|
|
2000
|
-
import { defineRule as
|
|
2207
|
+
import { defineRule as defineRule20 } from "@oxlint/plugins";
|
|
2001
2208
|
function nearestEnclosingFunction2(node) {
|
|
2002
2209
|
let current = node.parent;
|
|
2003
2210
|
while (current) {
|
|
@@ -2024,7 +2231,7 @@ function assertedEventParameter(node) {
|
|
|
2024
2231
|
property
|
|
2025
2232
|
};
|
|
2026
2233
|
}
|
|
2027
|
-
var preferEventParameterTypeRule =
|
|
2234
|
+
var preferEventParameterTypeRule = defineRule20({
|
|
2028
2235
|
meta: {
|
|
2029
2236
|
type: "suggestion",
|
|
2030
2237
|
docs: {
|
|
@@ -2061,16 +2268,6 @@ var timmoPlugin = eslintCompatPlugin4({
|
|
|
2061
2268
|
});
|
|
2062
2269
|
var generic_default = timmoPlugin;
|
|
2063
2270
|
|
|
2064
|
-
// node_modules/oxlint/dist/index.js
|
|
2065
|
-
function defineConfig(config) {
|
|
2066
|
-
return config;
|
|
2067
|
-
}
|
|
2068
|
-
|
|
2069
|
-
// src/configs/enable-plugin-rules.ts
|
|
2070
|
-
function enablePluginRules(namespace, plugin) {
|
|
2071
|
-
return Object.fromEntries(Object.keys(plugin.rules).sort().map((rule) => [`${namespace}/${rule}`, "error"]));
|
|
2072
|
-
}
|
|
2073
|
-
|
|
2074
2271
|
// src/configs/recommended.ts
|
|
2075
2272
|
var recommended = defineConfig({
|
|
2076
2273
|
jsPlugins: [
|
|
@@ -2087,8 +2284,8 @@ var recommended = defineConfig({
|
|
|
2087
2284
|
});
|
|
2088
2285
|
var recommended_default = recommended;
|
|
2089
2286
|
|
|
2090
|
-
// src/configs/effect.ts
|
|
2091
|
-
var
|
|
2287
|
+
// src/configs/recommended-effect.ts
|
|
2288
|
+
var recommendedEffect = defineConfig({
|
|
2092
2289
|
extends: [recommended_default],
|
|
2093
2290
|
jsPlugins: [
|
|
2094
2291
|
{
|
|
@@ -2102,7 +2299,7 @@ var effect = defineConfig({
|
|
|
2102
2299
|
...enablePluginRules("timmo-effect", effect_default)
|
|
2103
2300
|
}
|
|
2104
2301
|
});
|
|
2105
|
-
var
|
|
2302
|
+
var recommended_effect_default = recommendedEffect;
|
|
2106
2303
|
export {
|
|
2107
|
-
|
|
2304
|
+
recommended_effect_default as default
|
|
2108
2305
|
};
|