@utilfirst/eslint-plugin 0.4.0 → 0.4.2
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/index.js +1 -1
- package/dist/oxlint.js +1 -1
- package/dist/{src-BcVIwgzD.js → src-DdudPvOQ.js} +17 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
package/dist/oxlint.js
CHANGED
|
@@ -3,7 +3,7 @@ import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
//#region package.json
|
|
6
|
-
var version = "0.4.
|
|
6
|
+
var version = "0.4.2";
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/rules/consistent-blank-lines.ts
|
|
@@ -2620,6 +2620,11 @@ function parameterName(parameter, sourceText) {
|
|
|
2620
2620
|
if (parameter.type === "RestElement") return parameterName(parameter.argument, sourceText);
|
|
2621
2621
|
return parameter.type === "Identifier" ? parameter.name : sourceText.replace(/\s*:\s*unknown\s*$/u, "");
|
|
2622
2622
|
}
|
|
2623
|
+
function isPromiseCatchCallback(node) {
|
|
2624
|
+
if (node.type !== "ArrowFunctionExpression" && node.type !== "FunctionExpression") return false;
|
|
2625
|
+
const call = node.parent;
|
|
2626
|
+
return call.type === "CallExpression" && call.arguments[0] === node && call.callee.type === "MemberExpression" && !call.callee.computed && call.callee.property.type === "Identifier" && call.callee.property.name === "catch";
|
|
2627
|
+
}
|
|
2623
2628
|
/** Keep unknown inputs at explicit decoding and error-enrichment boundaries. */
|
|
2624
2629
|
const noUnknownParametersRule = defineRule({
|
|
2625
2630
|
meta: {
|
|
@@ -2642,6 +2647,7 @@ const noUnknownParametersRule = defineRule({
|
|
|
2642
2647
|
},
|
|
2643
2648
|
createOnce(context) {
|
|
2644
2649
|
const checkParameters = (node) => {
|
|
2650
|
+
if (isPromiseCatchCallback(node)) return;
|
|
2645
2651
|
const parsedOptions = ContextOptionsSchema$1.safeParse(context.options);
|
|
2646
2652
|
const options = parsedOptions.success ? parsedOptions.data : void 0;
|
|
2647
2653
|
for (const parameter of node.params) {
|
|
@@ -3426,6 +3432,15 @@ const preferOptionsParameterRule = defineRule({
|
|
|
3426
3432
|
|
|
3427
3433
|
//#endregion
|
|
3428
3434
|
//#region src/rules/prefer-react-props-reference.ts
|
|
3435
|
+
const HTTP_METHOD_EXPORT_NAMES = new Set([
|
|
3436
|
+
"DELETE",
|
|
3437
|
+
"GET",
|
|
3438
|
+
"HEAD",
|
|
3439
|
+
"OPTIONS",
|
|
3440
|
+
"PATCH",
|
|
3441
|
+
"POST",
|
|
3442
|
+
"PUT"
|
|
3443
|
+
]);
|
|
3429
3444
|
function componentNameOf(node) {
|
|
3430
3445
|
if (node.type !== "ArrowFunctionExpression") return node.id?.name ?? null;
|
|
3431
3446
|
if (node.parent.type === "VariableDeclarator" && node.parent.id.type === "Identifier") return node.parent.id.name;
|
|
@@ -3433,7 +3448,7 @@ function componentNameOf(node) {
|
|
|
3433
3448
|
}
|
|
3434
3449
|
function isComponent(node) {
|
|
3435
3450
|
const name = componentNameOf(node);
|
|
3436
|
-
return name !== null && /^\p{Lu}/u.test(name);
|
|
3451
|
+
return name !== null && !HTTP_METHOD_EXPORT_NAMES.has(name) && /^\p{Lu}/u.test(name);
|
|
3437
3452
|
}
|
|
3438
3453
|
function propertyNameOf(key) {
|
|
3439
3454
|
if (key.type === "Identifier") return key.name;
|