@sarj/eslint-plugin 19.4.0 → 19.8.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/catalog.js +268 -6
- package/dist/{chunk-6RX5RU75.js → chunk-G5BIV4A4.js} +527 -172
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -21504,8 +21504,30 @@ var NAME91 = "prefer-coded-error-result";
|
|
|
21504
21504
|
var MAX_DEPTH = 16;
|
|
21505
21505
|
var MAX_VARIANTS = 64;
|
|
21506
21506
|
var MAX_TYPE_STEPS = 256;
|
|
21507
|
-
var
|
|
21507
|
+
var BOOLEAN_STATUS_NAMES = ["ok", "success"];
|
|
21508
|
+
var STRING_STATUS_NAMES = ["status", "state", "kind", "type", "tag"];
|
|
21509
|
+
var STATUS_NAMES = [
|
|
21510
|
+
...BOOLEAN_STATUS_NAMES,
|
|
21511
|
+
...STRING_STATUS_NAMES
|
|
21512
|
+
];
|
|
21508
21513
|
var CODE_NAMES = ["code", "kind", "type", "tag"];
|
|
21514
|
+
var SUCCESS_TAGS = /* @__PURE__ */ new Set(["ok", "success"]);
|
|
21515
|
+
var FAILURE_TAGS = /* @__PURE__ */ new Set([
|
|
21516
|
+
"err",
|
|
21517
|
+
"error",
|
|
21518
|
+
"failure",
|
|
21519
|
+
"failed"
|
|
21520
|
+
]);
|
|
21521
|
+
var NATIVE_ERRORS = /* @__PURE__ */ new Set([
|
|
21522
|
+
"Error",
|
|
21523
|
+
"EvalError",
|
|
21524
|
+
"RangeError",
|
|
21525
|
+
"ReferenceError",
|
|
21526
|
+
"SyntaxError",
|
|
21527
|
+
"TypeError",
|
|
21528
|
+
"URIError",
|
|
21529
|
+
"AggregateError"
|
|
21530
|
+
]);
|
|
21509
21531
|
function view(node) {
|
|
21510
21532
|
return { node, origin: node, bindings: /* @__PURE__ */ new Map() };
|
|
21511
21533
|
}
|
|
@@ -21515,7 +21537,7 @@ function resolve2(value, source, depth = 0) {
|
|
|
21515
21537
|
if (node.type !== "TSTypeReference") return value;
|
|
21516
21538
|
if (node.typeName.type !== "Identifier") return null;
|
|
21517
21539
|
const variable = typeBinding(source, node.typeName);
|
|
21518
|
-
if (variable === null) return
|
|
21540
|
+
if (variable === null || variable.defs.length === 0) return value;
|
|
21519
21541
|
const bound = value.bindings.get(variable);
|
|
21520
21542
|
if (bound !== void 0) return resolve2(bound, source, depth + 1);
|
|
21521
21543
|
const declaration = variable.defs.length === 1 ? variable.defs[0]?.node : void 0;
|
|
@@ -21577,30 +21599,40 @@ function propertyView(property, owner) {
|
|
|
21577
21599
|
const node = property.typeAnnotation?.typeAnnotation;
|
|
21578
21600
|
return node === void 0 ? null : { node, origin: node, bindings: owner.bindings };
|
|
21579
21601
|
}
|
|
21580
|
-
function
|
|
21602
|
+
function outcomeTag(property, owner, source, name) {
|
|
21581
21603
|
if (property === void 0 || property.optional) return null;
|
|
21582
21604
|
const type = propertyView(property, owner);
|
|
21583
21605
|
const resolved = type === null ? null : resolve2(type, source);
|
|
21584
21606
|
const node = resolved?.node;
|
|
21585
|
-
return node?.type === "TSLiteralType" && node.literal.type === "Literal"
|
|
21607
|
+
return node?.type === "TSLiteralType" && node.literal.type === "Literal" ? outcomeValue(name, node.literal.value) : null;
|
|
21608
|
+
}
|
|
21609
|
+
function outcomeValue(name, value) {
|
|
21610
|
+
if (BOOLEAN_STATUS_NAMES.some((candidate2) => candidate2 === name))
|
|
21611
|
+
return typeof value === "boolean" ? value : null;
|
|
21612
|
+
if (!STRING_STATUS_NAMES.some((candidate2) => candidate2 === name) || typeof value !== "string")
|
|
21613
|
+
return null;
|
|
21614
|
+
const tag = value.toLowerCase();
|
|
21615
|
+
return SUCCESS_TAGS.has(tag) ? true : FAILURE_TAGS.has(tag) ? false : null;
|
|
21586
21616
|
}
|
|
21587
|
-
function hasCode(fields2, owner, source) {
|
|
21617
|
+
function hasCode(fields2, owner, source, ignoredCodes = []) {
|
|
21588
21618
|
return CODE_NAMES.some((name) => {
|
|
21619
|
+
if (ignoredCodes.includes(name)) return false;
|
|
21589
21620
|
const property = fields2.get(name);
|
|
21590
21621
|
if (property === void 0 || property.optional) return false;
|
|
21591
21622
|
const type = propertyView(property, owner);
|
|
21592
|
-
return type !== null &&
|
|
21623
|
+
return type !== null && openScalar(type, source) === null;
|
|
21593
21624
|
});
|
|
21594
21625
|
}
|
|
21595
|
-
function
|
|
21626
|
+
function openScalar(value, source, depth = 0, budget = { remaining: MAX_TYPE_STEPS }) {
|
|
21596
21627
|
if (depth >= MAX_DEPTH || --budget.remaining < 0) return null;
|
|
21597
21628
|
const resolved = resolve2(value, source);
|
|
21598
21629
|
if (resolved === null) return null;
|
|
21599
|
-
if (resolved.node.type === "TSStringKeyword"
|
|
21630
|
+
if (resolved.node.type === "TSStringKeyword" || resolved.node.type === "TSUnknownKeyword")
|
|
21631
|
+
return resolved.origin;
|
|
21600
21632
|
if (resolved.node.type !== "TSUnionType" || resolved.node.types.length > MAX_VARIANTS)
|
|
21601
21633
|
return null;
|
|
21602
21634
|
for (const member3 of resolved.node.types) {
|
|
21603
|
-
const broad =
|
|
21635
|
+
const broad = openScalar(
|
|
21604
21636
|
{ ...resolved, node: member3 },
|
|
21605
21637
|
source,
|
|
21606
21638
|
depth + 1,
|
|
@@ -21614,7 +21646,9 @@ function weakError(value, source, depth = 0, budget = { remaining: MAX_TYPE_STEP
|
|
|
21614
21646
|
if (depth >= MAX_DEPTH || --budget.remaining < 0) return null;
|
|
21615
21647
|
const resolved = resolve2(value, source);
|
|
21616
21648
|
if (resolved === null) return null;
|
|
21617
|
-
if (resolved.node.type === "TSStringKeyword"
|
|
21649
|
+
if (resolved.node.type === "TSStringKeyword" || resolved.node.type === "TSUnknownKeyword")
|
|
21650
|
+
return resolved.origin;
|
|
21651
|
+
if (nativeErrorType(resolved.node, source)) return resolved.origin;
|
|
21618
21652
|
if (resolved.node.type === "TSUnionType") {
|
|
21619
21653
|
if (resolved.node.types.length > MAX_VARIANTS) return null;
|
|
21620
21654
|
for (const member3 of resolved.node.types) {
|
|
@@ -21632,22 +21666,44 @@ function weakError(value, source, depth = 0, budget = { remaining: MAX_TYPE_STEP
|
|
|
21632
21666
|
if (fields2 === null || hasCode(fields2, resolved, source)) return null;
|
|
21633
21667
|
return weakObject(fields2, resolved, source, depth, budget);
|
|
21634
21668
|
}
|
|
21635
|
-
function
|
|
21636
|
-
|
|
21669
|
+
function nativeErrorType(node, source) {
|
|
21670
|
+
if (node.type !== "TSTypeReference" || node.typeName.type !== "Identifier" || !NATIVE_ERRORS.has(node.typeName.name) || (node.typeArguments?.params.length ?? 0) !== 0)
|
|
21671
|
+
return false;
|
|
21672
|
+
const binding3 = typeBinding(source, node.typeName);
|
|
21673
|
+
return binding3 === null || binding3.defs.length === 0;
|
|
21674
|
+
}
|
|
21675
|
+
function weakObject(fields2, owner, source, depth, budget, ignoredCodes = []) {
|
|
21676
|
+
const code = openStringField(
|
|
21677
|
+
fields2,
|
|
21678
|
+
owner,
|
|
21679
|
+
source,
|
|
21680
|
+
CODE_NAMES.filter((name) => !ignoredCodes.includes(name)),
|
|
21681
|
+
budget
|
|
21682
|
+
);
|
|
21637
21683
|
if (code !== null) return code;
|
|
21638
21684
|
const error = fields2.get("error");
|
|
21639
21685
|
if (error !== void 0) {
|
|
21640
21686
|
const inner = propertyView(error, owner);
|
|
21641
21687
|
return inner === null || error.optional ? null : weakError(inner, source, depth + 1, budget);
|
|
21642
21688
|
}
|
|
21689
|
+
const carriers = [...fields2].filter(([name]) => errorCarrier(name));
|
|
21690
|
+
if (carriers.length > 1) return null;
|
|
21691
|
+
const carrier = carriers[0]?.[1];
|
|
21692
|
+
if (carrier !== void 0) {
|
|
21693
|
+
const inner = propertyView(carrier, owner);
|
|
21694
|
+
return inner === null || carrier.optional ? null : weakError(inner, source, depth + 1, budget);
|
|
21695
|
+
}
|
|
21643
21696
|
return openStringField(fields2, owner, source, ["message", "reason"], budget);
|
|
21644
21697
|
}
|
|
21698
|
+
function errorCarrier(name) {
|
|
21699
|
+
return name === "error" || name === "errorMessage" || name.endsWith("Error");
|
|
21700
|
+
}
|
|
21645
21701
|
function openStringField(fields2, owner, source, names, budget) {
|
|
21646
21702
|
for (const name of names) {
|
|
21647
21703
|
const property = fields2.get(name);
|
|
21648
21704
|
if (property === void 0 || property.optional) continue;
|
|
21649
21705
|
const inner = propertyView(property, owner);
|
|
21650
|
-
const broad = inner === null ? null :
|
|
21706
|
+
const broad = inner === null ? null : openScalar(inner, source, 0, budget);
|
|
21651
21707
|
if (broad !== null) return broad;
|
|
21652
21708
|
}
|
|
21653
21709
|
return null;
|
|
@@ -21660,26 +21716,70 @@ function failureMessages(value, source) {
|
|
|
21660
21716
|
fields: properties(member3)
|
|
21661
21717
|
}));
|
|
21662
21718
|
if (objects.some((object) => object.fields === null)) return [];
|
|
21719
|
+
let selected = null;
|
|
21720
|
+
const discriminators = [];
|
|
21663
21721
|
for (const status of STATUS_NAMES) {
|
|
21664
|
-
const
|
|
21665
|
-
(object) =>
|
|
21722
|
+
const tags2 = objects.map(
|
|
21723
|
+
(object) => outcomeTag(object.fields?.get(status), object.member, source, status)
|
|
21666
21724
|
);
|
|
21667
|
-
if (
|
|
21725
|
+
if (tags2.some((tag) => tag === null) || !tags2.includes(true) || !tags2.includes(false))
|
|
21668
21726
|
continue;
|
|
21669
|
-
if (
|
|
21670
|
-
|
|
21671
|
-
)
|
|
21672
|
-
|
|
21673
|
-
|
|
21674
|
-
|
|
21675
|
-
return [];
|
|
21676
|
-
if (["data", "value", "result"].some((name) => object.fields?.has(name)))
|
|
21677
|
-
return [];
|
|
21678
|
-
const error = weakError(object.member, source);
|
|
21679
|
-
return error === null ? [] : [error];
|
|
21680
|
-
});
|
|
21727
|
+
if (selected !== null && tags2.some((tag, index) => tag !== selected?.[index]))
|
|
21728
|
+
return [];
|
|
21729
|
+
discriminators.push(status);
|
|
21730
|
+
if (selected === null) {
|
|
21731
|
+
selected = tags2;
|
|
21732
|
+
}
|
|
21681
21733
|
}
|
|
21682
|
-
return
|
|
21734
|
+
if (selected === null) return presenceFailures(objects, source);
|
|
21735
|
+
const tags = selected;
|
|
21736
|
+
if (objects.some(
|
|
21737
|
+
(object, index) => tags[index] === true && [...object.fields?.keys() ?? []].some(
|
|
21738
|
+
(name) => name === "errors" || errorCarrier(name)
|
|
21739
|
+
)
|
|
21740
|
+
))
|
|
21741
|
+
return [];
|
|
21742
|
+
return objects.flatMap((object, index) => {
|
|
21743
|
+
if (tags[index] !== false || object.fields === null || hasCode(object.fields, object.member, source, discriminators) || ["data", "value", "result"].some((name) => object.fields?.has(name)))
|
|
21744
|
+
return [];
|
|
21745
|
+
const error = weakObject(
|
|
21746
|
+
object.fields,
|
|
21747
|
+
object.member,
|
|
21748
|
+
source,
|
|
21749
|
+
0,
|
|
21750
|
+
{ remaining: MAX_TYPE_STEPS },
|
|
21751
|
+
discriminators
|
|
21752
|
+
);
|
|
21753
|
+
return error === null ? [] : [error];
|
|
21754
|
+
});
|
|
21755
|
+
}
|
|
21756
|
+
function presenceFailures(objects, source) {
|
|
21757
|
+
const failed2 = objects.filter((object) => object.fields?.has("error"));
|
|
21758
|
+
const successful = objects.filter((object) => !object.fields?.has("error"));
|
|
21759
|
+
if (failed2.length === 0 || successful.length === 0) return [];
|
|
21760
|
+
let successKey = null;
|
|
21761
|
+
for (const object of successful) {
|
|
21762
|
+
if (object.fields === null || object.fields.size !== 1) return [];
|
|
21763
|
+
const property = [...object.fields][0];
|
|
21764
|
+
if (property === void 0 || property[1].optional || errorCarrier(property[0]) || property[0] === "errors" || STATUS_NAMES.includes(property[0]) || CODE_NAMES.some((name) => name === property[0]))
|
|
21765
|
+
return [];
|
|
21766
|
+
if (successKey !== null && successKey !== property[0]) return [];
|
|
21767
|
+
successKey = property[0];
|
|
21768
|
+
}
|
|
21769
|
+
if (successKey === null) return [];
|
|
21770
|
+
const key = successKey;
|
|
21771
|
+
if (failed2.some(
|
|
21772
|
+
(object) => object.fields?.get("error")?.optional || object.fields?.has(key)
|
|
21773
|
+
))
|
|
21774
|
+
return [];
|
|
21775
|
+
return failed2.flatMap((object) => {
|
|
21776
|
+
if (object.fields === null || hasCode(object.fields, object.member, source))
|
|
21777
|
+
return [];
|
|
21778
|
+
const error = object.fields.get("error");
|
|
21779
|
+
const inner = error === void 0 ? null : propertyView(error, object.member);
|
|
21780
|
+
const weak = inner === null ? null : weakError(inner, source);
|
|
21781
|
+
return weak === null ? [] : [weak];
|
|
21782
|
+
});
|
|
21683
21783
|
}
|
|
21684
21784
|
function variants(value, source, depth = 0, budget = { remaining: MAX_TYPE_STEPS }) {
|
|
21685
21785
|
if (--budget.remaining < 0) return null;
|
|
@@ -21701,18 +21801,37 @@ function variants(value, source, depth = 0, budget = { remaining: MAX_TYPE_STEPS
|
|
|
21701
21801
|
return result;
|
|
21702
21802
|
}
|
|
21703
21803
|
function libraryError(reference, source) {
|
|
21704
|
-
if (reference.
|
|
21804
|
+
if (reference.typeArguments?.params.length !== 2) return null;
|
|
21805
|
+
if (!["Result", "ResultAsync"].includes(
|
|
21806
|
+
libraryName(reference.typeName, source, true) ?? ""
|
|
21807
|
+
))
|
|
21705
21808
|
return null;
|
|
21706
|
-
const
|
|
21809
|
+
const error = reference.typeArguments.params[1];
|
|
21810
|
+
return error === void 0 ? null : weakError(view(error), source);
|
|
21811
|
+
}
|
|
21812
|
+
function libraryName(node, source, typeSpace) {
|
|
21813
|
+
const reference = libraryReference(node);
|
|
21814
|
+
if (reference === null) return null;
|
|
21815
|
+
const { root, member: member3 } = reference;
|
|
21816
|
+
const variable = typeSpace ? typeBinding(source, root) : findVariable(source.getScope(root), root.name);
|
|
21707
21817
|
const definition = variable?.defs.length === 1 ? variable.defs[0]?.node : void 0;
|
|
21708
|
-
if (definition?.type !== "ImportSpecifier"
|
|
21818
|
+
if (definition?.type !== "ImportSpecifier" && definition?.type !== "ImportNamespaceSpecifier")
|
|
21819
|
+
return null;
|
|
21820
|
+
if (variable === null || !stableValueBinding(variable)) return null;
|
|
21709
21821
|
const declaration = parentOf(definition);
|
|
21710
21822
|
if (declaration?.type !== "ImportDeclaration" || declaration.source.value !== "neverthrow")
|
|
21711
21823
|
return null;
|
|
21712
|
-
if (!
|
|
21824
|
+
if (!typeSpace && (declaration.importKind === "type" || definition.type === "ImportSpecifier" && definition.importKind === "type"))
|
|
21713
21825
|
return null;
|
|
21714
|
-
|
|
21715
|
-
|
|
21826
|
+
return member3 === null && definition.type === "ImportSpecifier" ? importSpecifierName(definition) : member3 !== null && definition.type === "ImportNamespaceSpecifier" ? member3 : null;
|
|
21827
|
+
}
|
|
21828
|
+
function libraryReference(node) {
|
|
21829
|
+
if (node.type === "Identifier") return { root: node, member: null };
|
|
21830
|
+
if (node.type === "TSQualifiedName" && node.left.type === "Identifier" && node.right.type === "Identifier")
|
|
21831
|
+
return { root: node.left, member: node.right.name };
|
|
21832
|
+
if (node.type === "MemberExpression" && !node.computed && !node.optional && node.object.type === "Identifier" && node.property.type === "Identifier")
|
|
21833
|
+
return { root: node.object, member: node.property.name };
|
|
21834
|
+
return null;
|
|
21716
21835
|
}
|
|
21717
21836
|
function weakAnnotation(node, source, depth = 0, budget = { remaining: MAX_TYPE_STEPS }) {
|
|
21718
21837
|
if (depth >= MAX_DEPTH || --budget.remaining < 0) return false;
|
|
@@ -21724,23 +21843,65 @@ function weakAnnotation(node, source, depth = 0, budget = { remaining: MAX_TYPE_
|
|
|
21724
21843
|
const argument = node.typeArguments.params[0];
|
|
21725
21844
|
return argument !== void 0 && weakAnnotation(argument, source, depth + 1, budget);
|
|
21726
21845
|
}
|
|
21727
|
-
function renderedFailure(node) {
|
|
21728
|
-
|
|
21729
|
-
if (
|
|
21846
|
+
function renderedFailure(node, source) {
|
|
21847
|
+
let value = unwrapExpression(node);
|
|
21848
|
+
if (value.type === "AwaitExpression")
|
|
21849
|
+
value = unwrapExpression(value.argument);
|
|
21850
|
+
if (value.type === "CallExpression" || value.type === "NewExpression") {
|
|
21851
|
+
if (value.type === "CallExpression" && value.optional || value.arguments.length !== 1)
|
|
21852
|
+
return null;
|
|
21853
|
+
const name = libraryName(value.callee, source, false);
|
|
21854
|
+
if (value.type === "NewExpression" ? name !== "Err" : name !== "err" && name !== "errAsync")
|
|
21855
|
+
return null;
|
|
21856
|
+
const argument = value.arguments[0];
|
|
21857
|
+
if (argument === void 0 || argument.type === "SpreadElement")
|
|
21858
|
+
return null;
|
|
21859
|
+
return renderedPayload(argument, source);
|
|
21860
|
+
}
|
|
21861
|
+
const outer = objectFields(value);
|
|
21862
|
+
if (outer === null) return null;
|
|
21863
|
+
const discriminators = STATUS_NAMES.filter((name) => {
|
|
21730
21864
|
const status = outer.get(name);
|
|
21731
|
-
return status?.type === "Literal" && status.value === false;
|
|
21732
|
-
})
|
|
21865
|
+
return status?.type === "Literal" && outcomeValue(name, status.value) === false;
|
|
21866
|
+
});
|
|
21867
|
+
if (discriminators.length === 0) return null;
|
|
21868
|
+
if (STATUS_NAMES.some((name) => {
|
|
21869
|
+
const status = outer.get(name);
|
|
21870
|
+
return status?.type === "Literal" && outcomeValue(name, status.value) === true;
|
|
21871
|
+
}) || ["data", "value", "result"].some((name) => outer.has(name)))
|
|
21733
21872
|
return null;
|
|
21734
21873
|
const error = outer.get("error");
|
|
21735
|
-
|
|
21736
|
-
|
|
21874
|
+
return renderedPayload(
|
|
21875
|
+
error ?? value,
|
|
21876
|
+
source,
|
|
21877
|
+
error === void 0 ? discriminators : []
|
|
21878
|
+
);
|
|
21879
|
+
}
|
|
21880
|
+
function renderedPayload(node, source, ignoredCodes = []) {
|
|
21881
|
+
if (renderedString(node, source))
|
|
21882
|
+
return { node, messageId: "preferCodedErrorResult" };
|
|
21883
|
+
const fields2 = objectFields(unwrapExpression(node));
|
|
21884
|
+
if (fields2 === null) return null;
|
|
21885
|
+
const codes = CODE_NAMES.filter(
|
|
21886
|
+
(name) => !ignoredCodes.includes(name) && fields2.has(name)
|
|
21887
|
+
);
|
|
21888
|
+
const coded = codes.some((name) => {
|
|
21737
21889
|
const code = fields2.get(name);
|
|
21738
21890
|
return code?.type === "Literal" && typeof code.value === "string";
|
|
21739
|
-
})
|
|
21740
|
-
|
|
21741
|
-
|
|
21742
|
-
|
|
21743
|
-
|
|
21891
|
+
});
|
|
21892
|
+
if (codes.length !== 0 && !coded) return null;
|
|
21893
|
+
const primary = fields2.get("error");
|
|
21894
|
+
const carriers = [...fields2].filter(([name]) => errorCarrier(name));
|
|
21895
|
+
if (primary === void 0 && carriers.length > 1) return null;
|
|
21896
|
+
const carrier = primary ?? carriers[0]?.[1];
|
|
21897
|
+
if (!coded && carrier !== void 0)
|
|
21898
|
+
return renderedString(carrier, source) ? { node: carrier, messageId: "preferCodedErrorResult" } : null;
|
|
21899
|
+
for (const [name, value] of fields2) {
|
|
21900
|
+
if ((name === "message" || name === "reason" || errorCarrier(name)) && renderedString(value, source))
|
|
21901
|
+
return {
|
|
21902
|
+
node: value,
|
|
21903
|
+
messageId: coded ? "formatAtConsumer" : "preferCodedErrorResult"
|
|
21904
|
+
};
|
|
21744
21905
|
}
|
|
21745
21906
|
return null;
|
|
21746
21907
|
}
|
|
@@ -21756,14 +21917,36 @@ function objectFields(node) {
|
|
|
21756
21917
|
}
|
|
21757
21918
|
return fields2;
|
|
21758
21919
|
}
|
|
21759
|
-
function renderedString(node,
|
|
21760
|
-
|
|
21761
|
-
|
|
21762
|
-
|
|
21763
|
-
|
|
21764
|
-
|
|
21765
|
-
|
|
21766
|
-
|
|
21920
|
+
function renderedString(node, source) {
|
|
21921
|
+
let remaining = MAX_TYPE_STEPS;
|
|
21922
|
+
function literalComposition(input, depth) {
|
|
21923
|
+
if (depth >= MAX_DEPTH || --remaining < 0) return null;
|
|
21924
|
+
const value = unwrapExpression(input);
|
|
21925
|
+
if (value.type === "Identifier") {
|
|
21926
|
+
const initializer = stableConstInitializer(source, value);
|
|
21927
|
+
return initializer === null ? false : literalComposition(initializer.value, depth + 1);
|
|
21928
|
+
}
|
|
21929
|
+
if (value.type === "Literal")
|
|
21930
|
+
return value.value === null || ["string", "number", "boolean", "bigint"].includes(typeof value.value);
|
|
21931
|
+
const children = value.type === "TemplateLiteral" ? value.expressions : value.type === "BinaryExpression" && value.operator === "+" ? [value.left, value.right] : null;
|
|
21932
|
+
if (children === null) return false;
|
|
21933
|
+
for (const child of children) {
|
|
21934
|
+
const constant = literalComposition(child, depth + 1);
|
|
21935
|
+
if (constant !== true) return constant;
|
|
21936
|
+
}
|
|
21937
|
+
return true;
|
|
21938
|
+
}
|
|
21939
|
+
function rendered(input, depth) {
|
|
21940
|
+
if (depth >= MAX_DEPTH || --remaining < 0) return false;
|
|
21941
|
+
const value = unwrapExpression(input);
|
|
21942
|
+
if (value.type === "TemplateLiteral") return value.expressions.length > 0;
|
|
21943
|
+
if (value.type !== "BinaryExpression" || value.operator !== "+")
|
|
21944
|
+
return false;
|
|
21945
|
+
return [value.left, value.right].some(
|
|
21946
|
+
(part) => part.type === "Literal" && typeof part.value === "string" || rendered(part, depth + 1)
|
|
21947
|
+
);
|
|
21948
|
+
}
|
|
21949
|
+
return literalComposition(node, 0) === false && rendered(node, 0);
|
|
21767
21950
|
}
|
|
21768
21951
|
var prefer_coded_error_result_default = defineRule({
|
|
21769
21952
|
meta: {
|
|
@@ -21774,7 +21957,7 @@ var prefer_coded_error_result_default = defineRule({
|
|
|
21774
21957
|
},
|
|
21775
21958
|
schema: [],
|
|
21776
21959
|
messages: {
|
|
21777
|
-
preferCodedErrorResult: "This Result failure
|
|
21960
|
+
preferCodedErrorResult: "This Result failure hides its identity in a broad string, unknown, or generic Error channel. Expose expected failures as finite domain error codes with the typed context needed by the caller, and format the message at the consumer. Review intentional infrastructure and presentation boundaries explicitly.",
|
|
21778
21961
|
formatAtConsumer: "This coded failure formats context into a message at the producer. Return the code and typed context, and let the consumer format the message. Preserve an intentional presentation boundary explicitly."
|
|
21779
21962
|
}
|
|
21780
21963
|
},
|
|
@@ -21794,13 +21977,13 @@ var prefer_coded_error_result_default = defineRule({
|
|
|
21794
21977
|
}
|
|
21795
21978
|
function checkProducer(owner, value) {
|
|
21796
21979
|
if (owner === null) return;
|
|
21797
|
-
const rendered = renderedFailure(value);
|
|
21798
|
-
if (rendered === null || reported.has(rendered)) return;
|
|
21980
|
+
const rendered = renderedFailure(value, context.sourceCode);
|
|
21981
|
+
if (rendered === null || reported.has(rendered.node)) return;
|
|
21799
21982
|
const contract = owner.returnType?.typeAnnotation;
|
|
21800
21983
|
if (contract !== void 0 && weakAnnotation(contract, context.sourceCode))
|
|
21801
21984
|
return;
|
|
21802
|
-
reported.add(rendered);
|
|
21803
|
-
context.report(
|
|
21985
|
+
reported.add(rendered.node);
|
|
21986
|
+
context.report(rendered);
|
|
21804
21987
|
}
|
|
21805
21988
|
return {
|
|
21806
21989
|
before() {
|
|
@@ -21825,8 +22008,179 @@ var prefer_coded_error_result_default = defineRule({
|
|
|
21825
22008
|
}
|
|
21826
22009
|
});
|
|
21827
22010
|
|
|
22011
|
+
// src/rules/prefer-configured-cloud-scope.ts
|
|
22012
|
+
var NAME92 = "prefer-configured-cloud-scope";
|
|
22013
|
+
var ACCOUNT_PREFIX = "https://api.cloudflare.com/client/v4/accounts/";
|
|
22014
|
+
var ACCOUNT_URL = /^https:\/\/api\.cloudflare\.com\/client\/v4\/accounts\/[a-fA-F\d]{32}(?=\/|[?#]|$)/u;
|
|
22015
|
+
var GLOBAL_RECEIVERS5 = /* @__PURE__ */ new Set(["globalThis", "global", "self", "window"]);
|
|
22016
|
+
var UNKNOWN = [{ text: "\0", source: null }];
|
|
22017
|
+
function accountSource(parts) {
|
|
22018
|
+
if (!ACCOUNT_URL.test(parts.map((part) => part.text).join(""))) return null;
|
|
22019
|
+
let offset = 0;
|
|
22020
|
+
for (const part of parts) {
|
|
22021
|
+
if (offset + part.text.length > ACCOUNT_PREFIX.length) return part.source;
|
|
22022
|
+
offset += part.text.length;
|
|
22023
|
+
}
|
|
22024
|
+
return null;
|
|
22025
|
+
}
|
|
22026
|
+
function boundedParts(parts) {
|
|
22027
|
+
return parts.length <= 128 && parts.reduce((size, part) => size + part.text.length, 0) <= 8192 ? parts : UNKNOWN;
|
|
22028
|
+
}
|
|
22029
|
+
var prefer_configured_cloud_scope_default = defineRule({
|
|
22030
|
+
meta: {
|
|
22031
|
+
type: "suggestion",
|
|
22032
|
+
docs: {
|
|
22033
|
+
description: "Prefer validated deployment configuration for account scope in outgoing cloud management requests.",
|
|
22034
|
+
url: docsUrl(NAME92)
|
|
22035
|
+
},
|
|
22036
|
+
schema: [],
|
|
22037
|
+
messages: {
|
|
22038
|
+
configuredScope: "This outgoing Cloudflare management request uses a source-literal account scope. Read and validate the account ID from deployment configuration or environment variables at the boundary; keep independent security allowlists intact."
|
|
22039
|
+
}
|
|
22040
|
+
},
|
|
22041
|
+
createOnce(context) {
|
|
22042
|
+
let sourceCode2;
|
|
22043
|
+
const reported = /* @__PURE__ */ new Set();
|
|
22044
|
+
const requests = [];
|
|
22045
|
+
let fetchOverridden = false;
|
|
22046
|
+
let nodesRemaining = 0;
|
|
22047
|
+
function bindingOf(node) {
|
|
22048
|
+
return findVariable(sourceCode2.getScope(node), node.name);
|
|
22049
|
+
}
|
|
22050
|
+
function unshadowed(node) {
|
|
22051
|
+
const binding3 = bindingOf(node);
|
|
22052
|
+
return binding3 === null || binding3.defs.length === 0;
|
|
22053
|
+
}
|
|
22054
|
+
function globalReceiver2(node) {
|
|
22055
|
+
return node.type === "Identifier" && GLOBAL_RECEIVERS5.has(node.name) && unshadowed(node);
|
|
22056
|
+
}
|
|
22057
|
+
function outgoingFetch(node, seen = /* @__PURE__ */ new Set()) {
|
|
22058
|
+
const callee = unwrapExpression(node);
|
|
22059
|
+
if (callee.type === "MemberExpression") {
|
|
22060
|
+
return globalReceiver2(callee.object) && staticPropertyName(callee, sourceCode2) === "fetch";
|
|
22061
|
+
}
|
|
22062
|
+
if (callee.type !== "Identifier") return false;
|
|
22063
|
+
const binding3 = bindingOf(callee);
|
|
22064
|
+
if (binding3 === null || binding3.defs.length === 0) return callee.name === "fetch";
|
|
22065
|
+
if (seen.has(binding3) || seen.size >= 16 || binding3.defs.length !== 1 || binding3.references.some((ref) => ref.isWrite() && ref.init !== true)) return false;
|
|
22066
|
+
const next = /* @__PURE__ */ new Set([...seen, binding3]);
|
|
22067
|
+
const [definition] = binding3.defs;
|
|
22068
|
+
if (definition?.type === "Parameter") {
|
|
22069
|
+
const parameter = parentOf(definition.name);
|
|
22070
|
+
return parameter?.type === "AssignmentPattern" && parameter.left === definition.name && outgoingFetch(parameter.right, next);
|
|
22071
|
+
}
|
|
22072
|
+
if (definition?.type !== "Variable" || definition.parent?.type !== "VariableDeclaration" || definition.parent.kind !== "const") return false;
|
|
22073
|
+
const declarator = definition.node;
|
|
22074
|
+
return declarator.id.type === "Identifier" && declarator.init !== null && outgoingFetch(declarator.init, next);
|
|
22075
|
+
}
|
|
22076
|
+
function checkWrite(target, depth = 0) {
|
|
22077
|
+
if (depth >= 16) {
|
|
22078
|
+
fetchOverridden = true;
|
|
22079
|
+
return;
|
|
22080
|
+
}
|
|
22081
|
+
const value = unwrapExpression(target);
|
|
22082
|
+
switch (value.type) {
|
|
22083
|
+
case "Identifier":
|
|
22084
|
+
fetchOverridden ||= (value.name === "fetch" || GLOBAL_RECEIVERS5.has(value.name)) && unshadowed(value);
|
|
22085
|
+
return;
|
|
22086
|
+
case "MemberExpression":
|
|
22087
|
+
if (globalReceiver2(value.object)) {
|
|
22088
|
+
const name = staticPropertyName(value, sourceCode2);
|
|
22089
|
+
fetchOverridden ||= name === null || name === "fetch" || GLOBAL_RECEIVERS5.has(name);
|
|
22090
|
+
}
|
|
22091
|
+
return;
|
|
22092
|
+
case "ObjectPattern":
|
|
22093
|
+
for (const property of value.properties) checkWrite(property.type === "RestElement" ? property.argument : property.value, depth + 1);
|
|
22094
|
+
return;
|
|
22095
|
+
case "ArrayPattern":
|
|
22096
|
+
for (const element of value.elements) if (element !== null) checkWrite(element, depth + 1);
|
|
22097
|
+
return;
|
|
22098
|
+
case "AssignmentPattern":
|
|
22099
|
+
checkWrite(value.left, depth + 1);
|
|
22100
|
+
return;
|
|
22101
|
+
case "RestElement":
|
|
22102
|
+
checkWrite(value.argument, depth + 1);
|
|
22103
|
+
return;
|
|
22104
|
+
}
|
|
22105
|
+
}
|
|
22106
|
+
function urlParts(node, seen = /* @__PURE__ */ new Set(), depth = 0) {
|
|
22107
|
+
if (depth >= 16 || nodesRemaining-- <= 0) return UNKNOWN;
|
|
22108
|
+
const value = unwrapExpression(node);
|
|
22109
|
+
if (value.type === "Literal" && typeof value.value === "string") {
|
|
22110
|
+
return boundedParts([{ text: value.value, source: value }]);
|
|
22111
|
+
}
|
|
22112
|
+
if (value.type === "Identifier") {
|
|
22113
|
+
const binding3 = bindingOf(value);
|
|
22114
|
+
if (binding3 === null || seen.has(binding3) || binding3.defs.length !== 1 || binding3.references.some((ref) => ref.isWrite() && ref.init !== true)) return UNKNOWN;
|
|
22115
|
+
const [definition] = binding3.defs;
|
|
22116
|
+
if (definition?.type !== "Variable" || definition.parent?.type !== "VariableDeclaration" || definition.parent.kind !== "const") return UNKNOWN;
|
|
22117
|
+
const declarator = definition.node;
|
|
22118
|
+
if (declarator.id.type !== "Identifier" || declarator.init === null) return UNKNOWN;
|
|
22119
|
+
return urlParts(declarator.init, /* @__PURE__ */ new Set([...seen, binding3]), depth + 1);
|
|
22120
|
+
}
|
|
22121
|
+
if (value.type === "BinaryExpression" && value.operator === "+") {
|
|
22122
|
+
return boundedParts([...urlParts(value.left, seen, depth + 1), ...urlParts(value.right, seen, depth + 1)]);
|
|
22123
|
+
}
|
|
22124
|
+
if (value.type === "TemplateLiteral") return templateParts(value, seen, depth);
|
|
22125
|
+
return UNKNOWN;
|
|
22126
|
+
}
|
|
22127
|
+
function templateParts(value, seen, depth) {
|
|
22128
|
+
const parts = [];
|
|
22129
|
+
for (let index = 0; index < value.quasis.length; index++) {
|
|
22130
|
+
if (parts.length >= 128) return UNKNOWN;
|
|
22131
|
+
const quasi = value.quasis[index];
|
|
22132
|
+
if (quasi === void 0 || quasi.value.cooked === null) return UNKNOWN;
|
|
22133
|
+
parts.push({ text: quasi.value.cooked, source: quasi });
|
|
22134
|
+
const expression = value.expressions[index];
|
|
22135
|
+
if (expression !== void 0) parts.push(...urlParts(expression, seen, depth + 1));
|
|
22136
|
+
}
|
|
22137
|
+
return boundedParts(parts);
|
|
22138
|
+
}
|
|
22139
|
+
return {
|
|
22140
|
+
before() {
|
|
22141
|
+
sourceCode2 = context.sourceCode;
|
|
22142
|
+
reported.clear();
|
|
22143
|
+
requests.length = 0;
|
|
22144
|
+
fetchOverridden = false;
|
|
22145
|
+
const file = { filename: context.filename, cwd: context.cwd };
|
|
22146
|
+
return !isTestFile(file) && !isGeneratedFile(file, sourceCode2.text);
|
|
22147
|
+
},
|
|
22148
|
+
CallExpression(node) {
|
|
22149
|
+
if (outgoingFetch(node.callee)) requests.push(node);
|
|
22150
|
+
},
|
|
22151
|
+
AssignmentExpression(node) {
|
|
22152
|
+
checkWrite(node.left);
|
|
22153
|
+
},
|
|
22154
|
+
UpdateExpression(node) {
|
|
22155
|
+
checkWrite(node.argument);
|
|
22156
|
+
},
|
|
22157
|
+
UnaryExpression(node) {
|
|
22158
|
+
if (node.operator === "delete") checkWrite(node.argument);
|
|
22159
|
+
},
|
|
22160
|
+
ForInStatement(node) {
|
|
22161
|
+
if (node.left.type !== "VariableDeclaration") checkWrite(node.left);
|
|
22162
|
+
},
|
|
22163
|
+
ForOfStatement(node) {
|
|
22164
|
+
if (node.left.type !== "VariableDeclaration") checkWrite(node.left);
|
|
22165
|
+
},
|
|
22166
|
+
"Program:exit"() {
|
|
22167
|
+
if (fetchOverridden) return;
|
|
22168
|
+
for (const request of requests) {
|
|
22169
|
+
const [url] = request.arguments;
|
|
22170
|
+
if (url === void 0 || url.type === "SpreadElement") continue;
|
|
22171
|
+
nodesRemaining = 256;
|
|
22172
|
+
const literal2 = accountSource(urlParts(url));
|
|
22173
|
+
if (literal2 === null || reported.has(literal2)) continue;
|
|
22174
|
+
reported.add(literal2);
|
|
22175
|
+
context.report({ node: literal2, messageId: "configuredScope" });
|
|
22176
|
+
}
|
|
22177
|
+
}
|
|
22178
|
+
};
|
|
22179
|
+
}
|
|
22180
|
+
});
|
|
22181
|
+
|
|
21828
22182
|
// src/rules/prefer-constant-time-secret-compare.ts
|
|
21829
|
-
var
|
|
22183
|
+
var NAME93 = "prefer-constant-time-secret-compare";
|
|
21830
22184
|
var EQUALITY_OPERATORS3 = /* @__PURE__ */ new Set(["===", "!==", "==", "!="]);
|
|
21831
22185
|
var AUTH_TOKEN_QUALIFIERS = /* @__PURE__ */ new Set(["access", "refresh", "session", "admin", "csrf", "xsrf", "auth", "authentication", "signing", "api"]);
|
|
21832
22186
|
var SENTINEL_IDENTIFIERS = /* @__PURE__ */ new Set(["undefined", "NaN"]);
|
|
@@ -21890,7 +22244,7 @@ var prefer_constant_time_secret_compare_default = defineRule({
|
|
|
21890
22244
|
type: "problem",
|
|
21891
22245
|
docs: {
|
|
21892
22246
|
description: "Prefer a supported constant-time comparison primitive for secret-like values.",
|
|
21893
|
-
url: docsUrl(
|
|
22247
|
+
url: docsUrl(NAME93)
|
|
21894
22248
|
},
|
|
21895
22249
|
schema: [],
|
|
21896
22250
|
messages: {
|
|
@@ -21978,7 +22332,7 @@ function constInitializer4(definition) {
|
|
|
21978
22332
|
}
|
|
21979
22333
|
|
|
21980
22334
|
// src/rules/prefer-dependency-interface.ts
|
|
21981
|
-
var
|
|
22335
|
+
var NAME94 = "prefer-dependency-interface";
|
|
21982
22336
|
function readsInterfaceMember(use, members2) {
|
|
21983
22337
|
const parent = parentOf(use);
|
|
21984
22338
|
if (parent?.type !== "MemberExpression" || parent.object !== use || !members2.has(getPropertyName(parent) ?? "")) return false;
|
|
@@ -22008,7 +22362,7 @@ var prefer_dependency_interface_default = defineRule({
|
|
|
22008
22362
|
type: "suggestion",
|
|
22009
22363
|
docs: {
|
|
22010
22364
|
description: "Annotate retained collaborators with their existing interface when the consumer uses only that contract.",
|
|
22011
|
-
url: docsUrl(
|
|
22365
|
+
url: docsUrl(NAME94)
|
|
22012
22366
|
},
|
|
22013
22367
|
schema: [],
|
|
22014
22368
|
messages: { interface: "Use the existing `{{contract}}` interface for this dependency; its consumer uses only that contract." }
|
|
@@ -22365,14 +22719,14 @@ function literalTag(node) {
|
|
|
22365
22719
|
}
|
|
22366
22720
|
|
|
22367
22721
|
// src/rules/prefer-discriminated-union.ts
|
|
22368
|
-
var
|
|
22722
|
+
var NAME95 = "prefer-discriminated-union";
|
|
22369
22723
|
var prefer_discriminated_union_default = defineRule({
|
|
22370
22724
|
meta: {
|
|
22371
22725
|
type: "suggestion",
|
|
22372
22726
|
fixable: "code",
|
|
22373
22727
|
docs: {
|
|
22374
22728
|
description: "Preserve producer-proven tag/payload and Boolean state relationships in return types.",
|
|
22375
|
-
url: docsUrl(
|
|
22729
|
+
url: docsUrl(NAME95)
|
|
22376
22730
|
},
|
|
22377
22731
|
schema: [],
|
|
22378
22732
|
messages: {
|
|
@@ -22445,7 +22799,7 @@ function privateVariantType(properties2, result, sourceCode2) {
|
|
|
22445
22799
|
}
|
|
22446
22800
|
|
|
22447
22801
|
// src/rules/prefer-ecmascript-private-members.ts
|
|
22448
|
-
var
|
|
22802
|
+
var NAME96 = "prefer-ecmascript-private-members";
|
|
22449
22803
|
function isConvertible(member3) {
|
|
22450
22804
|
return member3.accessibility === "private" && !(member3.type === "MethodDefinition" && member3.kind === "constructor") && !member3.computed && member3.key.type === "Identifier" && (member3.decorators?.length ?? 0) === 0 && !("declare" in member3 && member3.declare) && !member3.override && !(member3.type === "MethodDefinition" && (member3.value.body ?? null) === null);
|
|
22451
22805
|
}
|
|
@@ -22455,7 +22809,7 @@ var prefer_ecmascript_private_members_default = defineRule({
|
|
|
22455
22809
|
fixable: "code",
|
|
22456
22810
|
docs: {
|
|
22457
22811
|
description: "Prefer ECMAScript `#private` class members over TypeScript-only `private` members.",
|
|
22458
|
-
url: docsUrl(
|
|
22812
|
+
url: docsUrl(NAME96)
|
|
22459
22813
|
},
|
|
22460
22814
|
schema: [],
|
|
22461
22815
|
messages: {
|
|
@@ -22509,7 +22863,7 @@ var prefer_ecmascript_private_members_default = defineRule({
|
|
|
22509
22863
|
});
|
|
22510
22864
|
|
|
22511
22865
|
// src/rules/prefer-immutable-module-constant.ts
|
|
22512
|
-
var
|
|
22866
|
+
var NAME97 = "prefer-immutable-module-constant";
|
|
22513
22867
|
var CONSTANT_NAME = /^_?[A-Z][A-Z0-9_]*$/;
|
|
22514
22868
|
var JAVASCRIPT_FILE_RE = /\.[cm]?jsx?$/i;
|
|
22515
22869
|
var MUTATING_METHODS = /* @__PURE__ */ new Set([
|
|
@@ -22682,7 +23036,7 @@ var prefer_immutable_module_constant_default = defineRule({
|
|
|
22682
23036
|
fixable: "code",
|
|
22683
23037
|
docs: {
|
|
22684
23038
|
description: "Require module-level constant collections to expose readonly state.",
|
|
22685
|
-
url: docsUrl(
|
|
23039
|
+
url: docsUrl(NAME97)
|
|
22686
23040
|
},
|
|
22687
23041
|
schema: [],
|
|
22688
23042
|
defaultOptions: [],
|
|
@@ -22788,7 +23142,7 @@ function unwrapTransparentExport(node) {
|
|
|
22788
23142
|
}
|
|
22789
23143
|
|
|
22790
23144
|
// src/rules/prefer-input-group-search.ts
|
|
22791
|
-
var
|
|
23145
|
+
var NAME98 = "prefer-input-group-search";
|
|
22792
23146
|
var INPUT_MODULE = /(?:^|\/)components\/ui\/input$/u;
|
|
22793
23147
|
var INPUT_GROUP_MODULE = /(?:^|\/)components\/ui\/input-group$/u;
|
|
22794
23148
|
var MAX_JSX_DISTANCE = 2;
|
|
@@ -22859,7 +23213,7 @@ var prefer_input_group_search_default = defineRule({
|
|
|
22859
23213
|
type: "suggestion",
|
|
22860
23214
|
docs: {
|
|
22861
23215
|
description: "Require search icons and shared Input controls in the same visual wrapper to use InputGroup.",
|
|
22862
|
-
url: docsUrl(
|
|
23216
|
+
url: docsUrl(NAME98)
|
|
22863
23217
|
},
|
|
22864
23218
|
schema: [],
|
|
22865
23219
|
messages: {
|
|
@@ -22943,7 +23297,7 @@ var prefer_input_group_search_default = defineRule({
|
|
|
22943
23297
|
});
|
|
22944
23298
|
|
|
22945
23299
|
// src/rules/prefer-logical-tailwind-utilities.ts
|
|
22946
|
-
var
|
|
23300
|
+
var NAME99 = "prefer-logical-tailwind-utilities";
|
|
22947
23301
|
var PREFIXES = {
|
|
22948
23302
|
ml: "ms",
|
|
22949
23303
|
mr: "me",
|
|
@@ -22997,7 +23351,7 @@ var prefer_logical_tailwind_utilities_default = defineRule({
|
|
|
22997
23351
|
type: "suggestion",
|
|
22998
23352
|
docs: {
|
|
22999
23353
|
description: "Prefer logical Tailwind utilities in explicitly opted-in bidirectional interfaces.",
|
|
23000
|
-
url: docsUrl(
|
|
23354
|
+
url: docsUrl(NAME99)
|
|
23001
23355
|
},
|
|
23002
23356
|
schema: [
|
|
23003
23357
|
{
|
|
@@ -23064,7 +23418,7 @@ var prefer_logical_tailwind_utilities_default = defineRule({
|
|
|
23064
23418
|
});
|
|
23065
23419
|
|
|
23066
23420
|
// src/rules/prefer-millisecond-control-duration-schema.ts
|
|
23067
|
-
var
|
|
23421
|
+
var NAME100 = "prefer-millisecond-control-duration-schema";
|
|
23068
23422
|
var CONTROL_SECONDS_RE = /(?:^|_)(?:timeout|delay|interval|backoff|ttl|lease|heartbeat|debounce|throttle)_seconds$/i;
|
|
23069
23423
|
var CONTROL_SECONDS_CAMEL_RE = /(?:timeout|delay|interval|backoff|ttl|lease|heartbeat|debounce|throttle)Seconds$/i;
|
|
23070
23424
|
var NUMERIC_REFINEMENTS = /* @__PURE__ */ new Set(["int", "min", "max", "positive", "nonnegative", "finite", "multipleOf", "optional", "nullable", "nullish", "default", "describe", "brand", "readonly"]);
|
|
@@ -23076,7 +23430,7 @@ var prefer_millisecond_control_duration_schema_default = defineRule({
|
|
|
23076
23430
|
type: "suggestion",
|
|
23077
23431
|
docs: {
|
|
23078
23432
|
description: "Require application-owned Zod control-duration fields to use millisecond granularity.",
|
|
23079
|
-
url: docsUrl(
|
|
23433
|
+
url: docsUrl(NAME100)
|
|
23080
23434
|
},
|
|
23081
23435
|
schema: [],
|
|
23082
23436
|
messages: {
|
|
@@ -23162,7 +23516,7 @@ var prefer_millisecond_control_duration_schema_default = defineRule({
|
|
|
23162
23516
|
});
|
|
23163
23517
|
|
|
23164
23518
|
// src/rules/prefer-minimal-parameter-contract.ts
|
|
23165
|
-
var
|
|
23519
|
+
var NAME101 = "prefer-minimal-parameter-contract";
|
|
23166
23520
|
function inlineFields(ast, node, reads) {
|
|
23167
23521
|
const fields2 = /* @__PURE__ */ new Map();
|
|
23168
23522
|
for (const member3 of node.members) {
|
|
@@ -23181,7 +23535,7 @@ var prefer_minimal_parameter_contract_default = defineRule({
|
|
|
23181
23535
|
meta: {
|
|
23182
23536
|
type: "suggestion",
|
|
23183
23537
|
fixable: "code",
|
|
23184
|
-
docs: { description: "Prefer the proven read-only subset for a private consumer parameter.", url: docsUrl(
|
|
23538
|
+
docs: { description: "Prefer the proven read-only subset for a private consumer parameter.", url: docsUrl(NAME101) },
|
|
23185
23539
|
schema: [],
|
|
23186
23540
|
messages: {
|
|
23187
23541
|
minimal: "This private consumer reads only {{used}} but also requires {{unused}}. Review a smaller consumer contract; preserve the original runtime object and producer type."
|
|
@@ -23580,7 +23934,7 @@ var prefer_module_level_constant_default = defineRule({
|
|
|
23580
23934
|
});
|
|
23581
23935
|
|
|
23582
23936
|
// src/rules/prefer-module-level-schema.ts
|
|
23583
|
-
var
|
|
23937
|
+
var NAME102 = "prefer-module-level-schema";
|
|
23584
23938
|
var DEFAULT_FACTORIES = [
|
|
23585
23939
|
"discriminatedUnion",
|
|
23586
23940
|
"intersection",
|
|
@@ -23762,7 +24116,7 @@ var prefer_module_level_schema_default = defineRule({
|
|
|
23762
24116
|
type: "problem",
|
|
23763
24117
|
docs: {
|
|
23764
24118
|
description: "Declare a Zod schema at module scope when it closes over nothing in the enclosing function",
|
|
23765
|
-
url: docsUrl(
|
|
24119
|
+
url: docsUrl(NAME102)
|
|
23766
24120
|
},
|
|
23767
24121
|
schema: [
|
|
23768
24122
|
{
|
|
@@ -23912,7 +24266,7 @@ var prefer_module_level_schema_default = defineRule({
|
|
|
23912
24266
|
});
|
|
23913
24267
|
|
|
23914
24268
|
// src/rules/prefer-module-level-refined-schema.ts
|
|
23915
|
-
var
|
|
24269
|
+
var NAME103 = "prefer-module-level-refined-schema";
|
|
23916
24270
|
var BENCHMARK_PATH_RE = /(^|[/\\])(?:benchmarks?|bench)[/\\]/;
|
|
23917
24271
|
var FACTORIES = /* @__PURE__ */ new Set([
|
|
23918
24272
|
"array",
|
|
@@ -24062,7 +24416,7 @@ var prefer_module_level_refined_schema_default = defineRule({
|
|
|
24062
24416
|
type: "suggestion",
|
|
24063
24417
|
docs: {
|
|
24064
24418
|
description: "Declare closed Zod scalar, format, and wrapper schemas at module scope.",
|
|
24065
|
-
url: docsUrl(
|
|
24419
|
+
url: docsUrl(NAME103)
|
|
24066
24420
|
},
|
|
24067
24421
|
schema: [],
|
|
24068
24422
|
messages: {
|
|
@@ -24160,7 +24514,7 @@ var prefer_module_level_refined_schema_default = defineRule({
|
|
|
24160
24514
|
});
|
|
24161
24515
|
|
|
24162
24516
|
// src/rules/prefer-multi-value-zod-literal.ts
|
|
24163
|
-
var
|
|
24517
|
+
var NAME104 = "prefer-multi-value-zod-literal";
|
|
24164
24518
|
function isStaticPrimitive(node, sourceCode2) {
|
|
24165
24519
|
node = unwrapExpression(node);
|
|
24166
24520
|
if (node.type === "Literal") {
|
|
@@ -24187,7 +24541,7 @@ var prefer_multi_value_zod_literal_default = defineRule({
|
|
|
24187
24541
|
type: "suggestion",
|
|
24188
24542
|
docs: {
|
|
24189
24543
|
description: "Use the Zod 4 multi-value literal API instead of a union of literal schemas.",
|
|
24190
|
-
url: docsUrl(
|
|
24544
|
+
url: docsUrl(NAME104)
|
|
24191
24545
|
},
|
|
24192
24546
|
schema: [
|
|
24193
24547
|
{
|
|
@@ -24350,7 +24704,7 @@ function closedType(node) {
|
|
|
24350
24704
|
}
|
|
24351
24705
|
|
|
24352
24706
|
// src/rules/prefer-named-callback-domain.ts
|
|
24353
|
-
var
|
|
24707
|
+
var NAME105 = "prefer-named-callback-domain";
|
|
24354
24708
|
function isLiteralUnion(node) {
|
|
24355
24709
|
return node.type === "TSUnionType" && node.types.length >= 2 && node.types.every((part) => part.type === "TSLiteralType");
|
|
24356
24710
|
}
|
|
@@ -24370,7 +24724,7 @@ var prefer_named_callback_domain_default = defineRule({
|
|
|
24370
24724
|
fixable: "code",
|
|
24371
24725
|
docs: {
|
|
24372
24726
|
description: "Name literal-union domains used by callbacks in exported contracts.",
|
|
24373
|
-
url: docsUrl(
|
|
24727
|
+
url: docsUrl(NAME105)
|
|
24374
24728
|
},
|
|
24375
24729
|
schema: [],
|
|
24376
24730
|
messages: {
|
|
@@ -24409,7 +24763,7 @@ var prefer_named_callback_domain_default = defineRule({
|
|
|
24409
24763
|
});
|
|
24410
24764
|
|
|
24411
24765
|
// src/rules/prefer-named-complex-return-type.ts
|
|
24412
|
-
var
|
|
24766
|
+
var NAME106 = "prefer-named-complex-return-type";
|
|
24413
24767
|
function unwrap5(node) {
|
|
24414
24768
|
if (node.type === "TSTypeReference" && node.typeArguments?.params.length === 1) {
|
|
24415
24769
|
const [inner] = node.typeArguments.params;
|
|
@@ -24447,7 +24801,7 @@ var prefer_named_complex_return_type_default = defineRule({
|
|
|
24447
24801
|
fixable: "code",
|
|
24448
24802
|
docs: {
|
|
24449
24803
|
description: "Prefer a named contract for structurally complex function return types.",
|
|
24450
|
-
url: docsUrl(
|
|
24804
|
+
url: docsUrl(NAME106)
|
|
24451
24805
|
},
|
|
24452
24806
|
schema: [],
|
|
24453
24807
|
messages: {
|
|
@@ -24470,14 +24824,14 @@ var prefer_named_complex_return_type_default = defineRule({
|
|
|
24470
24824
|
});
|
|
24471
24825
|
|
|
24472
24826
|
// src/rules/prefer-native-fetch-in-server-actions.ts
|
|
24473
|
-
var
|
|
24827
|
+
var NAME107 = "prefer-native-fetch-in-server-actions";
|
|
24474
24828
|
var KY_MODULE = /^ky(?:\/.*)?$/u;
|
|
24475
24829
|
var prefer_native_fetch_in_server_actions_default = defineRule({
|
|
24476
24830
|
meta: {
|
|
24477
24831
|
type: "problem",
|
|
24478
24832
|
docs: {
|
|
24479
24833
|
description: "Server action modules should call native fetch instead of importing ky.",
|
|
24480
|
-
url: docsUrl(
|
|
24834
|
+
url: docsUrl(NAME107)
|
|
24481
24835
|
},
|
|
24482
24836
|
schema: [],
|
|
24483
24837
|
defaultOptions: [],
|
|
@@ -24513,7 +24867,7 @@ function isTypeOnly(node) {
|
|
|
24513
24867
|
}
|
|
24514
24868
|
|
|
24515
24869
|
// src/rules/prefer-native-random-uuid.ts
|
|
24516
|
-
var
|
|
24870
|
+
var NAME108 = "prefer-native-random-uuid";
|
|
24517
24871
|
function requireUuidCallee(node) {
|
|
24518
24872
|
return node?.type === "CallExpression" && node.callee.type === "Identifier" && node.callee.name === "require" && node.arguments.length === 1 && node.arguments[0]?.type === "Literal" && node.arguments[0].value === "uuid" ? node.callee : null;
|
|
24519
24873
|
}
|
|
@@ -24526,7 +24880,7 @@ var prefer_native_random_uuid_default = defineRule({
|
|
|
24526
24880
|
type: "suggestion",
|
|
24527
24881
|
docs: {
|
|
24528
24882
|
description: "Prefer `globalThis.crypto.randomUUID()` over resolved zero-argument UUID v4 bindings from the `uuid` package.",
|
|
24529
|
-
url: docsUrl(
|
|
24883
|
+
url: docsUrl(NAME108)
|
|
24530
24884
|
},
|
|
24531
24885
|
hasSuggestions: true,
|
|
24532
24886
|
fixable: "code",
|
|
@@ -24614,7 +24968,7 @@ var prefer_native_random_uuid_default = defineRule({
|
|
|
24614
24968
|
});
|
|
24615
24969
|
|
|
24616
24970
|
// src/rules/prefer-node-crypto-hash.ts
|
|
24617
|
-
var
|
|
24971
|
+
var NAME109 = "prefer-node-crypto-hash";
|
|
24618
24972
|
var UNSAFE_NAMESPACE_METHODS = /* @__PURE__ */ new Set(["__defineGetter__", "__defineSetter__", "valueOf"]);
|
|
24619
24973
|
var UNSAFE_AUTHORITY_IDENTIFIERS = [
|
|
24620
24974
|
"eval",
|
|
@@ -24718,7 +25072,7 @@ var prefer_node_crypto_hash_default = defineRule({
|
|
|
24718
25072
|
fixable: "code",
|
|
24719
25073
|
docs: {
|
|
24720
25074
|
description: "Prefer the modern one-shot node:crypto hash API when streaming state is unnecessary.",
|
|
24721
|
-
url: docsUrl(
|
|
25075
|
+
url: docsUrl(NAME109)
|
|
24722
25076
|
},
|
|
24723
25077
|
schema: [],
|
|
24724
25078
|
messages: { preferNodeCryptoHash: "Prefer the modern one-shot node:crypto hash API when streaming state is unnecessary." }
|
|
@@ -24948,7 +25302,7 @@ function hasRetainedFactoryCall(binding3, removed) {
|
|
|
24948
25302
|
}
|
|
24949
25303
|
|
|
24950
25304
|
// src/rules/prefer-node-fs-promises.ts
|
|
24951
|
-
var
|
|
25305
|
+
var NAME110 = "prefer-node-fs-promises";
|
|
24952
25306
|
function memberName3(node) {
|
|
24953
25307
|
if (!node.computed && node.property.type === "Identifier") return node.property.name;
|
|
24954
25308
|
if (node.computed && node.property.type === "Literal" && typeof node.property.value === "string") {
|
|
@@ -24981,7 +25335,7 @@ var prefer_node_fs_promises_default = defineRule({
|
|
|
24981
25335
|
type: "suggestion",
|
|
24982
25336
|
docs: {
|
|
24983
25337
|
description: "Prefer promise-based Node.js filesystem APIs over synchronous calls in production modules.",
|
|
24984
|
-
url: docsUrl(
|
|
25338
|
+
url: docsUrl(NAME110)
|
|
24985
25339
|
},
|
|
24986
25340
|
schema: [],
|
|
24987
25341
|
messages: {
|
|
@@ -25124,7 +25478,7 @@ function sameTypeBinding(sourceCode2, alias, annotation, parameter) {
|
|
|
25124
25478
|
}
|
|
25125
25479
|
|
|
25126
25480
|
// src/rules/prefer-nominal-id-types.ts
|
|
25127
|
-
var
|
|
25481
|
+
var NAME111 = "prefer-nominal-id-types";
|
|
25128
25482
|
var OPERATIONAL_ROLES = /* @__PURE__ */ new Set([
|
|
25129
25483
|
"request",
|
|
25130
25484
|
"trace",
|
|
@@ -25240,7 +25594,7 @@ var prefer_nominal_id_types_default = defineRule({
|
|
|
25240
25594
|
fixable: "code",
|
|
25241
25595
|
docs: {
|
|
25242
25596
|
description: "Distinguish identifier roles sharing primitive types at callable boundaries.",
|
|
25243
|
-
url: docsUrl(
|
|
25597
|
+
url: docsUrl(NAME111)
|
|
25244
25598
|
},
|
|
25245
25599
|
schema: [],
|
|
25246
25600
|
messages: {
|
|
@@ -25269,7 +25623,7 @@ var prefer_nominal_id_types_default = defineRule({
|
|
|
25269
25623
|
});
|
|
25270
25624
|
|
|
25271
25625
|
// src/rules/prefer-non-nullable-collection.ts
|
|
25272
|
-
var
|
|
25626
|
+
var NAME112 = "prefer-non-nullable-collection";
|
|
25273
25627
|
var ARRAY_TYPE_NAMES2 = /* @__PURE__ */ new Set(["Array", "ReadonlyArray"]);
|
|
25274
25628
|
var NULL_GUARD_OPERATORS = /* @__PURE__ */ new Set(["==", "==="]);
|
|
25275
25629
|
var EMPTY_GUARD_OPERATORS = /* @__PURE__ */ new Set(["==", "===", "<="]);
|
|
@@ -25624,7 +25978,7 @@ var prefer_non_nullable_collection_default = defineRule({
|
|
|
25624
25978
|
fixable: "code",
|
|
25625
25979
|
docs: {
|
|
25626
25980
|
description: "Suggest reviewing nullish arrays that use local empty-array defaults or a shared null-or-empty guard.",
|
|
25627
|
-
url: docsUrl(
|
|
25981
|
+
url: docsUrl(NAME112)
|
|
25628
25982
|
},
|
|
25629
25983
|
schema: [],
|
|
25630
25984
|
messages: {
|
|
@@ -25735,7 +26089,7 @@ var prefer_non_nullable_collection_default = defineRule({
|
|
|
25735
26089
|
});
|
|
25736
26090
|
|
|
25737
26091
|
// src/rules/prefer-nullish-filter-predicate.ts
|
|
25738
|
-
var
|
|
26092
|
+
var NAME113 = "prefer-nullish-filter-predicate";
|
|
25739
26093
|
var SUMMARY = "Prefer an explicit nullish predicate when `filter(Boolean)` removes only nullish values but does not narrow the result type.";
|
|
25740
26094
|
function isBuiltinArrayFilter(native, symbol) {
|
|
25741
26095
|
const kinds2 = native.ast.SyntaxKind;
|
|
@@ -25792,7 +26146,7 @@ function isLiteralValue(node) {
|
|
|
25792
26146
|
var prefer_nullish_filter_predicate_default = defineRule({
|
|
25793
26147
|
meta: {
|
|
25794
26148
|
type: "suggestion",
|
|
25795
|
-
docs: { description: SUMMARY, url: docsUrl(
|
|
26149
|
+
docs: { description: SUMMARY, url: docsUrl(NAME113) },
|
|
25796
26150
|
hasSuggestions: true,
|
|
25797
26151
|
fixable: "code",
|
|
25798
26152
|
schema: [],
|
|
@@ -25885,7 +26239,7 @@ var prefer_nullish_filter_predicate_default = defineRule({
|
|
|
25885
26239
|
});
|
|
25886
26240
|
|
|
25887
26241
|
// src/rules/prefer-schema-for-api-payload.ts
|
|
25888
|
-
var
|
|
26242
|
+
var NAME114 = "prefer-schema-for-api-payload";
|
|
25889
26243
|
var unwrap6 = (node) => {
|
|
25890
26244
|
let current = node ?? null;
|
|
25891
26245
|
while (current !== null && (isErasedExpression(current) || current.type === "ChainExpression")) current = current.expression;
|
|
@@ -26168,7 +26522,7 @@ var prefer_schema_for_api_payload_default = defineRule({
|
|
|
26168
26522
|
type: "problem",
|
|
26169
26523
|
docs: {
|
|
26170
26524
|
description: "Require Zod (or similar) schema validation on `response.json()` / `JSON.parse()` results before property access.",
|
|
26171
|
-
url: docsUrl(
|
|
26525
|
+
url: docsUrl(NAME114)
|
|
26172
26526
|
},
|
|
26173
26527
|
schema: [],
|
|
26174
26528
|
messages: {
|
|
@@ -26351,7 +26705,7 @@ var prefer_schema_for_api_payload_default = defineRule({
|
|
|
26351
26705
|
// src/rules/prefer-semantic-colors.ts
|
|
26352
26706
|
import { existsSync as existsSync3, lstatSync, readdirSync as readdirSync2, readFileSync as readFileSync2 } from "fs";
|
|
26353
26707
|
import { dirname as dirname3, join as join3, parse } from "path";
|
|
26354
|
-
var
|
|
26708
|
+
var NAME115 = "prefer-semantic-colors";
|
|
26355
26709
|
var COLOR_PREFIXES = "text|bg|border(?:-[trblxyse])?|ring(?:-offset)?|fill|stroke|from|via|to|divide|decoration|placeholder|accent|caret|shadow|outline";
|
|
26356
26710
|
var PALETTE = "red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose|slate|gray|zinc|neutral|stone";
|
|
26357
26711
|
var COLOR_FN = "rgba?|hsla?|hwb|oklch|oklab|lab|lch|color";
|
|
@@ -26683,7 +27037,7 @@ var prefer_semantic_colors_default = defineRule({
|
|
|
26683
27037
|
type: "suggestion",
|
|
26684
27038
|
docs: {
|
|
26685
27039
|
description: "Enforce semantic color tokens over raw Tailwind palette classes, arbitrary color values, and inline color literals.",
|
|
26686
|
-
url: docsUrl(
|
|
27040
|
+
url: docsUrl(NAME115)
|
|
26687
27041
|
},
|
|
26688
27042
|
schema: [
|
|
26689
27043
|
{
|
|
@@ -26870,7 +27224,7 @@ function packageWorkspaceGlobs(parsed) {
|
|
|
26870
27224
|
}
|
|
26871
27225
|
|
|
26872
27226
|
// src/rules/prefer-server-actions.ts
|
|
26873
|
-
var
|
|
27227
|
+
var NAME116 = "prefer-server-actions";
|
|
26874
27228
|
var MUTATION_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "DELETE", "PATCH"]);
|
|
26875
27229
|
var AXIOS_MUTATION_METHODS = /* @__PURE__ */ new Set(["post", "put", "delete", "patch"]);
|
|
26876
27230
|
var SKIP_FILE_REGEX = /(?:\.test\.[jt]sx?$|\.spec\.[jt]sx?$|-(?:test|spec)\.[jt]sx?$|\/tests?\/|\/__tests__\/|\/__testfixtures__\/|\/scripts?\/|(?:^|\/)app(?:\/.*)?\/route\.[jt]sx?$|(?:^|\/)middleware\.[jt]sx?$|\/pages\/api\/)/;
|
|
@@ -27009,7 +27363,7 @@ var prefer_server_actions_default = defineRule({
|
|
|
27009
27363
|
type: "suggestion",
|
|
27010
27364
|
docs: {
|
|
27011
27365
|
description: "Prefer Next.js Server Actions over same-origin API mutations.",
|
|
27012
|
-
url: docsUrl(
|
|
27366
|
+
url: docsUrl(NAME116)
|
|
27013
27367
|
},
|
|
27014
27368
|
schema: [
|
|
27015
27369
|
{
|
|
@@ -27095,7 +27449,7 @@ var prefer_server_actions_default = defineRule({
|
|
|
27095
27449
|
});
|
|
27096
27450
|
|
|
27097
27451
|
// src/rules/prefer-server-data-preparation.ts
|
|
27098
|
-
var
|
|
27452
|
+
var NAME117 = "prefer-server-data-preparation";
|
|
27099
27453
|
var METHODS = /* @__PURE__ */ new Set(["map", "filter", "flatMap"]);
|
|
27100
27454
|
var DOM_EVENTS = /* @__PURE__ */ new Set(["onClick", "onChange", "onInput", "onSubmit"]);
|
|
27101
27455
|
var BINARY = /* @__PURE__ */ new Set(["===", "!==", "==", "!=", ">", ">=", "<", "<=", "+", "-", "*", "/", "%"]);
|
|
@@ -27227,7 +27581,7 @@ function typedProofs(native) {
|
|
|
27227
27581
|
var prefer_server_data_preparation_default = defineRule({
|
|
27228
27582
|
meta: {
|
|
27229
27583
|
type: "suggestion",
|
|
27230
|
-
docs: { description: "Prepare data-only input collections before an interactive client view when possible.", url: docsUrl(
|
|
27584
|
+
docs: { description: "Prepare data-only input collections before an interactive client view when possible.", url: docsUrl(NAME117) },
|
|
27231
27585
|
schema: [],
|
|
27232
27586
|
messages: {
|
|
27233
27587
|
prepareData: "Review preparing this prop-only collection in its producer or Server Component when the inputs are available there. Keep operations depending on unsaved edits or browser interaction reactive in the client."
|
|
@@ -28145,7 +28499,7 @@ var ParseErrorCode;
|
|
|
28145
28499
|
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
28146
28500
|
|
|
28147
28501
|
// src/rules/prefer-shadcn-primitives.ts
|
|
28148
|
-
var
|
|
28502
|
+
var NAME118 = "prefer-shadcn-primitives";
|
|
28149
28503
|
var RAW_PRIMITIVES = {
|
|
28150
28504
|
button: { capability: "Button", replacement: "Button" },
|
|
28151
28505
|
dialog: { capability: "Dialog", replacement: "Dialog or AlertDialog family" },
|
|
@@ -28447,7 +28801,7 @@ var prefer_shadcn_primitives_default = defineRule({
|
|
|
28447
28801
|
type: "suggestion",
|
|
28448
28802
|
docs: {
|
|
28449
28803
|
description: "Require visible raw JSX controls to use the corresponding shared shadcn primitive.",
|
|
28450
|
-
url: docsUrl(
|
|
28804
|
+
url: docsUrl(NAME118)
|
|
28451
28805
|
},
|
|
28452
28806
|
schema: [
|
|
28453
28807
|
{
|
|
@@ -28554,7 +28908,7 @@ function matchingAliasTargets(paths, alias) {
|
|
|
28554
28908
|
}
|
|
28555
28909
|
|
|
28556
28910
|
// src/rules/prefer-shared-zod-enum.ts
|
|
28557
|
-
var
|
|
28911
|
+
var NAME119 = "prefer-shared-zod-enum";
|
|
28558
28912
|
function literalDomain(node) {
|
|
28559
28913
|
if (node.arguments.length !== 1) return null;
|
|
28560
28914
|
const first = node.arguments[0];
|
|
@@ -28593,7 +28947,7 @@ var prefer_shared_zod_enum_default = defineRule({
|
|
|
28593
28947
|
type: "suggestion",
|
|
28594
28948
|
docs: {
|
|
28595
28949
|
description: "Give repeated literal Zod enum domains one reusable module-level schema.",
|
|
28596
|
-
url: docsUrl(
|
|
28950
|
+
url: docsUrl(NAME119)
|
|
28597
28951
|
},
|
|
28598
28952
|
schema: [],
|
|
28599
28953
|
messages: {
|
|
@@ -28650,7 +29004,7 @@ var prefer_shared_zod_enum_default = defineRule({
|
|
|
28650
29004
|
});
|
|
28651
29005
|
|
|
28652
29006
|
// src/rules/prefer-switch-for-repeated-equality.ts
|
|
28653
|
-
var
|
|
29007
|
+
var NAME120 = "prefer-switch-for-repeated-equality";
|
|
28654
29008
|
function discriminantName(test) {
|
|
28655
29009
|
if (test.type !== "BinaryExpression" || test.operator !== "===") return null;
|
|
28656
29010
|
const leftIsCase = isCaseValue(test.left);
|
|
@@ -28727,7 +29081,7 @@ var prefer_switch_for_repeated_equality_default = defineRule({
|
|
|
28727
29081
|
fixable: "code",
|
|
28728
29082
|
docs: {
|
|
28729
29083
|
description: "Prefer switch over long if/else-if chains that compare one value for strict equality.",
|
|
28730
|
-
url: docsUrl(
|
|
29084
|
+
url: docsUrl(NAME120)
|
|
28731
29085
|
},
|
|
28732
29086
|
schema: [],
|
|
28733
29087
|
messages: {
|
|
@@ -28777,7 +29131,7 @@ var prefer_switch_for_repeated_equality_default = defineRule({
|
|
|
28777
29131
|
});
|
|
28778
29132
|
|
|
28779
29133
|
// src/rules/prefer-test-fixture-reuse.ts
|
|
28780
|
-
var
|
|
29134
|
+
var NAME121 = "prefer-test-fixture-reuse";
|
|
28781
29135
|
var MAX_DEPTH2 = 8;
|
|
28782
29136
|
var FRAMEWORKS = /* @__PURE__ */ new Set(["vitest", "@playwright/test"]);
|
|
28783
29137
|
var TEST_MODIFIERS4 = /* @__PURE__ */ new Set(["only", "skip", "concurrent", "sequential"]);
|
|
@@ -28906,7 +29260,7 @@ var prefer_test_fixture_reuse_default = defineRule({
|
|
|
28906
29260
|
type: "suggestion",
|
|
28907
29261
|
docs: {
|
|
28908
29262
|
description: "Reuse a requested test fixture instead of constructing another instance of its class.",
|
|
28909
|
-
url: docsUrl(
|
|
29263
|
+
url: docsUrl(NAME121)
|
|
28910
29264
|
},
|
|
28911
29265
|
schema: [],
|
|
28912
29266
|
messages: { reuseFixture: "This class is already supplied by the requested `{{fixture}}` fixture; reuse it or request a typed factory for independent instances." }
|
|
@@ -28940,7 +29294,7 @@ var prefer_test_fixture_reuse_default = defineRule({
|
|
|
28940
29294
|
});
|
|
28941
29295
|
|
|
28942
29296
|
// src/rules/prefer-typed-reflection.ts
|
|
28943
|
-
var
|
|
29297
|
+
var NAME122 = "prefer-typed-reflection";
|
|
28944
29298
|
function knownType(native, type) {
|
|
28945
29299
|
if (type.isUnionType()) return type.getTypes().every((part) => knownType(native, part));
|
|
28946
29300
|
const flags = native.sync.TypeFlags;
|
|
@@ -28970,7 +29324,7 @@ var prefer_typed_reflection_default = defineRule({
|
|
|
28970
29324
|
fixable: "code",
|
|
28971
29325
|
docs: {
|
|
28972
29326
|
description: "Prefer typed access when Reflect.get or Reflect.apply discards a known contract.",
|
|
28973
|
-
url: docsUrl(
|
|
29327
|
+
url: docsUrl(NAME122)
|
|
28974
29328
|
},
|
|
28975
29329
|
schema: [],
|
|
28976
29330
|
messages: {
|
|
@@ -29136,7 +29490,7 @@ var prefer_typed_reflection_default = defineRule({
|
|
|
29136
29490
|
});
|
|
29137
29491
|
|
|
29138
29492
|
// src/rules/prefer-whole-object-assertion.ts
|
|
29139
|
-
var
|
|
29493
|
+
var NAME123 = "prefer-whole-object-assertion";
|
|
29140
29494
|
var MERGEABLE_MATCHERS = /* @__PURE__ */ new Set(["toBe", "toEqual", "toStrictEqual"]);
|
|
29141
29495
|
var SYNTHETIC_LITERAL_MATCHERS = /* @__PURE__ */ new Map([
|
|
29142
29496
|
["toBeNull", "null"]
|
|
@@ -29226,7 +29580,7 @@ var prefer_whole_object_assertion_default = defineRule({
|
|
|
29226
29580
|
type: "suggestion",
|
|
29227
29581
|
docs: {
|
|
29228
29582
|
description: "Collapse consecutive assertions on one object into a whole-object assertion so related mismatches are reported together.",
|
|
29229
|
-
url: docsUrl(
|
|
29583
|
+
url: docsUrl(NAME123)
|
|
29230
29584
|
},
|
|
29231
29585
|
messages: {
|
|
29232
29586
|
combineAssertions: "Consider combining these {{count}} assertions on `{{receiver}}` with `toMatchObject` when structural matching preserves property presence and getter or proxy behavior.",
|
|
@@ -29373,7 +29727,7 @@ var prefer_whole_object_assertion_default = defineRule({
|
|
|
29373
29727
|
});
|
|
29374
29728
|
|
|
29375
29729
|
// src/rules/prefer-zod-enum-validator.ts
|
|
29376
|
-
var
|
|
29730
|
+
var NAME124 = "prefer-zod-enum-validator";
|
|
29377
29731
|
function isInput(node, name) {
|
|
29378
29732
|
if (node == null) return false;
|
|
29379
29733
|
const value = unwrapExpression(node);
|
|
@@ -29464,7 +29818,7 @@ var prefer_zod_enum_validator_default = defineRule({
|
|
|
29464
29818
|
type: "suggestion",
|
|
29465
29819
|
docs: {
|
|
29466
29820
|
description: "Express closed string validators with a reusable Zod enum schema.",
|
|
29467
|
-
url: docsUrl(
|
|
29821
|
+
url: docsUrl(NAME124)
|
|
29468
29822
|
},
|
|
29469
29823
|
schema: [],
|
|
29470
29824
|
messages: { useEnumSchema: "Replace this closed string validator with a named z.enum([\u2026]) schema and derive its type with z.infer. Use parse for parsing or safeParse for a boolean check; preserve intentional failure behavior." }
|
|
@@ -29492,7 +29846,7 @@ var prefer_zod_enum_validator_default = defineRule({
|
|
|
29492
29846
|
});
|
|
29493
29847
|
|
|
29494
29848
|
// src/rules/prefer-zod-infer.ts
|
|
29495
|
-
var
|
|
29849
|
+
var NAME125 = "prefer-zod-infer";
|
|
29496
29850
|
function absent(value) {
|
|
29497
29851
|
return value === void 0 || value === null;
|
|
29498
29852
|
}
|
|
@@ -29868,7 +30222,7 @@ var prefer_zod_infer_default = defineRule({
|
|
|
29868
30222
|
fixable: "code",
|
|
29869
30223
|
docs: {
|
|
29870
30224
|
description: "Derive a type from its Zod schema with `z.infer` instead of hand-writing a twin declaration beside it.",
|
|
29871
|
-
url: docsUrl(
|
|
30225
|
+
url: docsUrl(NAME125)
|
|
29872
30226
|
},
|
|
29873
30227
|
schema: [
|
|
29874
30228
|
{
|
|
@@ -30318,7 +30672,7 @@ function returnsContract(authority, returned2) {
|
|
|
30318
30672
|
}
|
|
30319
30673
|
|
|
30320
30674
|
// src/rules/prefer-zod-parse-output-type.ts
|
|
30321
|
-
var
|
|
30675
|
+
var NAME126 = "prefer-zod-parse-output-type";
|
|
30322
30676
|
function isLocalZodObjectSchema(node, namespaces) {
|
|
30323
30677
|
let current = node;
|
|
30324
30678
|
while (current.type === "CallExpression") {
|
|
@@ -30464,7 +30818,7 @@ var prefer_zod_parse_output_type_default = defineRule({
|
|
|
30464
30818
|
fixable: "code",
|
|
30465
30819
|
docs: {
|
|
30466
30820
|
description: "Consider deriving validated return contracts from the Zod schema when the schema owns the contract.",
|
|
30467
|
-
url: docsUrl(
|
|
30821
|
+
url: docsUrl(NAME126)
|
|
30468
30822
|
},
|
|
30469
30823
|
schema: [],
|
|
30470
30824
|
messages: {
|
|
@@ -30752,7 +31106,7 @@ var production_derived_test_cases_default = defineRule({
|
|
|
30752
31106
|
});
|
|
30753
31107
|
|
|
30754
31108
|
// src/rules/repeated-static-call-cases.ts
|
|
30755
|
-
var
|
|
31109
|
+
var NAME127 = "repeated-static-call-cases";
|
|
30756
31110
|
var TEST_MODULES2 = /* @__PURE__ */ new Set(["@jest/globals", "@playwright/test", "bun:test", "node:test", "vitest"]);
|
|
30757
31111
|
var TEST_NAMES3 = /* @__PURE__ */ new Set(["it", "test"]);
|
|
30758
31112
|
var TEST_MODIFIERS5 = /* @__PURE__ */ new Set(["concurrent", "fails", "only", "sequential", "skip"]);
|
|
@@ -30876,7 +31230,7 @@ var repeated_static_call_cases_default = defineRule({
|
|
|
30876
31230
|
type: "suggestion",
|
|
30877
31231
|
docs: {
|
|
30878
31232
|
description: "Review three or more consecutive static-input call assertions as potential named cases.",
|
|
30879
|
-
url: docsUrl(
|
|
31233
|
+
url: docsUrl(NAME127)
|
|
30880
31234
|
},
|
|
30881
31235
|
schema: [],
|
|
30882
31236
|
messages: { repeatedStaticCallCases: "These {{count}} consecutive assertions repeat a call with static inputs. If independent, use named parameterized cases or subtests; preserve ordered scenarios as one test." }
|
|
@@ -31018,7 +31372,7 @@ function isPrimitiveReturn(node, annotation) {
|
|
|
31018
31372
|
}
|
|
31019
31373
|
|
|
31020
31374
|
// src/rules/require-assert-never.ts
|
|
31021
|
-
var
|
|
31375
|
+
var NAME128 = "require-assert-never";
|
|
31022
31376
|
function isRuntimeHandlingStatement(statement) {
|
|
31023
31377
|
if (statement.type === "EmptyStatement") return false;
|
|
31024
31378
|
if (statement.type === "BreakStatement") return statement.label !== null;
|
|
@@ -31078,7 +31432,7 @@ var require_assert_never_default = defineRule({
|
|
|
31078
31432
|
fixable: "code",
|
|
31079
31433
|
docs: {
|
|
31080
31434
|
description: "Require an empty switch default to call `assertNever` so discriminated unions remain exhaustive at compile time.",
|
|
31081
|
-
url: docsUrl(
|
|
31435
|
+
url: docsUrl(NAME128)
|
|
31082
31436
|
},
|
|
31083
31437
|
schema: [],
|
|
31084
31438
|
messages: {
|
|
@@ -31122,7 +31476,7 @@ var require_assert_never_default = defineRule({
|
|
|
31122
31476
|
});
|
|
31123
31477
|
|
|
31124
31478
|
// src/rules/require-button-accessible-name.ts
|
|
31125
|
-
var
|
|
31479
|
+
var NAME129 = "require-button-accessible-name";
|
|
31126
31480
|
var DELEGATING_PROPS = /* @__PURE__ */ new Set(["render", "asChild"]);
|
|
31127
31481
|
function delegatesRendering(opening) {
|
|
31128
31482
|
return opening.attributes.some(
|
|
@@ -31135,7 +31489,7 @@ var require_button_accessible_name_default = defineRule({
|
|
|
31135
31489
|
type: "problem",
|
|
31136
31490
|
docs: {
|
|
31137
31491
|
description: "Require an accessible name on statically unnamed native or configured JSX buttons.",
|
|
31138
|
-
url: docsUrl(
|
|
31492
|
+
url: docsUrl(NAME129)
|
|
31139
31493
|
},
|
|
31140
31494
|
schema: [
|
|
31141
31495
|
{
|
|
@@ -31189,7 +31543,7 @@ var require_button_accessible_name_default = defineRule({
|
|
|
31189
31543
|
});
|
|
31190
31544
|
|
|
31191
31545
|
// src/rules/require-camelcase-properties.ts
|
|
31192
|
-
var
|
|
31546
|
+
var NAME130 = "require-camelcase-properties";
|
|
31193
31547
|
var SNAKE_CASE_RE2 = /^[a-z][a-z0-9]*(?:_[a-z0-9]+)+$/u;
|
|
31194
31548
|
function blocksRename(member3, name) {
|
|
31195
31549
|
if (member3.type === "TSIndexSignature" || "computed" in member3 && member3.computed) return true;
|
|
@@ -31203,7 +31557,7 @@ var require_camelcase_properties_default = defineRule({
|
|
|
31203
31557
|
fixable: "code",
|
|
31204
31558
|
docs: {
|
|
31205
31559
|
description: "Require unquoted lower snake_case TypeScript properties and dot access to use camelCase.",
|
|
31206
|
-
url: docsUrl(
|
|
31560
|
+
url: docsUrl(NAME130)
|
|
31207
31561
|
},
|
|
31208
31562
|
schema: [],
|
|
31209
31563
|
defaultOptions: [],
|
|
@@ -31267,7 +31621,7 @@ var require_camelcase_properties_default = defineRule({
|
|
|
31267
31621
|
});
|
|
31268
31622
|
|
|
31269
31623
|
// src/rules/require-constrained-schema-integer.ts
|
|
31270
|
-
var
|
|
31624
|
+
var NAME131 = "require-constrained-schema-integer";
|
|
31271
31625
|
var FIELD_MINIMUMS = /* @__PURE__ */ new Map([["limit", 1], ["version", 0]]);
|
|
31272
31626
|
var NUMBER_FACTORIES = /* @__PURE__ */ new Set(["number", "int", "int32", "uint32"]);
|
|
31273
31627
|
var OBJECT_FACTORIES = /* @__PURE__ */ new Set(["object", "strictObject", "looseObject"]);
|
|
@@ -31309,7 +31663,7 @@ var require_constrained_schema_integer_default = defineRule({
|
|
|
31309
31663
|
type: "suggestion",
|
|
31310
31664
|
docs: {
|
|
31311
31665
|
description: "Declare integer and lower-bound validation for numeric limit and version schema fields.",
|
|
31312
|
-
url: docsUrl(
|
|
31666
|
+
url: docsUrl(NAME131)
|
|
31313
31667
|
},
|
|
31314
31668
|
schema: [],
|
|
31315
31669
|
messages: { constrainInteger: "Declare `{{field}}` as an integer with a lower bound of {{minimum}} or greater, or reuse its named domain schema." }
|
|
@@ -31788,14 +32142,14 @@ function closedNominalInheritanceFix(sourceCode2, file, call, consumer, implemen
|
|
|
31788
32142
|
}
|
|
31789
32143
|
|
|
31790
32144
|
// src/rules/require-explicit-contract-implementation.ts
|
|
31791
|
-
var
|
|
32145
|
+
var NAME132 = "require-explicit-contract-implementation";
|
|
31792
32146
|
var require_explicit_contract_implementation_default = defineRule({
|
|
31793
32147
|
meta: {
|
|
31794
32148
|
type: "problem",
|
|
31795
32149
|
fixable: "code",
|
|
31796
32150
|
docs: {
|
|
31797
32151
|
description: "Require nominal inheritance when an injected abstract class is rejected by an instanceof guard.",
|
|
31798
|
-
url: docsUrl(
|
|
32152
|
+
url: docsUrl(NAME132)
|
|
31799
32153
|
},
|
|
31800
32154
|
schema: [],
|
|
31801
32155
|
messages: {
|
|
@@ -32486,7 +32840,7 @@ function abstractContractOperations(node, functionAliases) {
|
|
|
32486
32840
|
}
|
|
32487
32841
|
|
|
32488
32842
|
// src/rules/require-explicit-service-contract.ts
|
|
32489
|
-
var
|
|
32843
|
+
var NAME133 = "require-explicit-service-contract";
|
|
32490
32844
|
var JAVASCRIPT_FILE_RE2 = /\.(?:js|jsx|mjs|cjs)$/iu;
|
|
32491
32845
|
var BOUNDARY_SUFFIX = /(?:Service|ServiceImpl|Store|Repository|Provider|Executor|Enqueuer|Runner|Platform|Manager|ManagerImpl|Detector|Control|Refresher|Reader|Settlement|Retry|Stop|Catalog|DAO)$/u;
|
|
32492
32846
|
var NON_SERVICE_SUFFIX = /(?:Router|Middleware|Builder)$/u;
|
|
@@ -32502,7 +32856,7 @@ var require_explicit_service_contract_default = defineRule({
|
|
|
32502
32856
|
type: "problem",
|
|
32503
32857
|
docs: {
|
|
32504
32858
|
description: "Require explicit contracts for classes that invoke retained collaborators.",
|
|
32505
|
-
url: docsUrl(
|
|
32859
|
+
url: docsUrl(NAME133)
|
|
32506
32860
|
},
|
|
32507
32861
|
schema: [],
|
|
32508
32862
|
fixable: "code",
|
|
@@ -32538,7 +32892,7 @@ var require_explicit_service_contract_default = defineRule({
|
|
|
32538
32892
|
});
|
|
32539
32893
|
|
|
32540
32894
|
// src/rules/require-fetch-timeout.ts
|
|
32541
|
-
var
|
|
32895
|
+
var NAME134 = "require-fetch-timeout";
|
|
32542
32896
|
function emptySignal(expression, resolvesToGlobal) {
|
|
32543
32897
|
const value = unwrapExpression(expression);
|
|
32544
32898
|
if (value.type === "Literal" && value.value === null)
|
|
@@ -32600,7 +32954,7 @@ var require_fetch_timeout_default = defineRule({
|
|
|
32600
32954
|
type: "problem",
|
|
32601
32955
|
docs: {
|
|
32602
32956
|
description: "Require an explicit abort signal on locally analyzable global fetch calls.",
|
|
32603
|
-
url: docsUrl(
|
|
32957
|
+
url: docsUrl(NAME134)
|
|
32604
32958
|
},
|
|
32605
32959
|
schema: [
|
|
32606
32960
|
{
|
|
@@ -32692,7 +33046,7 @@ var require_fetch_timeout_default = defineRule({
|
|
|
32692
33046
|
});
|
|
32693
33047
|
|
|
32694
33048
|
// src/rules/require-interface-for-exported-class.ts
|
|
32695
|
-
var
|
|
33049
|
+
var NAME135 = "require-interface-for-exported-class";
|
|
32696
33050
|
var JAVASCRIPT_FILE_RE3 = /\.(?:js|jsx|mjs|cjs)$/iu;
|
|
32697
33051
|
function isPublicInstanceMember2(member3) {
|
|
32698
33052
|
return !member3.static && member3.accessibility !== "private" && member3.accessibility !== "protected" && member3.key.type !== "PrivateIdentifier";
|
|
@@ -32753,7 +33107,7 @@ var require_interface_for_exported_class_default = defineRule({
|
|
|
32753
33107
|
type: "suggestion",
|
|
32754
33108
|
docs: {
|
|
32755
33109
|
description: "Require exported concrete classes with public behavior to declare a contract.",
|
|
32756
|
-
url: docsUrl(
|
|
33110
|
+
url: docsUrl(NAME135)
|
|
32757
33111
|
},
|
|
32758
33112
|
schema: [],
|
|
32759
33113
|
fixable: "code",
|
|
@@ -32795,7 +33149,7 @@ var require_interface_for_exported_class_default = defineRule({
|
|
|
32795
33149
|
});
|
|
32796
33150
|
|
|
32797
33151
|
// src/rules/require-jwt-lifetime.ts
|
|
32798
|
-
var
|
|
33152
|
+
var NAME136 = "require-jwt-lifetime";
|
|
32799
33153
|
function isJoseValueImport(declaration) {
|
|
32800
33154
|
return declaration.type === "ImportDeclaration" && declaration.importKind !== "type" && declaration.source.value === "jose";
|
|
32801
33155
|
}
|
|
@@ -32804,7 +33158,7 @@ var require_jwt_lifetime_default = defineRule({
|
|
|
32804
33158
|
type: "problem",
|
|
32805
33159
|
docs: {
|
|
32806
33160
|
description: "Require an expiration claim or a maximum token age when returning a verified JWT.",
|
|
32807
|
-
url: docsUrl(
|
|
33161
|
+
url: docsUrl(NAME136)
|
|
32808
33162
|
},
|
|
32809
33163
|
schema: [],
|
|
32810
33164
|
messages: { lifetime: "Require the JWT exp claim or set maxTokenAge before returning this verification result." }
|
|
@@ -32863,7 +33217,7 @@ var require_jwt_lifetime_default = defineRule({
|
|
|
32863
33217
|
});
|
|
32864
33218
|
|
|
32865
33219
|
// src/rules/require-pascal-case-zod-schema-name.ts
|
|
32866
|
-
var
|
|
33220
|
+
var NAME137 = "require-pascal-case-zod-schema-name";
|
|
32867
33221
|
var PASCAL_SCHEMA_NAME_RE = /^[A-Z][A-Za-z0-9]*Schema$/;
|
|
32868
33222
|
var BENCHMARK_PATH_RE2 = /(^|[\\/])(?:benchmarks?|bench)[\\/]/;
|
|
32869
33223
|
var NON_SCHEMA_TERMINALS2 = /* @__PURE__ */ new Set([
|
|
@@ -33034,7 +33388,7 @@ var require_pascal_case_zod_schema_name_default = defineRule({
|
|
|
33034
33388
|
fixable: "code",
|
|
33035
33389
|
docs: {
|
|
33036
33390
|
description: "Require confirmed module-level Zod schema contracts to use PascalCase with a `Schema` suffix.",
|
|
33037
|
-
url: docsUrl(
|
|
33391
|
+
url: docsUrl(NAME137)
|
|
33038
33392
|
},
|
|
33039
33393
|
schema: [],
|
|
33040
33394
|
defaultOptions: [],
|
|
@@ -33144,7 +33498,7 @@ var require_pascal_case_zod_schema_name_default = defineRule({
|
|
|
33144
33498
|
});
|
|
33145
33499
|
|
|
33146
33500
|
// src/rules/require-port-for-service.ts
|
|
33147
|
-
var
|
|
33501
|
+
var NAME138 = "require-port-for-service";
|
|
33148
33502
|
var HTTP_TRANSPORT_TYPE_RE = /^(?:KyInstance|AxiosInstance|Session)$/;
|
|
33149
33503
|
var TRANSPORT_WRAPPER_NAME_RE = /(?:Client$|^Http[A-Z])/;
|
|
33150
33504
|
var ERROR_VALUE_NAME_RE = /Error$/;
|
|
@@ -33278,7 +33632,7 @@ var require_port_for_service_default = defineRule({
|
|
|
33278
33632
|
type: "suggestion",
|
|
33279
33633
|
docs: {
|
|
33280
33634
|
description: "Advise when an exported service with injected collaborators has public methods not covered by its declared ports.",
|
|
33281
|
-
url: docsUrl(
|
|
33635
|
+
url: docsUrl(NAME138)
|
|
33282
33636
|
},
|
|
33283
33637
|
schema: [],
|
|
33284
33638
|
fixable: "code",
|
|
@@ -33318,7 +33672,7 @@ var require_port_for_service_default = defineRule({
|
|
|
33318
33672
|
});
|
|
33319
33673
|
|
|
33320
33674
|
// src/rules/require-sql-access-class.ts
|
|
33321
|
-
var
|
|
33675
|
+
var NAME139 = "require-sql-access-class";
|
|
33322
33676
|
var DIRECT_EXECUTION_METHODS = /* @__PURE__ */ new Set([
|
|
33323
33677
|
"all",
|
|
33324
33678
|
"batch",
|
|
@@ -33516,7 +33870,7 @@ var require_sql_access_class_default = defineRule({
|
|
|
33516
33870
|
type: "suggestion",
|
|
33517
33871
|
docs: {
|
|
33518
33872
|
description: "Keep SQL reads and writes inside a class that receives its database dependency.",
|
|
33519
|
-
url: docsUrl(
|
|
33873
|
+
url: docsUrl(NAME139)
|
|
33520
33874
|
},
|
|
33521
33875
|
schema: [],
|
|
33522
33876
|
messages: {
|
|
@@ -33588,7 +33942,7 @@ function staticMatcherFix(sourceCode2, property) {
|
|
|
33588
33942
|
}
|
|
33589
33943
|
|
|
33590
33944
|
// src/rules/require-static-next-matcher.ts
|
|
33591
|
-
var
|
|
33945
|
+
var NAME140 = "require-static-next-matcher";
|
|
33592
33946
|
var NEXT_ENTRY_FILE = /(?:^|[/\\])(?:middleware|proxy)\.[cm]?[jt]sx?$/u;
|
|
33593
33947
|
function isStaticValue(node) {
|
|
33594
33948
|
const value = unwrapExpression(node);
|
|
@@ -33620,7 +33974,7 @@ var require_static_next_matcher_default = defineRule({
|
|
|
33620
33974
|
fixable: "code",
|
|
33621
33975
|
docs: {
|
|
33622
33976
|
description: "Require Next.js middleware and proxy matcher configuration to contain only build-time literals.",
|
|
33623
|
-
url: docsUrl(
|
|
33977
|
+
url: docsUrl(NAME140)
|
|
33624
33978
|
},
|
|
33625
33979
|
schema: [],
|
|
33626
33980
|
messages: {
|
|
@@ -33664,7 +34018,7 @@ var require_static_next_matcher_default = defineRule({
|
|
|
33664
34018
|
});
|
|
33665
34019
|
|
|
33666
34020
|
// src/rules/require-svg-accessible-name.ts
|
|
33667
|
-
var
|
|
34021
|
+
var NAME141 = "require-svg-accessible-name";
|
|
33668
34022
|
var DECORATIVE_ROLES = /* @__PURE__ */ new Set(["none", "presentation"]);
|
|
33669
34023
|
var NAME_ATTRIBUTES = ["aria-label", "aria-labelledby"];
|
|
33670
34024
|
var NO_ICON_MODULES = [];
|
|
@@ -33673,7 +34027,7 @@ var require_svg_accessible_name_default = defineRule({
|
|
|
33673
34027
|
type: "problem",
|
|
33674
34028
|
docs: {
|
|
33675
34029
|
description: "Require a name or explicit decorative semantics on inline SVG elements.",
|
|
33676
|
-
url: docsUrl(
|
|
34030
|
+
url: docsUrl(NAME141)
|
|
33677
34031
|
},
|
|
33678
34032
|
schema: [],
|
|
33679
34033
|
messages: {
|
|
@@ -33705,7 +34059,7 @@ var require_svg_accessible_name_default = defineRule({
|
|
|
33705
34059
|
});
|
|
33706
34060
|
|
|
33707
34061
|
// src/rules/require-use-form-default-values.ts
|
|
33708
|
-
var
|
|
34062
|
+
var NAME142 = "require-use-form-default-values";
|
|
33709
34063
|
var UNSAFE_FORM_MEMBERS = /* @__PURE__ */ new Set(["__defineGetter__", "__defineSetter__", "__proto__", "valueOf"]);
|
|
33710
34064
|
function staticPropertyName2(property) {
|
|
33711
34065
|
return property.computed ? null : getPropertyName(property);
|
|
@@ -33748,7 +34102,7 @@ var require_use_form_default_values_default = defineRule({
|
|
|
33748
34102
|
type: "problem",
|
|
33749
34103
|
docs: {
|
|
33750
34104
|
description: "Require explicit form-level initialization or a field default for directly bound Controller fields.",
|
|
33751
|
-
url: docsUrl(
|
|
34105
|
+
url: docsUrl(NAME142)
|
|
33752
34106
|
},
|
|
33753
34107
|
schema: [],
|
|
33754
34108
|
messages: { requireUseFormDefaultValues: "Add non-undefined defaultValues/values to the associated useForm call or non-undefined defaultValue to this field." }
|
|
@@ -33887,7 +34241,7 @@ var require_use_form_default_values_default = defineRule({
|
|
|
33887
34241
|
});
|
|
33888
34242
|
|
|
33889
34243
|
// src/rules/require-use-server-in-actions-file.ts
|
|
33890
|
-
var
|
|
34244
|
+
var NAME143 = "require-use-server-in-actions-file";
|
|
33891
34245
|
var ACTION_MODULE_RE = /(?:^|\/)app\/.*\/(?:actions|[^/]+-actions)\.[cm]?[jt]s$/u;
|
|
33892
34246
|
function isUseServerDirective2(statement) {
|
|
33893
34247
|
return statement.type === "ExpressionStatement" && statement.directive === "use server";
|
|
@@ -33908,7 +34262,7 @@ var require_use_server_in_actions_file_default = defineRule({
|
|
|
33908
34262
|
type: "problem",
|
|
33909
34263
|
docs: {
|
|
33910
34264
|
description: "route action module missing the use server directive",
|
|
33911
|
-
url: docsUrl(
|
|
34265
|
+
url: docsUrl(NAME143)
|
|
33912
34266
|
},
|
|
33913
34267
|
schema: [],
|
|
33914
34268
|
messages: {
|
|
@@ -33934,7 +34288,7 @@ var require_use_server_in_actions_file_default = defineRule({
|
|
|
33934
34288
|
});
|
|
33935
34289
|
|
|
33936
34290
|
// src/rules/require-zod-form-validation.ts
|
|
33937
|
-
var
|
|
34291
|
+
var NAME144 = "require-zod-form-validation";
|
|
33938
34292
|
var ZOD_PARSE_METHODS = /* @__PURE__ */ new Set([
|
|
33939
34293
|
"parse",
|
|
33940
34294
|
"safeParse",
|
|
@@ -33993,7 +34347,7 @@ var require_zod_form_validation_default = defineRule({
|
|
|
33993
34347
|
type: "problem",
|
|
33994
34348
|
docs: {
|
|
33995
34349
|
description: "Require Zod validation (`Schema.parse(...)` / `Schema.safeParse(...)`) when reading values out of a `FormData` object.",
|
|
33996
|
-
url: docsUrl(
|
|
34350
|
+
url: docsUrl(NAME144)
|
|
33997
34351
|
},
|
|
33998
34352
|
schema: [],
|
|
33999
34353
|
messages: {
|
|
@@ -34281,7 +34635,7 @@ function declaresFramework(metadata, name) {
|
|
|
34281
34635
|
}
|
|
34282
34636
|
|
|
34283
34637
|
// src/rules/sole-export-matches-filename.ts
|
|
34284
|
-
var
|
|
34638
|
+
var NAME145 = "sole-export-matches-filename";
|
|
34285
34639
|
var EXCLUDED_STEMS = /* @__PURE__ */ new Set(["global", "index", "types"]);
|
|
34286
34640
|
function stem3(filename) {
|
|
34287
34641
|
const base = filename.replaceAll("\\", "/").split("/").at(-1) ?? "";
|
|
@@ -34295,7 +34649,7 @@ var sole_export_matches_filename_default = defineRule({
|
|
|
34295
34649
|
type: "suggestion",
|
|
34296
34650
|
docs: {
|
|
34297
34651
|
description: "Make a module filename reflect its sole named public runtime export.",
|
|
34298
|
-
url: docsUrl(
|
|
34652
|
+
url: docsUrl(NAME145)
|
|
34299
34653
|
},
|
|
34300
34654
|
schema: [],
|
|
34301
34655
|
messages: {
|
|
@@ -35038,7 +35392,7 @@ var stepdown_default = defineRule({
|
|
|
35038
35392
|
});
|
|
35039
35393
|
|
|
35040
35394
|
// src/rules/store-insert-requires-on-conflict.ts
|
|
35041
|
-
var
|
|
35395
|
+
var NAME146 = "store-insert-requires-on-conflict";
|
|
35042
35396
|
var INSERT_WRITE = /\bINSERT\s+(?:OR\s+\w+\s+)?INTO\s+[\w."'`?$:@-]+\s*(?:\([^)]*\)\s*)?(?:VALUES|SELECT|DEFAULT\s+VALUES)\b/i;
|
|
35043
35397
|
var CONFLICT_HANDLED = /\bON\s+CONFLICT\b|\bON\s+DUPLICATE\s+KEY\b|\bINSERT\s+OR\s+(?:IGNORE|REPLACE)\b|\bINSERT\b[\s\S]*?\bSELECT\b[\s\S]*?\bWHERE\s+NOT\s+EXISTS\b/i;
|
|
35044
35398
|
var REPLAY_CONTRACT_NAME = /(?:enqueue|ensure|migrate|recordOnce|schedule|seed|upsert|getOrCreate|createIfAbsent|insertIfAbsent)/i;
|
|
@@ -35067,7 +35421,7 @@ var store_insert_requires_on_conflict_default = defineRule({
|
|
|
35067
35421
|
type: "problem",
|
|
35068
35422
|
docs: {
|
|
35069
35423
|
description: "Review conflict handling for embedded inserts in replay-named callables.",
|
|
35070
|
-
url: docsUrl(
|
|
35424
|
+
url: docsUrl(NAME146)
|
|
35071
35425
|
},
|
|
35072
35426
|
schema: [],
|
|
35073
35427
|
messages: {
|
|
@@ -35092,7 +35446,7 @@ var store_insert_requires_on_conflict_default = defineRule({
|
|
|
35092
35446
|
});
|
|
35093
35447
|
|
|
35094
35448
|
// src/rules/test-loops-over-literal-cases.ts
|
|
35095
|
-
var
|
|
35449
|
+
var NAME147 = "test-loops-over-literal-cases";
|
|
35096
35450
|
var TEST_CALLERS3 = /* @__PURE__ */ new Set(["it", "test"]);
|
|
35097
35451
|
var TEST_MODIFIERS6 = /* @__PURE__ */ new Set(["concurrent", "fails", "only", "sequential", "skip"]);
|
|
35098
35452
|
var ASSERTION_ROOTS = /* @__PURE__ */ new Set([
|
|
@@ -35188,7 +35542,7 @@ var test_loops_over_literal_cases_default = defineRule({
|
|
|
35188
35542
|
type: "suggestion",
|
|
35189
35543
|
docs: {
|
|
35190
35544
|
description: "Disallow assertions over an inline literal case loop in a test; parameterization reports and names every case independently.",
|
|
35191
|
-
url: docsUrl(
|
|
35545
|
+
url: docsUrl(NAME147)
|
|
35192
35546
|
},
|
|
35193
35547
|
schema: [],
|
|
35194
35548
|
messages: {
|
|
@@ -35252,7 +35606,7 @@ var test_loops_over_literal_cases_default = defineRule({
|
|
|
35252
35606
|
});
|
|
35253
35607
|
|
|
35254
35608
|
// src/rules/test-phase-label-comment.ts
|
|
35255
|
-
var
|
|
35609
|
+
var NAME148 = "test-phase-label-comment";
|
|
35256
35610
|
var PHASE_WORD = String.raw`arrange|act|assert(?:ion)?s?|given|when|then|exercise|execute|verif(?:y|ication)|cleanup|prepare|sanity(?:\s+check)?`;
|
|
35257
35611
|
var PHASE_RE = new RegExp(
|
|
35258
35612
|
String.raw`^[-=~*_#.\s]{0,40}(?:${PHASE_WORD})(?:\s*(?:[/&+,|]|->|and)\s*(?:${PHASE_WORD}))*[-=~*_#.\s:;!–—]{0,40}$`,
|
|
@@ -35280,7 +35634,7 @@ var test_phase_label_comment_default = defineRule({
|
|
|
35280
35634
|
fixable: "code",
|
|
35281
35635
|
docs: {
|
|
35282
35636
|
description: "Tests must not use bare Arrange, Act, Assert, Given, When, or Then phase comments.",
|
|
35283
|
-
url: docsUrl(
|
|
35637
|
+
url: docsUrl(NAME148)
|
|
35284
35638
|
},
|
|
35285
35639
|
schema: [],
|
|
35286
35640
|
messages: { removeLabel: "Bare test phase label \u2014 delete it and let the test names and helpers carry the structure." }
|
|
@@ -35422,6 +35776,7 @@ var RULES = {
|
|
|
35422
35776
|
"no-zod-parse-typed-object": no_zod_parse_typed_object_default,
|
|
35423
35777
|
"prefer-await-in-async-return": prefer_await_in_async_return_default,
|
|
35424
35778
|
"prefer-coded-error-result": prefer_coded_error_result_default,
|
|
35779
|
+
"prefer-configured-cloud-scope": prefer_configured_cloud_scope_default,
|
|
35425
35780
|
"prefer-constant-time-secret-compare": prefer_constant_time_secret_compare_default,
|
|
35426
35781
|
"prefer-dependency-interface": prefer_dependency_interface_default,
|
|
35427
35782
|
"prefer-discriminated-union": prefer_discriminated_union_default,
|