@sarj/eslint-plugin 9.9.0 → 9.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/index.cjs +503 -385
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -5
- package/dist/index.d.ts +13 -5
- package/dist/index.js +499 -381
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -683,6 +683,7 @@ var CODE_KEYWORD_RE = /^(import |export |const |let |var |function\b|class |inte
|
|
|
683
683
|
var CODE_TAIL_RE = /[;{}()]\s*$|=>\s*$|,\s*$/;
|
|
684
684
|
var ASSIGN_RE = /^[A-Za-z_$][\w.$[\]]*\s*(?:=(?![=>])|\+=|-=|\*=)\s*\S.*[;)}\]]\s*$/;
|
|
685
685
|
var CALL_RE = /^[A-Za-z_$][\w.$]*\([^)]*\)\s*;?\s*$/;
|
|
686
|
+
var ASSERTION_CODE_RE = /^(?:await\s+)?(?:expect(?:TypeOf)?\s*\(.+\)\s*(?:\.\w+(?:<[^;()]*>)?)+(?:\s*\(.*\))?|assert(?:\.\w+)?\s*\(.+\))\s*;?\s*$/;
|
|
686
687
|
var PSEUDOCODE_RE = /%\w+%|\[opt\]|(?:^|\s)<[A-Za-z]\w*>|…|\.\.\./;
|
|
687
688
|
function stripCommentMarker(line) {
|
|
688
689
|
return line.replace(/^\s*\/{1,2}/, "").replace(/^\s*\*+/, "").trim();
|
|
@@ -701,6 +702,7 @@ function looksLikeCode(text, allowCall = true) {
|
|
|
701
702
|
if (!t) return false;
|
|
702
703
|
if (CODE_KEYWORD_RE.test(t) && CODE_TAIL_RE.test(t)) return true;
|
|
703
704
|
if (ASSIGN_RE.test(t)) return true;
|
|
705
|
+
if (ASSERTION_CODE_RE.test(t)) return true;
|
|
704
706
|
return allowCall && CALL_RE.test(t);
|
|
705
707
|
}
|
|
706
708
|
function hasPseudocode(text) {
|
|
@@ -6632,8 +6634,121 @@ var prefer_discriminated_union_default = createRule({
|
|
|
6632
6634
|
}
|
|
6633
6635
|
});
|
|
6634
6636
|
|
|
6635
|
-
// src/rules/prefer-
|
|
6637
|
+
// src/rules/prefer-input-group-search.ts
|
|
6636
6638
|
var import_utils48 = require("@typescript-eslint/utils");
|
|
6639
|
+
var INPUT_MODULE = /(?:^|\/)components\/ui\/input$/u;
|
|
6640
|
+
var INPUT_GROUP_MODULE = /(?:^|\/)components\/ui\/input-group$/u;
|
|
6641
|
+
var MAX_JSX_DISTANCE = 2;
|
|
6642
|
+
function localNamedImports(node, importedName) {
|
|
6643
|
+
return node.specifiers.filter(
|
|
6644
|
+
(specifier) => specifier.type === import_utils48.AST_NODE_TYPES.ImportSpecifier && (specifier.imported.type === import_utils48.AST_NODE_TYPES.Identifier ? specifier.imported.name : specifier.imported.value) === importedName
|
|
6645
|
+
).map((specifier) => specifier.local.name);
|
|
6646
|
+
}
|
|
6647
|
+
function elementName(node) {
|
|
6648
|
+
return node.name.type === import_utils48.AST_NODE_TYPES.JSXIdentifier ? node.name.name : null;
|
|
6649
|
+
}
|
|
6650
|
+
function jsxAncestors(occurrence) {
|
|
6651
|
+
return occurrence.ancestors.filter(
|
|
6652
|
+
(ancestor) => ancestor.type === import_utils48.AST_NODE_TYPES.JSXElement
|
|
6653
|
+
);
|
|
6654
|
+
}
|
|
6655
|
+
function isWithinInputGroup(occurrence, inputGroupNames) {
|
|
6656
|
+
return jsxAncestors(occurrence).some(
|
|
6657
|
+
(ancestor) => inputGroupNames.has(elementName(ancestor.openingElement) ?? "")
|
|
6658
|
+
);
|
|
6659
|
+
}
|
|
6660
|
+
function nearestEligibleCommonAncestor(search, input, inputGroupNames) {
|
|
6661
|
+
const searchAncestors = jsxAncestors(search);
|
|
6662
|
+
const inputAncestorList = jsxAncestors(input);
|
|
6663
|
+
const inputAncestors = new Set(inputAncestorList);
|
|
6664
|
+
for (let index = searchAncestors.length - 1; index >= 0; index -= 1) {
|
|
6665
|
+
const ancestor = searchAncestors[index];
|
|
6666
|
+
if (ancestor === void 0) continue;
|
|
6667
|
+
if (!inputAncestors.has(ancestor)) continue;
|
|
6668
|
+
const searchDistance = searchAncestors.length - index - 1;
|
|
6669
|
+
const inputDistance = inputAncestorList.length - inputAncestorList.indexOf(ancestor) - 1;
|
|
6670
|
+
if (searchDistance > MAX_JSX_DISTANCE || inputDistance > MAX_JSX_DISTANCE) {
|
|
6671
|
+
return null;
|
|
6672
|
+
}
|
|
6673
|
+
if (inputGroupNames.has(elementName(ancestor.openingElement) ?? "")) {
|
|
6674
|
+
return null;
|
|
6675
|
+
}
|
|
6676
|
+
return ancestor;
|
|
6677
|
+
}
|
|
6678
|
+
return null;
|
|
6679
|
+
}
|
|
6680
|
+
var prefer_input_group_search_default = createRule({
|
|
6681
|
+
name: "prefer-input-group-search",
|
|
6682
|
+
meta: {
|
|
6683
|
+
type: "suggestion",
|
|
6684
|
+
docs: {
|
|
6685
|
+
description: "Require search icons and shared Input controls in the same visual wrapper to use InputGroup."
|
|
6686
|
+
},
|
|
6687
|
+
schema: [],
|
|
6688
|
+
messages: {
|
|
6689
|
+
preferInputGroup: "Use InputGroup with InputGroupAddon and InputGroupInput for this search field."
|
|
6690
|
+
}
|
|
6691
|
+
},
|
|
6692
|
+
defaultOptions: [],
|
|
6693
|
+
create(context) {
|
|
6694
|
+
const inputNames = /* @__PURE__ */ new Set();
|
|
6695
|
+
const inputGroupNames = /* @__PURE__ */ new Set();
|
|
6696
|
+
const searchNames = /* @__PURE__ */ new Set();
|
|
6697
|
+
const inputs = [];
|
|
6698
|
+
const searches = [];
|
|
6699
|
+
return {
|
|
6700
|
+
ImportDeclaration(node) {
|
|
6701
|
+
const source = String(node.source.value);
|
|
6702
|
+
if (source === "lucide-react") {
|
|
6703
|
+
localNamedImports(node, "Search").forEach(
|
|
6704
|
+
(name) => searchNames.add(name)
|
|
6705
|
+
);
|
|
6706
|
+
} else if (INPUT_MODULE.test(source)) {
|
|
6707
|
+
localNamedImports(node, "Input").forEach(
|
|
6708
|
+
(name) => inputNames.add(name)
|
|
6709
|
+
);
|
|
6710
|
+
} else if (INPUT_GROUP_MODULE.test(source)) {
|
|
6711
|
+
localNamedImports(node, "InputGroup").forEach(
|
|
6712
|
+
(name) => inputGroupNames.add(name)
|
|
6713
|
+
);
|
|
6714
|
+
}
|
|
6715
|
+
},
|
|
6716
|
+
JSXOpeningElement(node) {
|
|
6717
|
+
const name = elementName(node);
|
|
6718
|
+
if (name === null) return;
|
|
6719
|
+
const occurrence = {
|
|
6720
|
+
ancestors: context.sourceCode.getAncestors(node),
|
|
6721
|
+
node
|
|
6722
|
+
};
|
|
6723
|
+
if (searchNames.has(name)) searches.push(occurrence);
|
|
6724
|
+
if (inputNames.has(name)) inputs.push(occurrence);
|
|
6725
|
+
},
|
|
6726
|
+
"Program:exit"() {
|
|
6727
|
+
const reported = /* @__PURE__ */ new Set();
|
|
6728
|
+
for (const search of searches) {
|
|
6729
|
+
if (isWithinInputGroup(search, inputGroupNames)) continue;
|
|
6730
|
+
for (const input of inputs) {
|
|
6731
|
+
if (isWithinInputGroup(input, inputGroupNames)) continue;
|
|
6732
|
+
const wrapper = nearestEligibleCommonAncestor(
|
|
6733
|
+
search,
|
|
6734
|
+
input,
|
|
6735
|
+
inputGroupNames
|
|
6736
|
+
);
|
|
6737
|
+
if (wrapper === null || reported.has(wrapper)) continue;
|
|
6738
|
+
reported.add(wrapper);
|
|
6739
|
+
context.report({
|
|
6740
|
+
node: wrapper.openingElement,
|
|
6741
|
+
messageId: "preferInputGroup"
|
|
6742
|
+
});
|
|
6743
|
+
}
|
|
6744
|
+
}
|
|
6745
|
+
}
|
|
6746
|
+
};
|
|
6747
|
+
}
|
|
6748
|
+
});
|
|
6749
|
+
|
|
6750
|
+
// src/rules/prefer-module-level-constant.ts
|
|
6751
|
+
var import_utils49 = require("@typescript-eslint/utils");
|
|
6637
6752
|
var DEFAULT_MIN_ELEMENTS = 3;
|
|
6638
6753
|
var MAX_LITERAL_DEPTH = 4;
|
|
6639
6754
|
var IGNORE_PATTERNS2 = [
|
|
@@ -6662,9 +6777,9 @@ var MUTATING_METHODS = /* @__PURE__ */ new Set([
|
|
|
6662
6777
|
"assign"
|
|
6663
6778
|
]);
|
|
6664
6779
|
var FUNCTION_TYPES5 = /* @__PURE__ */ new Set([
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6780
|
+
import_utils49.AST_NODE_TYPES.FunctionDeclaration,
|
|
6781
|
+
import_utils49.AST_NODE_TYPES.FunctionExpression,
|
|
6782
|
+
import_utils49.AST_NODE_TYPES.ArrowFunctionExpression
|
|
6668
6783
|
]);
|
|
6669
6784
|
var COLLECTION_CONSTRUCTORS = /* @__PURE__ */ new Set(["Set", "Map"]);
|
|
6670
6785
|
function isIgnoredFile2(filename, sourceText) {
|
|
@@ -6677,14 +6792,14 @@ function isLocalFixtureFile(filename) {
|
|
|
6677
6792
|
return isTestFile(filename) || isStoryFile(filename);
|
|
6678
6793
|
}
|
|
6679
6794
|
function unwrap3(node) {
|
|
6680
|
-
if (node.type ===
|
|
6795
|
+
if (node.type === import_utils49.AST_NODE_TYPES.TSAsExpression || node.type === import_utils49.AST_NODE_TYPES.TSSatisfiesExpression || node.type === import_utils49.AST_NODE_TYPES.TSNonNullExpression) {
|
|
6681
6796
|
return unwrap3(node.expression);
|
|
6682
6797
|
}
|
|
6683
6798
|
return node;
|
|
6684
6799
|
}
|
|
6685
6800
|
var HAS_STATEFUL_FLAG_RE = /[gy]/;
|
|
6686
6801
|
function isRegexLiteral(node) {
|
|
6687
|
-
return node.type ===
|
|
6802
|
+
return node.type === import_utils49.AST_NODE_TYPES.Literal && "regex" in node && node.regex !== void 0;
|
|
6688
6803
|
}
|
|
6689
6804
|
function isLiteralOnly(node, depth) {
|
|
6690
6805
|
if (depth > MAX_LITERAL_DEPTH) {
|
|
@@ -6692,29 +6807,29 @@ function isLiteralOnly(node, depth) {
|
|
|
6692
6807
|
}
|
|
6693
6808
|
const inner = unwrap3(node);
|
|
6694
6809
|
switch (inner.type) {
|
|
6695
|
-
case
|
|
6810
|
+
case import_utils49.AST_NODE_TYPES.Literal: {
|
|
6696
6811
|
return !(isRegexLiteral(inner) && HAS_STATEFUL_FLAG_RE.test(inner.regex.flags));
|
|
6697
6812
|
}
|
|
6698
|
-
case
|
|
6813
|
+
case import_utils49.AST_NODE_TYPES.TemplateLiteral: {
|
|
6699
6814
|
return inner.expressions.length === 0;
|
|
6700
6815
|
}
|
|
6701
|
-
case
|
|
6702
|
-
return (inner.operator === "-" || inner.operator === "+") && inner.argument.type ===
|
|
6816
|
+
case import_utils49.AST_NODE_TYPES.UnaryExpression: {
|
|
6817
|
+
return (inner.operator === "-" || inner.operator === "+") && inner.argument.type === import_utils49.AST_NODE_TYPES.Literal && typeof inner.argument.value === "number";
|
|
6703
6818
|
}
|
|
6704
|
-
case
|
|
6819
|
+
case import_utils49.AST_NODE_TYPES.ArrayExpression: {
|
|
6705
6820
|
return inner.elements.every(
|
|
6706
|
-
(el) => el !== null && el.type !==
|
|
6821
|
+
(el) => el !== null && el.type !== import_utils49.AST_NODE_TYPES.SpreadElement && isLiteralOnly(el, depth + 1)
|
|
6707
6822
|
);
|
|
6708
6823
|
}
|
|
6709
|
-
case
|
|
6824
|
+
case import_utils49.AST_NODE_TYPES.ObjectExpression: {
|
|
6710
6825
|
return inner.properties.every((prop) => {
|
|
6711
|
-
if (prop.type !==
|
|
6826
|
+
if (prop.type !== import_utils49.AST_NODE_TYPES.Property) {
|
|
6712
6827
|
return false;
|
|
6713
6828
|
}
|
|
6714
6829
|
if (prop.shorthand || prop.method || prop.kind !== "init") {
|
|
6715
6830
|
return false;
|
|
6716
6831
|
}
|
|
6717
|
-
if (prop.computed && prop.key.type !==
|
|
6832
|
+
if (prop.computed && prop.key.type !== import_utils49.AST_NODE_TYPES.Literal) {
|
|
6718
6833
|
return false;
|
|
6719
6834
|
}
|
|
6720
6835
|
return isLiteralOnly(prop.value, depth + 1);
|
|
@@ -6727,7 +6842,7 @@ function isLiteralOnly(node, depth) {
|
|
|
6727
6842
|
}
|
|
6728
6843
|
function unwrapObjectFreeze(node) {
|
|
6729
6844
|
const inner = unwrap3(node);
|
|
6730
|
-
if (inner.type ===
|
|
6845
|
+
if (inner.type === import_utils49.AST_NODE_TYPES.CallExpression && inner.callee.type === import_utils49.AST_NODE_TYPES.MemberExpression && !inner.callee.computed && inner.callee.object.type === import_utils49.AST_NODE_TYPES.Identifier && inner.callee.object.name === "Object" && inner.callee.property.type === import_utils49.AST_NODE_TYPES.Identifier && inner.callee.property.name === "freeze" && inner.arguments.length === 1 && inner.arguments[0] !== void 0 && inner.arguments[0].type !== import_utils49.AST_NODE_TYPES.SpreadElement) {
|
|
6731
6846
|
return unwrap3(inner.arguments[0]);
|
|
6732
6847
|
}
|
|
6733
6848
|
return inner;
|
|
@@ -6743,19 +6858,19 @@ function classify(init, checkRegex) {
|
|
|
6743
6858
|
}
|
|
6744
6859
|
return { kind: "regex", size: 1 };
|
|
6745
6860
|
}
|
|
6746
|
-
if (node.type ===
|
|
6861
|
+
if (node.type === import_utils49.AST_NODE_TYPES.ArrayExpression) {
|
|
6747
6862
|
return isLiteralOnly(node, 0) ? { kind: "array", size: node.elements.length } : null;
|
|
6748
6863
|
}
|
|
6749
|
-
if (node.type ===
|
|
6864
|
+
if (node.type === import_utils49.AST_NODE_TYPES.ObjectExpression) {
|
|
6750
6865
|
return isLiteralOnly(node, 0) ? { kind: "object", size: node.properties.length } : null;
|
|
6751
6866
|
}
|
|
6752
|
-
if (node.type ===
|
|
6867
|
+
if (node.type === import_utils49.AST_NODE_TYPES.NewExpression && node.callee.type === import_utils49.AST_NODE_TYPES.Identifier && COLLECTION_CONSTRUCTORS.has(node.callee.name)) {
|
|
6753
6868
|
const arg = node.arguments[0];
|
|
6754
|
-
if (node.arguments.length !== 1 || arg === void 0 || arg.type ===
|
|
6869
|
+
if (node.arguments.length !== 1 || arg === void 0 || arg.type === import_utils49.AST_NODE_TYPES.SpreadElement) {
|
|
6755
6870
|
return null;
|
|
6756
6871
|
}
|
|
6757
6872
|
const entries = unwrap3(arg);
|
|
6758
|
-
if (entries.type !==
|
|
6873
|
+
if (entries.type !== import_utils49.AST_NODE_TYPES.ArrayExpression) {
|
|
6759
6874
|
return null;
|
|
6760
6875
|
}
|
|
6761
6876
|
return isLiteralOnly(entries, 0) ? { kind: node.callee.name === "Set" ? "Set" : "Map", size: entries.elements.length } : null;
|
|
@@ -6784,10 +6899,10 @@ var NON_RETAINING_BUILTINS = /* @__PURE__ */ new Map(
|
|
|
6784
6899
|
);
|
|
6785
6900
|
function isNonRetainingBuiltinCall(node, argument) {
|
|
6786
6901
|
const callee = node.callee;
|
|
6787
|
-
if (callee.type ===
|
|
6902
|
+
if (callee.type === import_utils49.AST_NODE_TYPES.Identifier && callee.name === "structuredClone") {
|
|
6788
6903
|
return true;
|
|
6789
6904
|
}
|
|
6790
|
-
if (callee.type !==
|
|
6905
|
+
if (callee.type !== import_utils49.AST_NODE_TYPES.MemberExpression || callee.computed || callee.object.type !== import_utils49.AST_NODE_TYPES.Identifier || callee.property.type !== import_utils49.AST_NODE_TYPES.Identifier) {
|
|
6791
6906
|
return false;
|
|
6792
6907
|
}
|
|
6793
6908
|
const members = NON_RETAINING_BUILTINS.get(callee.object.name);
|
|
@@ -6801,38 +6916,38 @@ function isNonRetainingBuiltinCall(node, argument) {
|
|
|
6801
6916
|
}
|
|
6802
6917
|
function isSafeRead(identifier) {
|
|
6803
6918
|
const parent = identifier.parent;
|
|
6804
|
-
if (parent.type ===
|
|
6919
|
+
if (parent.type === import_utils49.AST_NODE_TYPES.MemberExpression) {
|
|
6805
6920
|
if (parent.object !== identifier) {
|
|
6806
6921
|
return true;
|
|
6807
6922
|
}
|
|
6808
6923
|
const grandparent = parent.parent;
|
|
6809
|
-
if (grandparent.type ===
|
|
6924
|
+
if (grandparent.type === import_utils49.AST_NODE_TYPES.AssignmentExpression && grandparent.left === parent) {
|
|
6810
6925
|
return false;
|
|
6811
6926
|
}
|
|
6812
|
-
if (grandparent.type ===
|
|
6927
|
+
if (grandparent.type === import_utils49.AST_NODE_TYPES.UpdateExpression) {
|
|
6813
6928
|
return false;
|
|
6814
6929
|
}
|
|
6815
|
-
if (grandparent.type ===
|
|
6930
|
+
if (grandparent.type === import_utils49.AST_NODE_TYPES.UnaryExpression && grandparent.operator === "delete") {
|
|
6816
6931
|
return false;
|
|
6817
6932
|
}
|
|
6818
|
-
if (!parent.computed && parent.property.type ===
|
|
6933
|
+
if (!parent.computed && parent.property.type === import_utils49.AST_NODE_TYPES.Identifier && MUTATING_METHODS.has(parent.property.name) && grandparent.type === import_utils49.AST_NODE_TYPES.CallExpression && grandparent.callee === parent) {
|
|
6819
6934
|
return false;
|
|
6820
6935
|
}
|
|
6821
6936
|
return true;
|
|
6822
6937
|
}
|
|
6823
|
-
if (parent.type ===
|
|
6938
|
+
if (parent.type === import_utils49.AST_NODE_TYPES.ForOfStatement && parent.right === identifier) {
|
|
6824
6939
|
return true;
|
|
6825
6940
|
}
|
|
6826
|
-
if (parent.type ===
|
|
6941
|
+
if (parent.type === import_utils49.AST_NODE_TYPES.SpreadElement) {
|
|
6827
6942
|
return true;
|
|
6828
6943
|
}
|
|
6829
|
-
if (parent.type ===
|
|
6944
|
+
if (parent.type === import_utils49.AST_NODE_TYPES.BinaryExpression) {
|
|
6830
6945
|
return true;
|
|
6831
6946
|
}
|
|
6832
|
-
if (parent.type ===
|
|
6947
|
+
if (parent.type === import_utils49.AST_NODE_TYPES.CallExpression && parent.arguments.includes(identifier) && isNonRetainingBuiltinCall(parent, identifier)) {
|
|
6833
6948
|
return true;
|
|
6834
6949
|
}
|
|
6835
|
-
if (parent.type ===
|
|
6950
|
+
if (parent.type === import_utils49.AST_NODE_TYPES.UnaryExpression && parent.operator !== "delete") {
|
|
6836
6951
|
return true;
|
|
6837
6952
|
}
|
|
6838
6953
|
return false;
|
|
@@ -6887,7 +7002,7 @@ var prefer_module_level_constant_default = createRule({
|
|
|
6887
7002
|
if (reference.isWrite()) {
|
|
6888
7003
|
return false;
|
|
6889
7004
|
}
|
|
6890
|
-
if (reference.identifier.type !==
|
|
7005
|
+
if (reference.identifier.type !== import_utils49.AST_NODE_TYPES.Identifier) {
|
|
6891
7006
|
return false;
|
|
6892
7007
|
}
|
|
6893
7008
|
if (!isSafeRead(reference.identifier)) {
|
|
@@ -6899,10 +7014,10 @@ var prefer_module_level_constant_default = createRule({
|
|
|
6899
7014
|
return {
|
|
6900
7015
|
VariableDeclarator(node) {
|
|
6901
7016
|
const declaration = node.parent;
|
|
6902
|
-
if (declaration.type !==
|
|
7017
|
+
if (declaration.type !== import_utils49.AST_NODE_TYPES.VariableDeclaration || declaration.kind !== "const" || declaration.declare === true) {
|
|
6903
7018
|
return;
|
|
6904
7019
|
}
|
|
6905
|
-
if (node.id.type !==
|
|
7020
|
+
if (node.id.type !== import_utils49.AST_NODE_TYPES.Identifier || node.init === null) {
|
|
6906
7021
|
return;
|
|
6907
7022
|
}
|
|
6908
7023
|
if (enclosingFunction2(node) === null) {
|
|
@@ -6929,7 +7044,7 @@ var prefer_module_level_constant_default = createRule({
|
|
|
6929
7044
|
});
|
|
6930
7045
|
|
|
6931
7046
|
// src/rules/prefer-module-level-schema.ts
|
|
6932
|
-
var
|
|
7047
|
+
var import_utils50 = require("@typescript-eslint/utils");
|
|
6933
7048
|
|
|
6934
7049
|
// src/rules/_zod.ts
|
|
6935
7050
|
var ZOD_PREFIX_RE = /^Z[A-Z]/;
|
|
@@ -6995,9 +7110,9 @@ var I18N_RECEIVER_NAMES = /* @__PURE__ */ new Set([
|
|
|
6995
7110
|
"intl"
|
|
6996
7111
|
]);
|
|
6997
7112
|
var FUNCTION_TYPES6 = /* @__PURE__ */ new Set([
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7113
|
+
import_utils50.AST_NODE_TYPES.ArrowFunctionExpression,
|
|
7114
|
+
import_utils50.AST_NODE_TYPES.FunctionDeclaration,
|
|
7115
|
+
import_utils50.AST_NODE_TYPES.FunctionExpression
|
|
7001
7116
|
]);
|
|
7002
7117
|
function schemaExpression(node) {
|
|
7003
7118
|
let current = node;
|
|
@@ -7006,10 +7121,10 @@ function schemaExpression(node) {
|
|
|
7006
7121
|
if (parent === void 0) {
|
|
7007
7122
|
return current;
|
|
7008
7123
|
}
|
|
7009
|
-
if (parent.type ===
|
|
7124
|
+
if (parent.type === import_utils50.AST_NODE_TYPES.MemberExpression && parent.object === current && !parent.computed && parent.property.type === import_utils50.AST_NODE_TYPES.Identifier && TERMINAL_METHODS.has(parent.property.name)) {
|
|
7010
7125
|
return current;
|
|
7011
7126
|
}
|
|
7012
|
-
if (parent.type ===
|
|
7127
|
+
if (parent.type === import_utils50.AST_NODE_TYPES.MemberExpression && parent.object === current || parent.type === import_utils50.AST_NODE_TYPES.CallExpression && parent.callee === current || parent.type === import_utils50.AST_NODE_TYPES.TSAsExpression && parent.expression === current || parent.type === import_utils50.AST_NODE_TYPES.TSNonNullExpression && parent.expression === current) {
|
|
7013
7128
|
current = parent;
|
|
7014
7129
|
continue;
|
|
7015
7130
|
}
|
|
@@ -7060,22 +7175,22 @@ function subtreeSome(root, predicate) {
|
|
|
7060
7175
|
function readsReceiver(node) {
|
|
7061
7176
|
return subtreeSome(
|
|
7062
7177
|
node,
|
|
7063
|
-
(inner) => inner.type ===
|
|
7178
|
+
(inner) => inner.type === import_utils50.AST_NODE_TYPES.ThisExpression || inner.type === import_utils50.AST_NODE_TYPES.Super || inner.type === import_utils50.AST_NODE_TYPES.Identifier && inner.name === "arguments"
|
|
7064
7179
|
);
|
|
7065
7180
|
}
|
|
7066
7181
|
function buildsLocalizedText(node) {
|
|
7067
7182
|
return subtreeSome(node, (inner) => {
|
|
7068
|
-
if (inner.type ===
|
|
7183
|
+
if (inner.type === import_utils50.AST_NODE_TYPES.TaggedTemplateExpression) {
|
|
7069
7184
|
return true;
|
|
7070
7185
|
}
|
|
7071
|
-
if (inner.type !==
|
|
7186
|
+
if (inner.type !== import_utils50.AST_NODE_TYPES.CallExpression) {
|
|
7072
7187
|
return false;
|
|
7073
7188
|
}
|
|
7074
7189
|
const { callee } = inner;
|
|
7075
|
-
if (callee.type ===
|
|
7190
|
+
if (callee.type === import_utils50.AST_NODE_TYPES.Identifier) {
|
|
7076
7191
|
return I18N_CALLEE_NAMES.has(callee.name);
|
|
7077
7192
|
}
|
|
7078
|
-
return callee.type ===
|
|
7193
|
+
return callee.type === import_utils50.AST_NODE_TYPES.MemberExpression && !callee.computed && callee.object.type === import_utils50.AST_NODE_TYPES.Identifier && I18N_RECEIVER_NAMES.has(callee.object.name);
|
|
7079
7194
|
});
|
|
7080
7195
|
}
|
|
7081
7196
|
function collectReferences(scope, out) {
|
|
@@ -7132,15 +7247,15 @@ var prefer_module_level_schema_default = createRule({
|
|
|
7132
7247
|
}
|
|
7133
7248
|
const zodNamespaces = /* @__PURE__ */ new Set();
|
|
7134
7249
|
function isZodCall(node) {
|
|
7135
|
-
return node.type ===
|
|
7250
|
+
return node.type === import_utils50.AST_NODE_TYPES.CallExpression && node.callee.type === import_utils50.AST_NODE_TYPES.MemberExpression && !node.callee.computed && node.callee.object.type === import_utils50.AST_NODE_TYPES.Identifier && zodNamespaces.has(node.callee.object.name);
|
|
7136
7251
|
}
|
|
7137
7252
|
function isCovered(node) {
|
|
7138
7253
|
let current = node.parent ?? void 0;
|
|
7139
7254
|
while (current !== void 0) {
|
|
7140
|
-
if (current !== node && isZodCall(current) && current.callee.type ===
|
|
7255
|
+
if (current !== node && isZodCall(current) && current.callee.type === import_utils50.AST_NODE_TYPES.MemberExpression && current.callee.property.type === import_utils50.AST_NODE_TYPES.Identifier && factories.has(current.callee.property.name)) {
|
|
7141
7256
|
return true;
|
|
7142
7257
|
}
|
|
7143
|
-
if (current.type ===
|
|
7258
|
+
if (current.type === import_utils50.AST_NODE_TYPES.CallExpression && (current.callee.type === import_utils50.AST_NODE_TYPES.Identifier && MEMO_CALLEES.has(current.callee.name) || current.callee.type === import_utils50.AST_NODE_TYPES.MemberExpression && !current.callee.computed && current.callee.property.type === import_utils50.AST_NODE_TYPES.Identifier && MEMO_CALLEES.has(current.callee.property.name))) {
|
|
7144
7259
|
return true;
|
|
7145
7260
|
}
|
|
7146
7261
|
current = current.parent ?? void 0;
|
|
@@ -7155,11 +7270,11 @@ var prefer_module_level_schema_default = createRule({
|
|
|
7155
7270
|
if (parent === void 0) {
|
|
7156
7271
|
return confirmed;
|
|
7157
7272
|
}
|
|
7158
|
-
if (parent.type ===
|
|
7273
|
+
if (parent.type === import_utils50.AST_NODE_TYPES.Property && parent.value === current || parent.type === import_utils50.AST_NODE_TYPES.ObjectExpression || parent.type === import_utils50.AST_NODE_TYPES.ArrayExpression) {
|
|
7159
7274
|
current = parent;
|
|
7160
7275
|
continue;
|
|
7161
7276
|
}
|
|
7162
|
-
if (parent.type ===
|
|
7277
|
+
if (parent.type === import_utils50.AST_NODE_TYPES.CallExpression && parent.arguments.includes(current) && isSchemaComposition(parent)) {
|
|
7163
7278
|
current = schemaExpression(parent);
|
|
7164
7279
|
confirmed = current;
|
|
7165
7280
|
continue;
|
|
@@ -7169,7 +7284,7 @@ var prefer_module_level_schema_default = createRule({
|
|
|
7169
7284
|
}
|
|
7170
7285
|
function isSchemaComposition(node) {
|
|
7171
7286
|
const { callee } = node;
|
|
7172
|
-
const isCombinator = callee.type ===
|
|
7287
|
+
const isCombinator = callee.type === import_utils50.AST_NODE_TYPES.MemberExpression && !callee.computed && callee.property.type === import_utils50.AST_NODE_TYPES.Identifier && ZOD_COMBINATOR_METHODS.has(callee.property.name);
|
|
7173
7288
|
return isCombinator || isZodCall(node);
|
|
7174
7289
|
}
|
|
7175
7290
|
function closesOverNothing(node, enclosing) {
|
|
@@ -7203,13 +7318,13 @@ var prefer_module_level_schema_default = createRule({
|
|
|
7203
7318
|
}
|
|
7204
7319
|
function ownerName(enclosing) {
|
|
7205
7320
|
const parent = enclosing.parent ?? void 0;
|
|
7206
|
-
if (enclosing.type ===
|
|
7321
|
+
if (enclosing.type === import_utils50.AST_NODE_TYPES.FunctionDeclaration && enclosing.id !== null) {
|
|
7207
7322
|
return enclosing.id.name;
|
|
7208
7323
|
}
|
|
7209
|
-
if (parent !== void 0 && parent.type ===
|
|
7324
|
+
if (parent !== void 0 && parent.type === import_utils50.AST_NODE_TYPES.VariableDeclarator && parent.id.type === import_utils50.AST_NODE_TYPES.Identifier) {
|
|
7210
7325
|
return parent.id.name;
|
|
7211
7326
|
}
|
|
7212
|
-
if (parent !== void 0 && (parent.type ===
|
|
7327
|
+
if (parent !== void 0 && (parent.type === import_utils50.AST_NODE_TYPES.MethodDefinition || parent.type === import_utils50.AST_NODE_TYPES.Property) && parent.key.type === import_utils50.AST_NODE_TYPES.Identifier) {
|
|
7213
7328
|
return parent.key.name;
|
|
7214
7329
|
}
|
|
7215
7330
|
return "this function";
|
|
@@ -7220,7 +7335,7 @@ var prefer_module_level_schema_default = createRule({
|
|
|
7220
7335
|
return;
|
|
7221
7336
|
}
|
|
7222
7337
|
for (const specifier of node.specifiers) {
|
|
7223
|
-
if (specifier.type ===
|
|
7338
|
+
if (specifier.type === import_utils50.AST_NODE_TYPES.ImportNamespaceSpecifier || specifier.type === import_utils50.AST_NODE_TYPES.ImportDefaultSpecifier || specifier.type === import_utils50.AST_NODE_TYPES.ImportSpecifier && specifier.imported.type === import_utils50.AST_NODE_TYPES.Identifier && specifier.imported.name === "z") {
|
|
7224
7339
|
zodNamespaces.add(specifier.local.name);
|
|
7225
7340
|
}
|
|
7226
7341
|
}
|
|
@@ -7230,7 +7345,7 @@ var prefer_module_level_schema_default = createRule({
|
|
|
7230
7345
|
return;
|
|
7231
7346
|
}
|
|
7232
7347
|
const callee = node.callee;
|
|
7233
|
-
if (callee.property.type !==
|
|
7348
|
+
if (callee.property.type !== import_utils50.AST_NODE_TYPES.Identifier) {
|
|
7234
7349
|
return;
|
|
7235
7350
|
}
|
|
7236
7351
|
const factory = callee.property.name;
|
|
@@ -7245,7 +7360,7 @@ var prefer_module_level_schema_default = createRule({
|
|
|
7245
7360
|
return;
|
|
7246
7361
|
}
|
|
7247
7362
|
const shape = node.arguments[0];
|
|
7248
|
-
if (shape !== void 0 && shape.type ===
|
|
7363
|
+
if (shape !== void 0 && shape.type === import_utils50.AST_NODE_TYPES.ObjectExpression && shape.properties.length < minProperties) {
|
|
7249
7364
|
return;
|
|
7250
7365
|
}
|
|
7251
7366
|
const expression = schemaExpression(node);
|
|
@@ -7272,73 +7387,6 @@ var prefer_module_level_schema_default = createRule({
|
|
|
7272
7387
|
}
|
|
7273
7388
|
});
|
|
7274
7389
|
|
|
7275
|
-
// src/rules/prefer-non-nullable-collection.ts
|
|
7276
|
-
var import_utils50 = require("@typescript-eslint/utils");
|
|
7277
|
-
var ARRAY_TYPE_NAMES = /* @__PURE__ */ new Set(["Array", "ReadonlyArray"]);
|
|
7278
|
-
function propertyName(node) {
|
|
7279
|
-
const key = node.key;
|
|
7280
|
-
if (key.type === import_utils50.AST_NODE_TYPES.Identifier) return key.name;
|
|
7281
|
-
if (key.type === import_utils50.AST_NODE_TYPES.Literal) return String(key.value);
|
|
7282
|
-
return "collection";
|
|
7283
|
-
}
|
|
7284
|
-
function isArrayType(node) {
|
|
7285
|
-
if (node.type === import_utils50.AST_NODE_TYPES.TSArrayType) return true;
|
|
7286
|
-
return node.type === import_utils50.AST_NODE_TYPES.TSTypeReference && node.typeName.type === import_utils50.AST_NODE_TYPES.Identifier && ARRAY_TYPE_NAMES.has(node.typeName.name);
|
|
7287
|
-
}
|
|
7288
|
-
function isNullishType(node) {
|
|
7289
|
-
return node.type === import_utils50.AST_NODE_TYPES.TSNullKeyword || node.type === import_utils50.AST_NODE_TYPES.TSUndefinedKeyword;
|
|
7290
|
-
}
|
|
7291
|
-
function isNullableArrayOnly(node) {
|
|
7292
|
-
const values = node.types.filter((member) => !isNullishType(member));
|
|
7293
|
-
return values.length > 0 && values.length < node.types.length && values.every(isArrayType);
|
|
7294
|
-
}
|
|
7295
|
-
var prefer_non_nullable_collection_default = createRule({
|
|
7296
|
-
name: "prefer-non-nullable-collection",
|
|
7297
|
-
meta: {
|
|
7298
|
-
type: "suggestion",
|
|
7299
|
-
docs: {
|
|
7300
|
-
description: "Require declared data-shape properties and direct aliases to use non-null arrays instead of explicit nullish unions."
|
|
7301
|
-
},
|
|
7302
|
-
schema: [],
|
|
7303
|
-
messages: {
|
|
7304
|
-
preferNonNullableCollection: "`{{name}}` is a nullable array, so nullish and `[]` represent the same empty collection. Use a non-null array and default omitted values to `[]`."
|
|
7305
|
-
}
|
|
7306
|
-
},
|
|
7307
|
-
defaultOptions: [],
|
|
7308
|
-
create(context) {
|
|
7309
|
-
const normalizedFilename = context.filename.replaceAll("\\", "/");
|
|
7310
|
-
if (isTestFile(context.filename) || isGeneratedFile(context.filename, context.sourceCode.text) || /\/(?:vendor|vendored)\//u.test(normalizedFilename)) {
|
|
7311
|
-
return {};
|
|
7312
|
-
}
|
|
7313
|
-
function checkOptionalProperty(node) {
|
|
7314
|
-
if (node.optional) return;
|
|
7315
|
-
const annotation = node.typeAnnotation?.typeAnnotation;
|
|
7316
|
-
if (annotation === void 0) return;
|
|
7317
|
-
if (annotation.type !== import_utils50.AST_NODE_TYPES.TSUnionType || !isNullableArrayOnly(annotation)) {
|
|
7318
|
-
return;
|
|
7319
|
-
}
|
|
7320
|
-
context.report({
|
|
7321
|
-
node,
|
|
7322
|
-
messageId: "preferNonNullableCollection",
|
|
7323
|
-
data: { name: propertyName(node) }
|
|
7324
|
-
});
|
|
7325
|
-
}
|
|
7326
|
-
return {
|
|
7327
|
-
TSPropertySignature: checkOptionalProperty,
|
|
7328
|
-
PropertyDefinition: checkOptionalProperty,
|
|
7329
|
-
TSTypeAliasDeclaration(node) {
|
|
7330
|
-
if (node.typeAnnotation.type !== import_utils50.AST_NODE_TYPES.TSUnionType) return;
|
|
7331
|
-
if (!isNullableArrayOnly(node.typeAnnotation)) return;
|
|
7332
|
-
context.report({
|
|
7333
|
-
node,
|
|
7334
|
-
messageId: "preferNonNullableCollection",
|
|
7335
|
-
data: { name: node.id.name }
|
|
7336
|
-
});
|
|
7337
|
-
}
|
|
7338
|
-
};
|
|
7339
|
-
}
|
|
7340
|
-
});
|
|
7341
|
-
|
|
7342
7390
|
// src/rules/prefer-native-random-uuid.ts
|
|
7343
7391
|
var import_utils51 = require("@typescript-eslint/utils");
|
|
7344
7392
|
function requireUuid(node) {
|
|
@@ -7425,14 +7473,81 @@ var prefer_native_random_uuid_default = createRule({
|
|
|
7425
7473
|
}
|
|
7426
7474
|
});
|
|
7427
7475
|
|
|
7428
|
-
// src/rules/prefer-
|
|
7476
|
+
// src/rules/prefer-non-nullable-collection.ts
|
|
7429
7477
|
var import_utils52 = require("@typescript-eslint/utils");
|
|
7478
|
+
var ARRAY_TYPE_NAMES = /* @__PURE__ */ new Set(["Array", "ReadonlyArray"]);
|
|
7479
|
+
function propertyName(node) {
|
|
7480
|
+
const key = node.key;
|
|
7481
|
+
if (key.type === import_utils52.AST_NODE_TYPES.Identifier) return key.name;
|
|
7482
|
+
if (key.type === import_utils52.AST_NODE_TYPES.Literal) return String(key.value);
|
|
7483
|
+
return "collection";
|
|
7484
|
+
}
|
|
7485
|
+
function isArrayType(node) {
|
|
7486
|
+
if (node.type === import_utils52.AST_NODE_TYPES.TSArrayType) return true;
|
|
7487
|
+
return node.type === import_utils52.AST_NODE_TYPES.TSTypeReference && node.typeName.type === import_utils52.AST_NODE_TYPES.Identifier && ARRAY_TYPE_NAMES.has(node.typeName.name);
|
|
7488
|
+
}
|
|
7489
|
+
function isNullishType(node) {
|
|
7490
|
+
return node.type === import_utils52.AST_NODE_TYPES.TSNullKeyword || node.type === import_utils52.AST_NODE_TYPES.TSUndefinedKeyword;
|
|
7491
|
+
}
|
|
7492
|
+
function isNullableArrayOnly(node) {
|
|
7493
|
+
const values = node.types.filter((member) => !isNullishType(member));
|
|
7494
|
+
return values.length > 0 && values.length < node.types.length && values.every(isArrayType);
|
|
7495
|
+
}
|
|
7496
|
+
var prefer_non_nullable_collection_default = createRule({
|
|
7497
|
+
name: "prefer-non-nullable-collection",
|
|
7498
|
+
meta: {
|
|
7499
|
+
type: "suggestion",
|
|
7500
|
+
docs: {
|
|
7501
|
+
description: "Require declared data-shape properties and direct aliases to use non-null arrays instead of explicit nullish unions."
|
|
7502
|
+
},
|
|
7503
|
+
schema: [],
|
|
7504
|
+
messages: {
|
|
7505
|
+
preferNonNullableCollection: "`{{name}}` is a nullable array, so nullish and `[]` represent the same empty collection. Use a non-null array and default omitted values to `[]`."
|
|
7506
|
+
}
|
|
7507
|
+
},
|
|
7508
|
+
defaultOptions: [],
|
|
7509
|
+
create(context) {
|
|
7510
|
+
const normalizedFilename = context.filename.replaceAll("\\", "/");
|
|
7511
|
+
if (isTestFile(context.filename) || isGeneratedFile(context.filename, context.sourceCode.text) || /\/(?:vendor|vendored)\//u.test(normalizedFilename)) {
|
|
7512
|
+
return {};
|
|
7513
|
+
}
|
|
7514
|
+
function checkOptionalProperty(node) {
|
|
7515
|
+
if (node.optional) return;
|
|
7516
|
+
const annotation = node.typeAnnotation?.typeAnnotation;
|
|
7517
|
+
if (annotation === void 0) return;
|
|
7518
|
+
if (annotation.type !== import_utils52.AST_NODE_TYPES.TSUnionType || !isNullableArrayOnly(annotation)) {
|
|
7519
|
+
return;
|
|
7520
|
+
}
|
|
7521
|
+
context.report({
|
|
7522
|
+
node,
|
|
7523
|
+
messageId: "preferNonNullableCollection",
|
|
7524
|
+
data: { name: propertyName(node) }
|
|
7525
|
+
});
|
|
7526
|
+
}
|
|
7527
|
+
return {
|
|
7528
|
+
TSPropertySignature: checkOptionalProperty,
|
|
7529
|
+
PropertyDefinition: checkOptionalProperty,
|
|
7530
|
+
TSTypeAliasDeclaration(node) {
|
|
7531
|
+
if (node.typeAnnotation.type !== import_utils52.AST_NODE_TYPES.TSUnionType) return;
|
|
7532
|
+
if (!isNullableArrayOnly(node.typeAnnotation)) return;
|
|
7533
|
+
context.report({
|
|
7534
|
+
node,
|
|
7535
|
+
messageId: "preferNonNullableCollection",
|
|
7536
|
+
data: { name: node.id.name }
|
|
7537
|
+
});
|
|
7538
|
+
}
|
|
7539
|
+
};
|
|
7540
|
+
}
|
|
7541
|
+
});
|
|
7542
|
+
|
|
7543
|
+
// src/rules/prefer-schema-for-api-payload.ts
|
|
7544
|
+
var import_utils53 = require("@typescript-eslint/utils");
|
|
7430
7545
|
var unwrap4 = (node) => {
|
|
7431
7546
|
let current = node;
|
|
7432
7547
|
while (current !== null && current !== void 0) {
|
|
7433
|
-
if (current.type ===
|
|
7548
|
+
if (current.type === import_utils53.AST_NODE_TYPES.TSAsExpression || current.type === import_utils53.AST_NODE_TYPES.TSTypeAssertion || current.type === import_utils53.AST_NODE_TYPES.TSNonNullExpression || current.type === import_utils53.AST_NODE_TYPES.TSSatisfiesExpression) {
|
|
7434
7549
|
current = current.expression;
|
|
7435
|
-
} else if (current.type ===
|
|
7550
|
+
} else if (current.type === import_utils53.AST_NODE_TYPES.ChainExpression) {
|
|
7436
7551
|
current = current.expression;
|
|
7437
7552
|
} else {
|
|
7438
7553
|
break;
|
|
@@ -7447,23 +7562,23 @@ var PROMISE_CHAIN_METHODS = /* @__PURE__ */ new Set([
|
|
|
7447
7562
|
]);
|
|
7448
7563
|
var isSchemaParseReference = (node) => {
|
|
7449
7564
|
const inner = unwrap4(node);
|
|
7450
|
-
return inner !== null && inner.type ===
|
|
7565
|
+
return inner !== null && inner.type === import_utils53.AST_NODE_TYPES.MemberExpression && !inner.computed && inner.property.type === import_utils53.AST_NODE_TYPES.Identifier && (inner.property.name === "parse" || inner.property.name === "safeParse");
|
|
7451
7566
|
};
|
|
7452
7567
|
var isRawPayloadSource = (node) => {
|
|
7453
7568
|
let current = unwrap4(node);
|
|
7454
7569
|
if (current === null) return false;
|
|
7455
|
-
if (current.type ===
|
|
7570
|
+
if (current.type === import_utils53.AST_NODE_TYPES.AwaitExpression) {
|
|
7456
7571
|
current = unwrap4(current.argument);
|
|
7457
7572
|
}
|
|
7458
|
-
if (current === null || current.type !==
|
|
7573
|
+
if (current === null || current.type !== import_utils53.AST_NODE_TYPES.CallExpression) {
|
|
7459
7574
|
return false;
|
|
7460
7575
|
}
|
|
7461
7576
|
const callee = unwrap4(current.callee);
|
|
7462
|
-
if (callee === null || callee.type !==
|
|
7577
|
+
if (callee === null || callee.type !== import_utils53.AST_NODE_TYPES.MemberExpression) {
|
|
7463
7578
|
return false;
|
|
7464
7579
|
}
|
|
7465
7580
|
const property = unwrap4(callee.property);
|
|
7466
|
-
if (property === null || property.type !==
|
|
7581
|
+
if (property === null || property.type !== import_utils53.AST_NODE_TYPES.Identifier) {
|
|
7467
7582
|
return false;
|
|
7468
7583
|
}
|
|
7469
7584
|
if (property.name === "json") {
|
|
@@ -7473,16 +7588,16 @@ var isRawPayloadSource = (node) => {
|
|
|
7473
7588
|
return !current.arguments.some(isSchemaParseReference) && isRawPayloadSource(callee.object);
|
|
7474
7589
|
}
|
|
7475
7590
|
const object = unwrap4(callee.object);
|
|
7476
|
-
return property.name === "parse" && object !== null && object.type ===
|
|
7591
|
+
return property.name === "parse" && object !== null && object.type === import_utils53.AST_NODE_TYPES.Identifier && object.name === "JSON" && !isLocalFileRead(current.arguments[0]);
|
|
7477
7592
|
};
|
|
7478
7593
|
var FILE_READ_RE = /^(readFile|readFileSync|readJson|readJsonSync|readJSON)$/;
|
|
7479
7594
|
var isLocalFileRead = (node) => {
|
|
7480
7595
|
let found = false;
|
|
7481
7596
|
const visit = (current) => {
|
|
7482
7597
|
if (found || current === null || current === void 0) return;
|
|
7483
|
-
if (current.type ===
|
|
7598
|
+
if (current.type === import_utils53.AST_NODE_TYPES.CallExpression) {
|
|
7484
7599
|
const callee = unwrap4(current.callee);
|
|
7485
|
-
const name = callee?.type ===
|
|
7600
|
+
const name = callee?.type === import_utils53.AST_NODE_TYPES.Identifier ? callee.name : callee?.type === import_utils53.AST_NODE_TYPES.MemberExpression && !callee.computed && callee.property.type === import_utils53.AST_NODE_TYPES.Identifier ? callee.property.name : null;
|
|
7486
7601
|
if (name !== null && FILE_READ_RE.test(name)) {
|
|
7487
7602
|
found = true;
|
|
7488
7603
|
return;
|
|
@@ -7504,15 +7619,15 @@ var isLocalFileRead = (node) => {
|
|
|
7504
7619
|
var ASSERTION_CALLEE_RE = /^(expect|assert|should|invariant)$/;
|
|
7505
7620
|
var isInsideAssertion = (node) => {
|
|
7506
7621
|
for (let current = node.parent; current !== void 0 && current !== null; current = current.parent) {
|
|
7507
|
-
if (current.type !==
|
|
7622
|
+
if (current.type !== import_utils53.AST_NODE_TYPES.CallExpression) continue;
|
|
7508
7623
|
let callee = current.callee;
|
|
7509
|
-
while (callee.type ===
|
|
7624
|
+
while (callee.type === import_utils53.AST_NODE_TYPES.MemberExpression) {
|
|
7510
7625
|
callee = callee.object;
|
|
7511
7626
|
}
|
|
7512
|
-
if (callee.type ===
|
|
7627
|
+
if (callee.type === import_utils53.AST_NODE_TYPES.CallExpression) {
|
|
7513
7628
|
callee = callee.callee;
|
|
7514
7629
|
}
|
|
7515
|
-
if (callee.type ===
|
|
7630
|
+
if (callee.type === import_utils53.AST_NODE_TYPES.Identifier && ASSERTION_CALLEE_RE.test(callee.name)) {
|
|
7516
7631
|
return true;
|
|
7517
7632
|
}
|
|
7518
7633
|
}
|
|
@@ -7531,39 +7646,39 @@ var GUARD_NAME_RE = /^(?:is|validate|parse|assert|decode|coerce)[A-Z]/;
|
|
|
7531
7646
|
var isValidationRead = (node) => {
|
|
7532
7647
|
let current = node;
|
|
7533
7648
|
let parent = current.parent;
|
|
7534
|
-
while (parent !== null && parent !== void 0 && (parent.type ===
|
|
7649
|
+
while (parent !== null && parent !== void 0 && (parent.type === import_utils53.AST_NODE_TYPES.TSAsExpression || parent.type === import_utils53.AST_NODE_TYPES.TSTypeAssertion || parent.type === import_utils53.AST_NODE_TYPES.TSNonNullExpression || parent.type === import_utils53.AST_NODE_TYPES.TSSatisfiesExpression || parent.type === import_utils53.AST_NODE_TYPES.ChainExpression)) {
|
|
7535
7650
|
current = parent;
|
|
7536
7651
|
parent = parent.parent;
|
|
7537
7652
|
}
|
|
7538
7653
|
if (parent === null || parent === void 0) return false;
|
|
7539
|
-
if (parent.type ===
|
|
7654
|
+
if (parent.type === import_utils53.AST_NODE_TYPES.UnaryExpression && parent.operator === "typeof" && parent.argument === current) {
|
|
7540
7655
|
return true;
|
|
7541
7656
|
}
|
|
7542
|
-
if (parent.type !==
|
|
7657
|
+
if (parent.type !== import_utils53.AST_NODE_TYPES.CallExpression || !parent.arguments.some((arg) => arg === current)) {
|
|
7543
7658
|
return false;
|
|
7544
7659
|
}
|
|
7545
7660
|
const callee = parent.callee;
|
|
7546
|
-
if (callee.type ===
|
|
7661
|
+
if (callee.type === import_utils53.AST_NODE_TYPES.MemberExpression && !callee.computed && callee.object.type === import_utils53.AST_NODE_TYPES.Identifier && callee.object.name === "Array" && callee.property.type === import_utils53.AST_NODE_TYPES.Identifier && callee.property.name === "isArray") {
|
|
7547
7662
|
return parent.arguments.length === 1;
|
|
7548
7663
|
}
|
|
7549
|
-
return callee.type ===
|
|
7664
|
+
return callee.type === import_utils53.AST_NODE_TYPES.Identifier && GUARD_NAME_RE.test(callee.name);
|
|
7550
7665
|
};
|
|
7551
7666
|
var isGuardTestPosition = (node) => {
|
|
7552
7667
|
let current = node;
|
|
7553
7668
|
let parent = current.parent;
|
|
7554
7669
|
while (parent !== void 0 && parent !== null) {
|
|
7555
7670
|
switch (parent.type) {
|
|
7556
|
-
case
|
|
7557
|
-
case
|
|
7558
|
-
case
|
|
7671
|
+
case import_utils53.AST_NODE_TYPES.UnaryExpression:
|
|
7672
|
+
case import_utils53.AST_NODE_TYPES.LogicalExpression:
|
|
7673
|
+
case import_utils53.AST_NODE_TYPES.ChainExpression:
|
|
7559
7674
|
current = parent;
|
|
7560
7675
|
parent = parent.parent;
|
|
7561
7676
|
continue;
|
|
7562
|
-
case
|
|
7563
|
-
case
|
|
7564
|
-
case
|
|
7565
|
-
case
|
|
7566
|
-
case
|
|
7677
|
+
case import_utils53.AST_NODE_TYPES.IfStatement:
|
|
7678
|
+
case import_utils53.AST_NODE_TYPES.ConditionalExpression:
|
|
7679
|
+
case import_utils53.AST_NODE_TYPES.WhileStatement:
|
|
7680
|
+
case import_utils53.AST_NODE_TYPES.DoWhileStatement:
|
|
7681
|
+
case import_utils53.AST_NODE_TYPES.ForStatement:
|
|
7567
7682
|
return parent.test === current;
|
|
7568
7683
|
default:
|
|
7569
7684
|
return false;
|
|
@@ -7573,7 +7688,7 @@ var isGuardTestPosition = (node) => {
|
|
|
7573
7688
|
};
|
|
7574
7689
|
var isUnvalidatedVariableRef = (node, scope, tracked) => {
|
|
7575
7690
|
const unwrapped = unwrap4(node);
|
|
7576
|
-
if (unwrapped === null || unwrapped.type !==
|
|
7691
|
+
if (unwrapped === null || unwrapped.type !== import_utils53.AST_NODE_TYPES.Identifier) {
|
|
7577
7692
|
return false;
|
|
7578
7693
|
}
|
|
7579
7694
|
const variable = findVariable2(scope, unwrapped.name);
|
|
@@ -7616,11 +7731,11 @@ var prefer_schema_for_api_payload_default = createRule({
|
|
|
7616
7731
|
return {
|
|
7617
7732
|
VariableDeclarator(node) {
|
|
7618
7733
|
const scope = context.sourceCode.getScope(node);
|
|
7619
|
-
if (node.id.type ===
|
|
7734
|
+
if (node.id.type === import_utils53.AST_NODE_TYPES.Identifier) {
|
|
7620
7735
|
trackInitializer(node);
|
|
7621
7736
|
return;
|
|
7622
7737
|
}
|
|
7623
|
-
if (node.id.type ===
|
|
7738
|
+
if (node.id.type === import_utils53.AST_NODE_TYPES.ObjectPattern || node.id.type === import_utils53.AST_NODE_TYPES.ArrayPattern) {
|
|
7624
7739
|
if (isRawPayloadSource(node.init)) {
|
|
7625
7740
|
if (!isFullyNarrowedPattern(node)) {
|
|
7626
7741
|
context.report({ node: node.id, messageId: "unparsedJsonAccess" });
|
|
@@ -7634,7 +7749,7 @@ var prefer_schema_for_api_payload_default = createRule({
|
|
|
7634
7749
|
},
|
|
7635
7750
|
AssignmentExpression(node) {
|
|
7636
7751
|
const scope = context.sourceCode.getScope(node);
|
|
7637
|
-
if (node.left.type ===
|
|
7752
|
+
if (node.left.type === import_utils53.AST_NODE_TYPES.Identifier) {
|
|
7638
7753
|
const variable = findVariable2(scope, node.left.name);
|
|
7639
7754
|
if (variable === null) return;
|
|
7640
7755
|
if (isRawPayloadSource(node.right)) {
|
|
@@ -7644,7 +7759,7 @@ var prefer_schema_for_api_payload_default = createRule({
|
|
|
7644
7759
|
}
|
|
7645
7760
|
return;
|
|
7646
7761
|
}
|
|
7647
|
-
if (node.left.type ===
|
|
7762
|
+
if (node.left.type === import_utils53.AST_NODE_TYPES.ObjectPattern || node.left.type === import_utils53.AST_NODE_TYPES.ArrayPattern) {
|
|
7648
7763
|
if (isRawPayloadSource(node.right)) {
|
|
7649
7764
|
context.report({
|
|
7650
7765
|
node: node.left,
|
|
@@ -7661,15 +7776,15 @@ var prefer_schema_for_api_payload_default = createRule({
|
|
|
7661
7776
|
}
|
|
7662
7777
|
},
|
|
7663
7778
|
CallExpression(node) {
|
|
7664
|
-
if (node.callee.type !==
|
|
7779
|
+
if (node.callee.type !== import_utils53.AST_NODE_TYPES.Identifier) return;
|
|
7665
7780
|
if (!GUARD_NAME_RE.test(node.callee.name) && !isGuardTestPosition(node)) {
|
|
7666
7781
|
return;
|
|
7667
7782
|
}
|
|
7668
7783
|
const scope = context.sourceCode.getScope(node);
|
|
7669
7784
|
for (const arg of node.arguments) {
|
|
7670
|
-
if (arg.type ===
|
|
7785
|
+
if (arg.type === import_utils53.AST_NODE_TYPES.SpreadElement) continue;
|
|
7671
7786
|
const unwrapped = unwrap4(arg);
|
|
7672
|
-
if (unwrapped === null || unwrapped.type !==
|
|
7787
|
+
if (unwrapped === null || unwrapped.type !== import_utils53.AST_NODE_TYPES.Identifier) {
|
|
7673
7788
|
continue;
|
|
7674
7789
|
}
|
|
7675
7790
|
const variable = findVariable2(scope, unwrapped.name);
|
|
@@ -7683,13 +7798,13 @@ var prefer_schema_for_api_payload_default = createRule({
|
|
|
7683
7798
|
const obj = unwrap4(node.object);
|
|
7684
7799
|
if (isRawPayloadSource(obj)) {
|
|
7685
7800
|
const parent = node.parent;
|
|
7686
|
-
if (parent.type ===
|
|
7801
|
+
if (parent.type === import_utils53.AST_NODE_TYPES.CallExpression && parent.callee === node && node.property.type === import_utils53.AST_NODE_TYPES.Identifier && (node.property.name === "parse" || node.property.name === "safeParse" || PROMISE_CHAIN_METHODS.has(node.property.name))) {
|
|
7687
7802
|
return;
|
|
7688
7803
|
}
|
|
7689
7804
|
context.report({ node, messageId: "unparsedJsonAccess" });
|
|
7690
7805
|
return;
|
|
7691
7806
|
}
|
|
7692
|
-
if (obj !== null && obj.type ===
|
|
7807
|
+
if (obj !== null && obj.type === import_utils53.AST_NODE_TYPES.Identifier && isUnvalidatedVariableRef(obj, scope, unvalidatedVariables)) {
|
|
7693
7808
|
context.report({ node, messageId: "unparsedJsonAccess" });
|
|
7694
7809
|
const variable = findVariable2(scope, obj.name);
|
|
7695
7810
|
if (variable !== null) {
|
|
@@ -7702,7 +7817,7 @@ var prefer_schema_for_api_payload_default = createRule({
|
|
|
7702
7817
|
});
|
|
7703
7818
|
|
|
7704
7819
|
// src/rules/prefer-semantic-colors.ts
|
|
7705
|
-
var
|
|
7820
|
+
var import_utils54 = require("@typescript-eslint/utils");
|
|
7706
7821
|
var import_fs = require("fs");
|
|
7707
7822
|
var import_path = require("path");
|
|
7708
7823
|
|
|
@@ -7802,8 +7917,8 @@ var SVG_EXEMPT_COLOR_VALUES = /* @__PURE__ */ new Set([
|
|
|
7802
7917
|
]);
|
|
7803
7918
|
function jsxElementName(node) {
|
|
7804
7919
|
const name = node.openingElement.name;
|
|
7805
|
-
if (name.type ===
|
|
7806
|
-
if (name.type ===
|
|
7920
|
+
if (name.type === import_utils54.AST_NODE_TYPES.JSXIdentifier) return name.name;
|
|
7921
|
+
if (name.type === import_utils54.AST_NODE_TYPES.JSXMemberExpression && name.property.type === import_utils54.AST_NODE_TYPES.JSXIdentifier) {
|
|
7807
7922
|
return name.property.name;
|
|
7808
7923
|
}
|
|
7809
7924
|
return null;
|
|
@@ -7829,7 +7944,7 @@ var EMAIL_OR_PDF_MODULE_RE = /^@react-(?:email|pdf)\//;
|
|
|
7829
7944
|
var isInsideSvg = (node) => {
|
|
7830
7945
|
let current = node.parent;
|
|
7831
7946
|
while (current !== void 0 && current !== null) {
|
|
7832
|
-
if (current.type ===
|
|
7947
|
+
if (current.type === import_utils54.AST_NODE_TYPES.JSXElement) {
|
|
7833
7948
|
const name = jsxElementName(current);
|
|
7834
7949
|
if (name !== null && isSvgLikeElementName(name)) return true;
|
|
7835
7950
|
}
|
|
@@ -7840,7 +7955,7 @@ var isInsideSvg = (node) => {
|
|
|
7840
7955
|
var isInsideIconFactoryPath = (node) => {
|
|
7841
7956
|
let current = node.parent;
|
|
7842
7957
|
while (current !== void 0 && current !== null) {
|
|
7843
|
-
if (current.type ===
|
|
7958
|
+
if (current.type === import_utils54.AST_NODE_TYPES.Property && propName(current.key) === "path" && current.parent.type === import_utils54.AST_NODE_TYPES.ObjectExpression && current.parent.parent.type === import_utils54.AST_NODE_TYPES.CallExpression && current.parent.parent.callee.type === import_utils54.AST_NODE_TYPES.Identifier && current.parent.parent.callee.name === "createIcon") {
|
|
7844
7959
|
return true;
|
|
7845
7960
|
}
|
|
7846
7961
|
current = current.parent;
|
|
@@ -7977,12 +8092,12 @@ var hasSemanticTokenSystem = (filename) => {
|
|
|
7977
8092
|
return root !== null && workspaceHasMarker(root);
|
|
7978
8093
|
};
|
|
7979
8094
|
var propName = (key) => {
|
|
7980
|
-
if (key.type ===
|
|
7981
|
-
if (key.type ===
|
|
8095
|
+
if (key.type === import_utils54.AST_NODE_TYPES.Identifier) return key.name;
|
|
8096
|
+
if (key.type === import_utils54.AST_NODE_TYPES.Literal && typeof key.value === "string") return key.value;
|
|
7982
8097
|
return null;
|
|
7983
8098
|
};
|
|
7984
8099
|
var staticallyImportsEmailOrPdfRenderer = (program) => program.body.some((statement) => {
|
|
7985
|
-
if (statement.type !==
|
|
8100
|
+
if (statement.type !== import_utils54.AST_NODE_TYPES.ImportDeclaration && statement.type !== import_utils54.AST_NODE_TYPES.ExportNamedDeclaration && statement.type !== import_utils54.AST_NODE_TYPES.ExportAllDeclaration) {
|
|
7986
8101
|
return false;
|
|
7987
8102
|
}
|
|
7988
8103
|
return statement.source !== null && typeof statement.source.value === "string" && EMAIL_OR_PDF_MODULE_RE.test(statement.source.value);
|
|
@@ -8034,27 +8149,27 @@ var prefer_semantic_colors_default = createRule({
|
|
|
8034
8149
|
const checkClassNode = (node) => {
|
|
8035
8150
|
if (node === null) return;
|
|
8036
8151
|
switch (node.type) {
|
|
8037
|
-
case
|
|
8152
|
+
case import_utils54.AST_NODE_TYPES.Literal:
|
|
8038
8153
|
if (typeof node.value === "string") reportClasses(node.value, node);
|
|
8039
8154
|
break;
|
|
8040
|
-
case
|
|
8155
|
+
case import_utils54.AST_NODE_TYPES.TemplateLiteral:
|
|
8041
8156
|
for (const quasi of node.quasis) reportClasses(quasi.value.cooked ?? "", quasi);
|
|
8042
8157
|
break;
|
|
8043
|
-
case
|
|
8158
|
+
case import_utils54.AST_NODE_TYPES.ArrayExpression:
|
|
8044
8159
|
for (const element of node.elements) {
|
|
8045
|
-
if (element !== null && element.type !==
|
|
8160
|
+
if (element !== null && element.type !== import_utils54.AST_NODE_TYPES.SpreadElement) checkClassNode(element);
|
|
8046
8161
|
}
|
|
8047
8162
|
break;
|
|
8048
|
-
case
|
|
8163
|
+
case import_utils54.AST_NODE_TYPES.ObjectExpression:
|
|
8049
8164
|
for (const property of node.properties) {
|
|
8050
|
-
if (property.type ===
|
|
8165
|
+
if (property.type === import_utils54.AST_NODE_TYPES.Property) checkClassNode(property.value);
|
|
8051
8166
|
}
|
|
8052
8167
|
break;
|
|
8053
|
-
case
|
|
8168
|
+
case import_utils54.AST_NODE_TYPES.ConditionalExpression:
|
|
8054
8169
|
checkClassNode(node.consequent);
|
|
8055
8170
|
checkClassNode(node.alternate);
|
|
8056
8171
|
break;
|
|
8057
|
-
case
|
|
8172
|
+
case import_utils54.AST_NODE_TYPES.LogicalExpression:
|
|
8058
8173
|
checkClassNode(node.right);
|
|
8059
8174
|
break;
|
|
8060
8175
|
default:
|
|
@@ -8062,32 +8177,32 @@ var prefer_semantic_colors_default = createRule({
|
|
|
8062
8177
|
}
|
|
8063
8178
|
};
|
|
8064
8179
|
const checkColorValueNode = (node) => {
|
|
8065
|
-
if (node.type ===
|
|
8180
|
+
if (node.type === import_utils54.AST_NODE_TYPES.Literal && typeof node.value === "string" && RAW_COLOR_VALUE_RE.test(node.value) && !CSS_VAR_REFERENCE_RE.test(node.value)) {
|
|
8066
8181
|
report(node, "inlineColor", { value: node.value });
|
|
8067
8182
|
}
|
|
8068
8183
|
};
|
|
8069
8184
|
return {
|
|
8070
8185
|
"JSXAttribute[name.name='className']"(node) {
|
|
8071
8186
|
if (node.value === null) return;
|
|
8072
|
-
if (node.value.type ===
|
|
8073
|
-
else if (node.value.type ===
|
|
8074
|
-
if (node.value.expression.type !==
|
|
8187
|
+
if (node.value.type === import_utils54.AST_NODE_TYPES.Literal) checkClassNode(node.value);
|
|
8188
|
+
else if (node.value.type === import_utils54.AST_NODE_TYPES.JSXExpressionContainer) {
|
|
8189
|
+
if (node.value.expression.type !== import_utils54.AST_NODE_TYPES.JSXEmptyExpression) {
|
|
8075
8190
|
checkClassNode(node.value.expression);
|
|
8076
8191
|
}
|
|
8077
8192
|
}
|
|
8078
8193
|
},
|
|
8079
8194
|
CallExpression(node) {
|
|
8080
|
-
if (node.callee.type ===
|
|
8195
|
+
if (node.callee.type === import_utils54.AST_NODE_TYPES.Identifier && node.callee.name === "require" && node.arguments[0]?.type === import_utils54.AST_NODE_TYPES.Literal && typeof node.arguments[0].value === "string" && EMAIL_OR_PDF_MODULE_RE.test(node.arguments[0].value)) {
|
|
8081
8196
|
importsEmailOrPdfRenderer = true;
|
|
8082
8197
|
}
|
|
8083
|
-
if (node.callee.type ===
|
|
8198
|
+
if (node.callee.type === import_utils54.AST_NODE_TYPES.Identifier && CLASS_FNS.has(node.callee.name)) {
|
|
8084
8199
|
for (const arg of node.arguments) {
|
|
8085
|
-
if (arg.type !==
|
|
8200
|
+
if (arg.type !== import_utils54.AST_NODE_TYPES.SpreadElement) checkClassNode(arg);
|
|
8086
8201
|
}
|
|
8087
8202
|
}
|
|
8088
8203
|
},
|
|
8089
8204
|
VariableDeclarator(node) {
|
|
8090
|
-
if (node.id.type ===
|
|
8205
|
+
if (node.id.type === import_utils54.AST_NODE_TYPES.Identifier && CLASS_NAME_RE.test(node.id.name)) {
|
|
8091
8206
|
checkClassNode(node.init);
|
|
8092
8207
|
}
|
|
8093
8208
|
},
|
|
@@ -8097,9 +8212,9 @@ var prefer_semantic_colors_default = createRule({
|
|
|
8097
8212
|
},
|
|
8098
8213
|
// SVG artwork colors are exempt; component presentation colors still report.
|
|
8099
8214
|
"JSXAttribute[name.name=/^(fill|stroke|color)$/]"(node) {
|
|
8100
|
-
if (node.value?.type !==
|
|
8215
|
+
if (node.value?.type !== import_utils54.AST_NODE_TYPES.Literal) return;
|
|
8101
8216
|
const owner = node.parent.name;
|
|
8102
|
-
if (owner.type ===
|
|
8217
|
+
if (owner.type === import_utils54.AST_NODE_TYPES.JSXIdentifier && SVG_SHAPE_PRIMITIVES.has(owner.name)) {
|
|
8103
8218
|
return;
|
|
8104
8219
|
}
|
|
8105
8220
|
if (typeof node.value.value === "string" && SVG_EXEMPT_COLOR_VALUES.has(node.value.value.toLowerCase())) {
|
|
@@ -8113,7 +8228,7 @@ var prefer_semantic_colors_default = createRule({
|
|
|
8113
8228
|
if (name !== null && STYLE_COLOR_PROPS.has(name)) checkColorValueNode(node.value);
|
|
8114
8229
|
},
|
|
8115
8230
|
ImportExpression(node) {
|
|
8116
|
-
if (node.source.type ===
|
|
8231
|
+
if (node.source.type === import_utils54.AST_NODE_TYPES.Literal && typeof node.source.value === "string" && EMAIL_OR_PDF_MODULE_RE.test(node.source.value)) {
|
|
8117
8232
|
importsEmailOrPdfRenderer = true;
|
|
8118
8233
|
}
|
|
8119
8234
|
},
|
|
@@ -8126,7 +8241,7 @@ var prefer_semantic_colors_default = createRule({
|
|
|
8126
8241
|
});
|
|
8127
8242
|
|
|
8128
8243
|
// src/rules/prefer-server-actions.ts
|
|
8129
|
-
var
|
|
8244
|
+
var import_utils55 = require("@typescript-eslint/utils");
|
|
8130
8245
|
var MUTATION_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "DELETE", "PATCH"]);
|
|
8131
8246
|
var AXIOS_MUTATION_METHODS = /* @__PURE__ */ new Set(["post", "put", "delete", "patch"]);
|
|
8132
8247
|
var SKIP_FILE_REGEX = /(?:\.test\.[jt]sx?$|\.spec\.[jt]sx?$|-(?:test|spec)\.[jt]sx?$|\/tests?\/|\/__tests__\/|\/__testfixtures__\/|\/scripts?\/|\/app\/api\/.*\/route\.[jt]sx?$|\/pages\/api\/)/;
|
|
@@ -8317,7 +8432,7 @@ var prefer_single_sentence_comment_default = createRule({
|
|
|
8317
8432
|
});
|
|
8318
8433
|
|
|
8319
8434
|
// src/rules/prefer-string-literal-union.ts
|
|
8320
|
-
var
|
|
8435
|
+
var import_utils56 = require("@typescript-eslint/utils");
|
|
8321
8436
|
var ts2 = __toESM(require("typescript"), 1);
|
|
8322
8437
|
var CHOICE_TOKENS = /* @__PURE__ */ new Set([
|
|
8323
8438
|
"status",
|
|
@@ -8360,19 +8475,19 @@ function isChoiceLikeName(name) {
|
|
|
8360
8475
|
return CHOICE_TOKENS.has(lastWord(name));
|
|
8361
8476
|
}
|
|
8362
8477
|
function keyName(key) {
|
|
8363
|
-
if (key.type ===
|
|
8478
|
+
if (key.type === import_utils56.AST_NODE_TYPES.Identifier) {
|
|
8364
8479
|
return key.name;
|
|
8365
8480
|
}
|
|
8366
|
-
if (key.type ===
|
|
8481
|
+
if (key.type === import_utils56.AST_NODE_TYPES.Literal && typeof key.value === "string") {
|
|
8367
8482
|
return key.value;
|
|
8368
8483
|
}
|
|
8369
8484
|
return null;
|
|
8370
8485
|
}
|
|
8371
8486
|
function isStringLiteralMember(t) {
|
|
8372
|
-
return t.type ===
|
|
8487
|
+
return t.type === import_utils56.AST_NODE_TYPES.TSLiteralType && t.literal.type === import_utils56.AST_NODE_TYPES.Literal && typeof t.literal.value === "string";
|
|
8373
8488
|
}
|
|
8374
8489
|
function isStringLiteralUnion(node) {
|
|
8375
|
-
if (node?.type !==
|
|
8490
|
+
if (node?.type !== import_utils56.AST_NODE_TYPES.TSUnionType) {
|
|
8376
8491
|
return false;
|
|
8377
8492
|
}
|
|
8378
8493
|
return node.types.filter(isStringLiteralMember).length >= MIN_CLUSTER_SIZE;
|
|
@@ -8401,12 +8516,12 @@ function bindingSourceExpression(decl) {
|
|
|
8401
8516
|
return ts2.isForOfStatement(node) ? node.expression : node.initializer;
|
|
8402
8517
|
}
|
|
8403
8518
|
function refKey(node) {
|
|
8404
|
-
if (node.type ===
|
|
8519
|
+
if (node.type === import_utils56.AST_NODE_TYPES.Identifier) {
|
|
8405
8520
|
return node.name;
|
|
8406
8521
|
}
|
|
8407
|
-
if (node.type ===
|
|
8522
|
+
if (node.type === import_utils56.AST_NODE_TYPES.MemberExpression && !node.computed) {
|
|
8408
8523
|
const inner = refKey(node.object);
|
|
8409
|
-
if (inner === null || node.property.type !==
|
|
8524
|
+
if (inner === null || node.property.type !== import_utils56.AST_NODE_TYPES.Identifier) {
|
|
8410
8525
|
return null;
|
|
8411
8526
|
}
|
|
8412
8527
|
return `${inner}.${node.property.name}`;
|
|
@@ -8414,7 +8529,7 @@ function refKey(node) {
|
|
|
8414
8529
|
return null;
|
|
8415
8530
|
}
|
|
8416
8531
|
function strLiteral(node) {
|
|
8417
|
-
if (node.type ===
|
|
8532
|
+
if (node.type === import_utils56.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
8418
8533
|
return node.value;
|
|
8419
8534
|
}
|
|
8420
8535
|
return null;
|
|
@@ -8455,7 +8570,7 @@ var prefer_string_literal_union_default = createRule({
|
|
|
8455
8570
|
);
|
|
8456
8571
|
let services;
|
|
8457
8572
|
try {
|
|
8458
|
-
services =
|
|
8573
|
+
services = import_utils56.ESLintUtils.getParserServices(context);
|
|
8459
8574
|
} catch {
|
|
8460
8575
|
services = null;
|
|
8461
8576
|
}
|
|
@@ -8567,7 +8682,7 @@ var prefer_string_literal_union_default = createRule({
|
|
|
8567
8682
|
containersWithUnion.add(container);
|
|
8568
8683
|
return;
|
|
8569
8684
|
}
|
|
8570
|
-
if (typeNode?.type !==
|
|
8685
|
+
if (typeNode?.type !== import_utils56.AST_NODE_TYPES.TSStringKeyword) {
|
|
8571
8686
|
return;
|
|
8572
8687
|
}
|
|
8573
8688
|
const name = keyName(key);
|
|
@@ -8655,10 +8770,10 @@ var prefer_string_literal_union_default = createRule({
|
|
|
8655
8770
|
}
|
|
8656
8771
|
};
|
|
8657
8772
|
function refKeyText(node) {
|
|
8658
|
-
if (node.type ===
|
|
8773
|
+
if (node.type === import_utils56.AST_NODE_TYPES.BinaryExpression) {
|
|
8659
8774
|
return refKey(node.left) ?? refKey(node.right) ?? "value";
|
|
8660
8775
|
}
|
|
8661
|
-
if (node.type ===
|
|
8776
|
+
if (node.type === import_utils56.AST_NODE_TYPES.SwitchStatement) {
|
|
8662
8777
|
return refKey(node.discriminant) ?? "value";
|
|
8663
8778
|
}
|
|
8664
8779
|
return "value";
|
|
@@ -8667,7 +8782,7 @@ var prefer_string_literal_union_default = createRule({
|
|
|
8667
8782
|
});
|
|
8668
8783
|
|
|
8669
8784
|
// src/rules/prefer-whole-object-assertion.ts
|
|
8670
|
-
var
|
|
8785
|
+
var import_utils57 = require("@typescript-eslint/utils");
|
|
8671
8786
|
var MERGEABLE_MATCHERS = /* @__PURE__ */ new Set(["toBe", "toEqual", "toStrictEqual"]);
|
|
8672
8787
|
var ARRAY_MATCHERS = /* @__PURE__ */ new Set(["toEqual", "toStrictEqual"]);
|
|
8673
8788
|
var COLLECTION_PROPERTIES = /* @__PURE__ */ new Set(["length", "size"]);
|
|
@@ -8676,11 +8791,11 @@ var NUMERIC_SIGNS2 = /* @__PURE__ */ new Set(["-", "+"]);
|
|
|
8676
8791
|
var MIN_RUN_LENGTH = 2;
|
|
8677
8792
|
function literalText(node, getText) {
|
|
8678
8793
|
switch (node.type) {
|
|
8679
|
-
case
|
|
8794
|
+
case import_utils57.AST_NODE_TYPES.Literal:
|
|
8680
8795
|
return "regex" in node ? null : getText(node);
|
|
8681
|
-
case
|
|
8796
|
+
case import_utils57.AST_NODE_TYPES.TemplateLiteral:
|
|
8682
8797
|
return node.expressions.length === 0 ? getText(node) : null;
|
|
8683
|
-
case
|
|
8798
|
+
case import_utils57.AST_NODE_TYPES.UnaryExpression:
|
|
8684
8799
|
return NUMERIC_SIGNS2.has(node.operator) && literalText(node.argument, getText) !== null ? getText(node) : null;
|
|
8685
8800
|
default:
|
|
8686
8801
|
return null;
|
|
@@ -8688,15 +8803,15 @@ function literalText(node, getText) {
|
|
|
8688
8803
|
}
|
|
8689
8804
|
function isPureReceiver(node) {
|
|
8690
8805
|
switch (node.type) {
|
|
8691
|
-
case
|
|
8692
|
-
case
|
|
8806
|
+
case import_utils57.AST_NODE_TYPES.Identifier:
|
|
8807
|
+
case import_utils57.AST_NODE_TYPES.ThisExpression:
|
|
8693
8808
|
return true;
|
|
8694
|
-
case
|
|
8809
|
+
case import_utils57.AST_NODE_TYPES.MemberExpression:
|
|
8695
8810
|
if (node.optional) {
|
|
8696
8811
|
return false;
|
|
8697
8812
|
}
|
|
8698
8813
|
if (node.computed) {
|
|
8699
|
-
return node.property.type ===
|
|
8814
|
+
return node.property.type === import_utils57.AST_NODE_TYPES.Literal && isPureReceiver(node.object);
|
|
8700
8815
|
}
|
|
8701
8816
|
return isPureReceiver(node.object);
|
|
8702
8817
|
default:
|
|
@@ -8704,7 +8819,7 @@ function isPureReceiver(node) {
|
|
|
8704
8819
|
}
|
|
8705
8820
|
}
|
|
8706
8821
|
function literalIndex(node) {
|
|
8707
|
-
if (node.type !==
|
|
8822
|
+
if (node.type !== import_utils57.AST_NODE_TYPES.Literal || typeof node.value !== "number") {
|
|
8708
8823
|
return null;
|
|
8709
8824
|
}
|
|
8710
8825
|
return Number.isInteger(node.value) && node.value >= 0 ? node.value : null;
|
|
@@ -8730,24 +8845,24 @@ var prefer_whole_object_assertion_default = createRule({
|
|
|
8730
8845
|
}
|
|
8731
8846
|
const { sourceCode } = context;
|
|
8732
8847
|
function parseAssertion(statement) {
|
|
8733
|
-
if (statement.type !==
|
|
8848
|
+
if (statement.type !== import_utils57.AST_NODE_TYPES.ExpressionStatement) {
|
|
8734
8849
|
return null;
|
|
8735
8850
|
}
|
|
8736
8851
|
const call = statement.expression;
|
|
8737
|
-
if (call.type !==
|
|
8852
|
+
if (call.type !== import_utils57.AST_NODE_TYPES.CallExpression) {
|
|
8738
8853
|
return null;
|
|
8739
8854
|
}
|
|
8740
8855
|
const callee = call.callee;
|
|
8741
|
-
if (callee.type !==
|
|
8856
|
+
if (callee.type !== import_utils57.AST_NODE_TYPES.MemberExpression || callee.computed || callee.property.type !== import_utils57.AST_NODE_TYPES.Identifier) {
|
|
8742
8857
|
return null;
|
|
8743
8858
|
}
|
|
8744
8859
|
const matcher = callee.property.name;
|
|
8745
8860
|
const expectCall = callee.object;
|
|
8746
|
-
if (expectCall.type !==
|
|
8861
|
+
if (expectCall.type !== import_utils57.AST_NODE_TYPES.CallExpression || expectCall.callee.type !== import_utils57.AST_NODE_TYPES.Identifier || expectCall.callee.name !== "expect" || expectCall.arguments.length !== 1) {
|
|
8747
8862
|
return null;
|
|
8748
8863
|
}
|
|
8749
8864
|
const actual = expectCall.arguments[0];
|
|
8750
|
-
if (actual === void 0 || actual.type !==
|
|
8865
|
+
if (actual === void 0 || actual.type !== import_utils57.AST_NODE_TYPES.MemberExpression || actual.optional) {
|
|
8751
8866
|
return null;
|
|
8752
8867
|
}
|
|
8753
8868
|
if (!isPureReceiver(actual.object)) {
|
|
@@ -8761,7 +8876,7 @@ var prefer_whole_object_assertion_default = createRule({
|
|
|
8761
8876
|
}
|
|
8762
8877
|
key = { kind: "index", index };
|
|
8763
8878
|
} else {
|
|
8764
|
-
if (actual.property.type !==
|
|
8879
|
+
if (actual.property.type !== import_utils57.AST_NODE_TYPES.Identifier || COLLECTION_PROPERTIES.has(actual.property.name) || LITERAL_KEY_HAZARDS.has(actual.property.name)) {
|
|
8765
8880
|
return null;
|
|
8766
8881
|
}
|
|
8767
8882
|
key = { kind: "property", name: actual.property.name };
|
|
@@ -8773,7 +8888,7 @@ var prefer_whole_object_assertion_default = createRule({
|
|
|
8773
8888
|
return null;
|
|
8774
8889
|
}
|
|
8775
8890
|
const expected = call.arguments[0];
|
|
8776
|
-
if (call.arguments.length !== 1 || expected === void 0 || expected.type ===
|
|
8891
|
+
if (call.arguments.length !== 1 || expected === void 0 || expected.type === import_utils57.AST_NODE_TYPES.SpreadElement) {
|
|
8777
8892
|
return null;
|
|
8778
8893
|
}
|
|
8779
8894
|
const literal = literalText(expected, (node) => sourceCode.getText(node));
|
|
@@ -8888,7 +9003,7 @@ var prefer_whole_object_assertion_default = createRule({
|
|
|
8888
9003
|
});
|
|
8889
9004
|
|
|
8890
9005
|
// src/rules/prefer-zod-enum.ts
|
|
8891
|
-
var
|
|
9006
|
+
var import_utils58 = require("@typescript-eslint/utils");
|
|
8892
9007
|
var prefer_zod_enum_default = createRule({
|
|
8893
9008
|
name: "prefer-zod-enum",
|
|
8894
9009
|
meta: {
|
|
@@ -8908,25 +9023,25 @@ var prefer_zod_enum_default = createRule({
|
|
|
8908
9023
|
const zodNamespaces = /* @__PURE__ */ new Set();
|
|
8909
9024
|
function enumValues(node) {
|
|
8910
9025
|
const callee = node.callee;
|
|
8911
|
-
if (callee.type !==
|
|
9026
|
+
if (callee.type !== import_utils58.AST_NODE_TYPES.MemberExpression || callee.computed || callee.object.type !== import_utils58.AST_NODE_TYPES.Identifier || !zodNamespaces.has(callee.object.name) || callee.property.type !== import_utils58.AST_NODE_TYPES.Identifier || callee.property.name !== "union" || node.arguments.length !== 1) {
|
|
8912
9027
|
return null;
|
|
8913
9028
|
}
|
|
8914
9029
|
const argument = node.arguments[0];
|
|
8915
|
-
if (argument === void 0 || argument.type !==
|
|
9030
|
+
if (argument === void 0 || argument.type !== import_utils58.AST_NODE_TYPES.ArrayExpression || argument.elements.length === 0) {
|
|
8916
9031
|
return null;
|
|
8917
9032
|
}
|
|
8918
9033
|
const values = [];
|
|
8919
9034
|
let canFix = true;
|
|
8920
9035
|
for (const element of argument.elements) {
|
|
8921
|
-
if (element?.type ===
|
|
9036
|
+
if (element?.type === import_utils58.AST_NODE_TYPES.SpreadElement) {
|
|
8922
9037
|
canFix = false;
|
|
8923
9038
|
continue;
|
|
8924
9039
|
}
|
|
8925
|
-
if (element === null || element.type !==
|
|
9040
|
+
if (element === null || element.type !== import_utils58.AST_NODE_TYPES.CallExpression || element.callee.type !== import_utils58.AST_NODE_TYPES.MemberExpression || element.callee.computed || element.callee.object.type !== import_utils58.AST_NODE_TYPES.Identifier || !zodNamespaces.has(element.callee.object.name) || element.callee.property.type !== import_utils58.AST_NODE_TYPES.Identifier || element.callee.property.name !== "literal") {
|
|
8926
9041
|
return null;
|
|
8927
9042
|
}
|
|
8928
9043
|
const value = element.arguments[0];
|
|
8929
|
-
if (element.arguments.length !== 1 || value === void 0 || value.type !==
|
|
9044
|
+
if (element.arguments.length !== 1 || value === void 0 || value.type !== import_utils58.AST_NODE_TYPES.Literal || typeof value.value !== "string") {
|
|
8930
9045
|
canFix = false;
|
|
8931
9046
|
continue;
|
|
8932
9047
|
}
|
|
@@ -8936,11 +9051,11 @@ var prefer_zod_enum_default = createRule({
|
|
|
8936
9051
|
}
|
|
8937
9052
|
function buildFix(node, values) {
|
|
8938
9053
|
const argument = node.arguments[0];
|
|
8939
|
-
if (argument === void 0 || argument.type !==
|
|
9054
|
+
if (argument === void 0 || argument.type !== import_utils58.AST_NODE_TYPES.ArrayExpression || sourceCode.getCommentsInside(argument).length > 0) {
|
|
8940
9055
|
return void 0;
|
|
8941
9056
|
}
|
|
8942
9057
|
const callee = node.callee;
|
|
8943
|
-
if (callee.type !==
|
|
9058
|
+
if (callee.type !== import_utils58.AST_NODE_TYPES.MemberExpression || callee.property.type !== import_utils58.AST_NODE_TYPES.Identifier) {
|
|
8944
9059
|
return void 0;
|
|
8945
9060
|
}
|
|
8946
9061
|
return (fixer) => [
|
|
@@ -8957,7 +9072,7 @@ var prefer_zod_enum_default = createRule({
|
|
|
8957
9072
|
return;
|
|
8958
9073
|
}
|
|
8959
9074
|
for (const specifier of node.specifiers) {
|
|
8960
|
-
if (specifier.type ===
|
|
9075
|
+
if (specifier.type === import_utils58.AST_NODE_TYPES.ImportNamespaceSpecifier || specifier.type === import_utils58.AST_NODE_TYPES.ImportDefaultSpecifier || specifier.type === import_utils58.AST_NODE_TYPES.ImportSpecifier && specifier.imported.type === import_utils58.AST_NODE_TYPES.Identifier && specifier.imported.name === "z") {
|
|
8961
9076
|
zodNamespaces.add(specifier.local.name);
|
|
8962
9077
|
}
|
|
8963
9078
|
}
|
|
@@ -8979,7 +9094,7 @@ var prefer_zod_enum_default = createRule({
|
|
|
8979
9094
|
});
|
|
8980
9095
|
|
|
8981
9096
|
// src/rules/prefer-zod-infer.ts
|
|
8982
|
-
var
|
|
9097
|
+
var import_utils59 = require("@typescript-eslint/utils");
|
|
8983
9098
|
var SHAPE_PRESERVING_METHODS = /* @__PURE__ */ new Set([
|
|
8984
9099
|
"describe",
|
|
8985
9100
|
"refine",
|
|
@@ -9016,44 +9131,44 @@ var ZOD_TYPE_CONSTRAINTS = /* @__PURE__ */ new Set([
|
|
|
9016
9131
|
"Schema"
|
|
9017
9132
|
]);
|
|
9018
9133
|
var LEAF_NODE_TYPES = {
|
|
9019
|
-
string: [
|
|
9020
|
-
email: [
|
|
9021
|
-
url: [
|
|
9022
|
-
uuid: [
|
|
9023
|
-
ulid: [
|
|
9024
|
-
cuid: [
|
|
9025
|
-
cuid2: [
|
|
9026
|
-
nanoid: [
|
|
9027
|
-
iso: [
|
|
9028
|
-
number: [
|
|
9029
|
-
int: [
|
|
9030
|
-
float32: [
|
|
9031
|
-
float64: [
|
|
9032
|
-
boolean: [
|
|
9033
|
-
bigint: [
|
|
9034
|
-
symbol: [
|
|
9035
|
-
any: [
|
|
9036
|
-
unknown: [
|
|
9037
|
-
never: [
|
|
9038
|
-
void: [
|
|
9039
|
-
null: [
|
|
9040
|
-
undefined: [
|
|
9041
|
-
literal: [
|
|
9042
|
-
date: [
|
|
9043
|
-
array: [
|
|
9044
|
-
tuple: [
|
|
9045
|
-
object: [
|
|
9046
|
-
strictObject: [
|
|
9047
|
-
looseObject: [
|
|
9048
|
-
record: [
|
|
9049
|
-
map: [
|
|
9050
|
-
set: [
|
|
9051
|
-
promise: [
|
|
9052
|
-
enum: [
|
|
9053
|
-
nativeEnum: [
|
|
9054
|
-
union: [
|
|
9055
|
-
discriminatedUnion: [
|
|
9056
|
-
intersection: [
|
|
9134
|
+
string: [import_utils59.AST_NODE_TYPES.TSStringKeyword],
|
|
9135
|
+
email: [import_utils59.AST_NODE_TYPES.TSStringKeyword],
|
|
9136
|
+
url: [import_utils59.AST_NODE_TYPES.TSStringKeyword],
|
|
9137
|
+
uuid: [import_utils59.AST_NODE_TYPES.TSStringKeyword],
|
|
9138
|
+
ulid: [import_utils59.AST_NODE_TYPES.TSStringKeyword],
|
|
9139
|
+
cuid: [import_utils59.AST_NODE_TYPES.TSStringKeyword],
|
|
9140
|
+
cuid2: [import_utils59.AST_NODE_TYPES.TSStringKeyword],
|
|
9141
|
+
nanoid: [import_utils59.AST_NODE_TYPES.TSStringKeyword],
|
|
9142
|
+
iso: [import_utils59.AST_NODE_TYPES.TSStringKeyword],
|
|
9143
|
+
number: [import_utils59.AST_NODE_TYPES.TSNumberKeyword],
|
|
9144
|
+
int: [import_utils59.AST_NODE_TYPES.TSNumberKeyword],
|
|
9145
|
+
float32: [import_utils59.AST_NODE_TYPES.TSNumberKeyword],
|
|
9146
|
+
float64: [import_utils59.AST_NODE_TYPES.TSNumberKeyword],
|
|
9147
|
+
boolean: [import_utils59.AST_NODE_TYPES.TSBooleanKeyword],
|
|
9148
|
+
bigint: [import_utils59.AST_NODE_TYPES.TSBigIntKeyword],
|
|
9149
|
+
symbol: [import_utils59.AST_NODE_TYPES.TSSymbolKeyword],
|
|
9150
|
+
any: [import_utils59.AST_NODE_TYPES.TSAnyKeyword],
|
|
9151
|
+
unknown: [import_utils59.AST_NODE_TYPES.TSUnknownKeyword],
|
|
9152
|
+
never: [import_utils59.AST_NODE_TYPES.TSNeverKeyword],
|
|
9153
|
+
void: [import_utils59.AST_NODE_TYPES.TSVoidKeyword],
|
|
9154
|
+
null: [import_utils59.AST_NODE_TYPES.TSNullKeyword],
|
|
9155
|
+
undefined: [import_utils59.AST_NODE_TYPES.TSUndefinedKeyword],
|
|
9156
|
+
literal: [import_utils59.AST_NODE_TYPES.TSLiteralType],
|
|
9157
|
+
date: [import_utils59.AST_NODE_TYPES.TSTypeReference],
|
|
9158
|
+
array: [import_utils59.AST_NODE_TYPES.TSArrayType, import_utils59.AST_NODE_TYPES.TSTypeReference],
|
|
9159
|
+
tuple: [import_utils59.AST_NODE_TYPES.TSTupleType],
|
|
9160
|
+
object: [import_utils59.AST_NODE_TYPES.TSTypeLiteral, import_utils59.AST_NODE_TYPES.TSTypeReference],
|
|
9161
|
+
strictObject: [import_utils59.AST_NODE_TYPES.TSTypeLiteral, import_utils59.AST_NODE_TYPES.TSTypeReference],
|
|
9162
|
+
looseObject: [import_utils59.AST_NODE_TYPES.TSTypeLiteral, import_utils59.AST_NODE_TYPES.TSTypeReference],
|
|
9163
|
+
record: [import_utils59.AST_NODE_TYPES.TSTypeReference, import_utils59.AST_NODE_TYPES.TSTypeLiteral],
|
|
9164
|
+
map: [import_utils59.AST_NODE_TYPES.TSTypeReference],
|
|
9165
|
+
set: [import_utils59.AST_NODE_TYPES.TSTypeReference],
|
|
9166
|
+
promise: [import_utils59.AST_NODE_TYPES.TSTypeReference],
|
|
9167
|
+
enum: [import_utils59.AST_NODE_TYPES.TSUnionType, import_utils59.AST_NODE_TYPES.TSTypeReference, import_utils59.AST_NODE_TYPES.TSLiteralType],
|
|
9168
|
+
nativeEnum: [import_utils59.AST_NODE_TYPES.TSUnionType, import_utils59.AST_NODE_TYPES.TSTypeReference, import_utils59.AST_NODE_TYPES.TSLiteralType],
|
|
9169
|
+
union: [import_utils59.AST_NODE_TYPES.TSUnionType, import_utils59.AST_NODE_TYPES.TSTypeReference],
|
|
9170
|
+
discriminatedUnion: [import_utils59.AST_NODE_TYPES.TSUnionType, import_utils59.AST_NODE_TYPES.TSTypeReference],
|
|
9171
|
+
intersection: [import_utils59.AST_NODE_TYPES.TSIntersectionType, import_utils59.AST_NODE_TYPES.TSTypeReference]
|
|
9057
9172
|
};
|
|
9058
9173
|
function normalizeSchemaName(name) {
|
|
9059
9174
|
return name.replace(/Schema$/i, "").replace(/^Z(?=[A-Z])/, "").toLowerCase();
|
|
@@ -9062,20 +9177,20 @@ function normalizeTypeName(name) {
|
|
|
9062
9177
|
return name.replace(/Type$/, "").toLowerCase();
|
|
9063
9178
|
}
|
|
9064
9179
|
function unwrapNullish(annotation) {
|
|
9065
|
-
if (annotation.type !==
|
|
9180
|
+
if (annotation.type !== import_utils59.AST_NODE_TYPES.TSUnionType) {
|
|
9066
9181
|
return {
|
|
9067
9182
|
core: annotation,
|
|
9068
|
-
nullable: annotation.type ===
|
|
9183
|
+
nullable: annotation.type === import_utils59.AST_NODE_TYPES.TSNullKeyword
|
|
9069
9184
|
};
|
|
9070
9185
|
}
|
|
9071
9186
|
const rest = [];
|
|
9072
9187
|
let nullable = false;
|
|
9073
9188
|
for (const member of annotation.types) {
|
|
9074
|
-
if (member.type ===
|
|
9189
|
+
if (member.type === import_utils59.AST_NODE_TYPES.TSNullKeyword) {
|
|
9075
9190
|
nullable = true;
|
|
9076
9191
|
continue;
|
|
9077
9192
|
}
|
|
9078
|
-
if (member.type ===
|
|
9193
|
+
if (member.type === import_utils59.AST_NODE_TYPES.TSUndefinedKeyword) {
|
|
9079
9194
|
continue;
|
|
9080
9195
|
}
|
|
9081
9196
|
rest.push(member);
|
|
@@ -9140,14 +9255,14 @@ var prefer_zod_infer_default = createRule({
|
|
|
9140
9255
|
function zodCallChain(node) {
|
|
9141
9256
|
const chain = [];
|
|
9142
9257
|
let current = node;
|
|
9143
|
-
while (current.type ===
|
|
9258
|
+
while (current.type === import_utils59.AST_NODE_TYPES.CallExpression) {
|
|
9144
9259
|
const callee = current.callee;
|
|
9145
|
-
if (callee.type !==
|
|
9260
|
+
if (callee.type !== import_utils59.AST_NODE_TYPES.MemberExpression || callee.computed || callee.property.type !== import_utils59.AST_NODE_TYPES.Identifier) {
|
|
9146
9261
|
return null;
|
|
9147
9262
|
}
|
|
9148
9263
|
chain.push(current);
|
|
9149
9264
|
const receiver = callee.object;
|
|
9150
|
-
if (receiver.type ===
|
|
9265
|
+
if (receiver.type === import_utils59.AST_NODE_TYPES.Identifier) {
|
|
9151
9266
|
return zodNamespaces.has(receiver.name) ? chain.reverse() : null;
|
|
9152
9267
|
}
|
|
9153
9268
|
current = receiver;
|
|
@@ -9156,19 +9271,19 @@ var prefer_zod_infer_default = createRule({
|
|
|
9156
9271
|
}
|
|
9157
9272
|
function methodName(call) {
|
|
9158
9273
|
const callee = call.callee;
|
|
9159
|
-
return callee.type ===
|
|
9274
|
+
return callee.type === import_utils59.AST_NODE_TYPES.MemberExpression && callee.property.type === import_utils59.AST_NODE_TYPES.Identifier ? callee.property.name : "";
|
|
9160
9275
|
}
|
|
9161
9276
|
function schemaField(node) {
|
|
9162
9277
|
const modifiers = [];
|
|
9163
9278
|
let current = node;
|
|
9164
9279
|
let leaf = null;
|
|
9165
|
-
while (current.type ===
|
|
9280
|
+
while (current.type === import_utils59.AST_NODE_TYPES.CallExpression) {
|
|
9166
9281
|
const callee = current.callee;
|
|
9167
|
-
if (callee.type !==
|
|
9282
|
+
if (callee.type !== import_utils59.AST_NODE_TYPES.MemberExpression || callee.computed || callee.property.type !== import_utils59.AST_NODE_TYPES.Identifier) {
|
|
9168
9283
|
break;
|
|
9169
9284
|
}
|
|
9170
9285
|
const receiver = callee.object;
|
|
9171
|
-
if (receiver.type ===
|
|
9286
|
+
if (receiver.type === import_utils59.AST_NODE_TYPES.Identifier && zodNamespaces.has(receiver.name)) {
|
|
9172
9287
|
leaf = callee.property.name;
|
|
9173
9288
|
break;
|
|
9174
9289
|
}
|
|
@@ -9199,16 +9314,16 @@ var prefer_zod_infer_default = createRule({
|
|
|
9199
9314
|
return null;
|
|
9200
9315
|
}
|
|
9201
9316
|
const shape = base.arguments[0];
|
|
9202
|
-
if (shape === void 0 || shape.type !==
|
|
9317
|
+
if (shape === void 0 || shape.type !== import_utils59.AST_NODE_TYPES.ObjectExpression) {
|
|
9203
9318
|
return null;
|
|
9204
9319
|
}
|
|
9205
9320
|
const fields = /* @__PURE__ */ new Map();
|
|
9206
9321
|
for (const property of shape.properties) {
|
|
9207
|
-
if (property.type !==
|
|
9322
|
+
if (property.type !== import_utils59.AST_NODE_TYPES.Property || property.computed) {
|
|
9208
9323
|
return null;
|
|
9209
9324
|
}
|
|
9210
9325
|
const { key } = property;
|
|
9211
|
-
const name = key.type ===
|
|
9326
|
+
const name = key.type === import_utils59.AST_NODE_TYPES.Identifier ? key.name : key.type === import_utils59.AST_NODE_TYPES.Literal && typeof key.value === "string" ? key.value : null;
|
|
9212
9327
|
if (name === null) {
|
|
9213
9328
|
return null;
|
|
9214
9329
|
}
|
|
@@ -9219,11 +9334,11 @@ var prefer_zod_infer_default = createRule({
|
|
|
9219
9334
|
function typeMembers(members) {
|
|
9220
9335
|
const result = /* @__PURE__ */ new Map();
|
|
9221
9336
|
for (const member of members) {
|
|
9222
|
-
if (member.type !==
|
|
9337
|
+
if (member.type !== import_utils59.AST_NODE_TYPES.TSPropertySignature || member.computed) {
|
|
9223
9338
|
return null;
|
|
9224
9339
|
}
|
|
9225
9340
|
const { key } = member;
|
|
9226
|
-
const name = key.type ===
|
|
9341
|
+
const name = key.type === import_utils59.AST_NODE_TYPES.Identifier ? key.name : key.type === import_utils59.AST_NODE_TYPES.Literal && typeof key.value === "string" ? key.value : null;
|
|
9227
9342
|
if (name === null) {
|
|
9228
9343
|
return null;
|
|
9229
9344
|
}
|
|
@@ -9237,8 +9352,8 @@ var prefer_zod_infer_default = createRule({
|
|
|
9237
9352
|
return result.size === 0 ? null : result;
|
|
9238
9353
|
}
|
|
9239
9354
|
function collectConstrainedNames(node) {
|
|
9240
|
-
if (node.type ===
|
|
9241
|
-
if (node.typeName.type ===
|
|
9355
|
+
if (node.type === import_utils59.AST_NODE_TYPES.TSTypeReference) {
|
|
9356
|
+
if (node.typeName.type === import_utils59.AST_NODE_TYPES.Identifier) {
|
|
9242
9357
|
constrainedTypeNames.add(node.typeName.name);
|
|
9243
9358
|
}
|
|
9244
9359
|
for (const argument of node.typeArguments?.params ?? []) {
|
|
@@ -9246,11 +9361,11 @@ var prefer_zod_infer_default = createRule({
|
|
|
9246
9361
|
}
|
|
9247
9362
|
return;
|
|
9248
9363
|
}
|
|
9249
|
-
if (node.type ===
|
|
9364
|
+
if (node.type === import_utils59.AST_NODE_TYPES.TSArrayType) {
|
|
9250
9365
|
collectConstrainedNames(node.elementType);
|
|
9251
9366
|
return;
|
|
9252
9367
|
}
|
|
9253
|
-
if (node.type ===
|
|
9368
|
+
if (node.type === import_utils59.AST_NODE_TYPES.TSUnionType || node.type === import_utils59.AST_NODE_TYPES.TSIntersectionType) {
|
|
9254
9369
|
for (const member of node.types) {
|
|
9255
9370
|
collectConstrainedNames(member);
|
|
9256
9371
|
}
|
|
@@ -9294,13 +9409,13 @@ var prefer_zod_infer_default = createRule({
|
|
|
9294
9409
|
return;
|
|
9295
9410
|
}
|
|
9296
9411
|
for (const specifier of node.specifiers) {
|
|
9297
|
-
if (specifier.type ===
|
|
9412
|
+
if (specifier.type === import_utils59.AST_NODE_TYPES.ImportNamespaceSpecifier || specifier.type === import_utils59.AST_NODE_TYPES.ImportDefaultSpecifier || specifier.type === import_utils59.AST_NODE_TYPES.ImportSpecifier && specifier.imported.type === import_utils59.AST_NODE_TYPES.Identifier && specifier.imported.name === "z") {
|
|
9298
9413
|
zodNamespaces.add(specifier.local.name);
|
|
9299
9414
|
}
|
|
9300
9415
|
}
|
|
9301
9416
|
},
|
|
9302
9417
|
VariableDeclarator(node) {
|
|
9303
|
-
if (node.id.type !==
|
|
9418
|
+
if (node.id.type !== import_utils59.AST_NODE_TYPES.Identifier || node.init == null) {
|
|
9304
9419
|
return;
|
|
9305
9420
|
}
|
|
9306
9421
|
const fields = schemaFields(node.init);
|
|
@@ -9310,14 +9425,14 @@ var prefer_zod_infer_default = createRule({
|
|
|
9310
9425
|
},
|
|
9311
9426
|
/** Records `XSchema.transform(...)` and equivalent module-level reshaping. */
|
|
9312
9427
|
"MemberExpression[computed=false]"(node) {
|
|
9313
|
-
if (node.object.type ===
|
|
9428
|
+
if (node.object.type === import_utils59.AST_NODE_TYPES.Identifier && node.property.type === import_utils59.AST_NODE_TYPES.Identifier && MODULE_LEVEL_RESHAPERS.has(node.property.name)) {
|
|
9314
9429
|
reshapedSchemaNames.add(node.object.name);
|
|
9315
9430
|
}
|
|
9316
9431
|
},
|
|
9317
9432
|
/** Records every type argument carried by a Zod constraint. */
|
|
9318
9433
|
TSTypeReference(node) {
|
|
9319
9434
|
const { typeName } = node;
|
|
9320
|
-
const referenced = typeName.type ===
|
|
9435
|
+
const referenced = typeName.type === import_utils59.AST_NODE_TYPES.Identifier ? typeName.name : typeName.type === import_utils59.AST_NODE_TYPES.TSQualifiedName && typeName.right.type === import_utils59.AST_NODE_TYPES.Identifier ? typeName.right.name : null;
|
|
9321
9436
|
if (referenced === null || !ZOD_TYPE_CONSTRAINTS.has(referenced)) {
|
|
9322
9437
|
return;
|
|
9323
9438
|
}
|
|
@@ -9335,7 +9450,7 @@ var prefer_zod_infer_default = createRule({
|
|
|
9335
9450
|
}
|
|
9336
9451
|
},
|
|
9337
9452
|
TSTypeAliasDeclaration(node) {
|
|
9338
|
-
if (node.typeParameters !== void 0 || node.typeAnnotation.type !==
|
|
9453
|
+
if (node.typeParameters !== void 0 || node.typeAnnotation.type !== import_utils59.AST_NODE_TYPES.TSTypeLiteral) {
|
|
9339
9454
|
return;
|
|
9340
9455
|
}
|
|
9341
9456
|
const members = typeMembers(node.typeAnnotation.members);
|
|
@@ -9380,10 +9495,10 @@ var prefer_zod_infer_default = createRule({
|
|
|
9380
9495
|
});
|
|
9381
9496
|
|
|
9382
9497
|
// src/rules/require-assert-never.ts
|
|
9383
|
-
var
|
|
9498
|
+
var import_utils60 = require("@typescript-eslint/utils");
|
|
9384
9499
|
var isRuntimeHandlingStatement = (statement) => {
|
|
9385
|
-
if (statement.type ===
|
|
9386
|
-
if (statement.type ===
|
|
9500
|
+
if (statement.type === import_utils60.AST_NODE_TYPES.EmptyStatement) return false;
|
|
9501
|
+
if (statement.type === import_utils60.AST_NODE_TYPES.BlockStatement) {
|
|
9387
9502
|
return statement.body.some(isRuntimeHandlingStatement);
|
|
9388
9503
|
}
|
|
9389
9504
|
return true;
|
|
@@ -9399,7 +9514,7 @@ var isCommentOnlyNoopDefault = (defaultCase, sourceCode) => {
|
|
|
9399
9514
|
return colonToken !== null && sourceCode.getCommentsAfter(colonToken).length > 0;
|
|
9400
9515
|
}
|
|
9401
9516
|
const only = defaultCase.consequent[0];
|
|
9402
|
-
if (only !== void 0 && defaultCase.consequent.length === 1 && only.type ===
|
|
9517
|
+
if (only !== void 0 && defaultCase.consequent.length === 1 && only.type === import_utils60.AST_NODE_TYPES.BlockStatement && only.body.length === 0) {
|
|
9403
9518
|
return sourceCode.getCommentsInside(only).length > 0;
|
|
9404
9519
|
}
|
|
9405
9520
|
return false;
|
|
@@ -9439,7 +9554,7 @@ var require_assert_never_default = createRule({
|
|
|
9439
9554
|
});
|
|
9440
9555
|
|
|
9441
9556
|
// src/rules/require-fetch-timeout.ts
|
|
9442
|
-
var
|
|
9557
|
+
var import_utils61 = require("@typescript-eslint/utils");
|
|
9443
9558
|
var GLOBAL_OBJECTS2 = /* @__PURE__ */ new Set([
|
|
9444
9559
|
"globalThis",
|
|
9445
9560
|
"window",
|
|
@@ -9455,14 +9570,14 @@ function matchesAnyPattern3(filename, patterns) {
|
|
|
9455
9570
|
return false;
|
|
9456
9571
|
}
|
|
9457
9572
|
function initProvablyLacksSignal(init) {
|
|
9458
|
-
if (init.type !==
|
|
9573
|
+
if (init.type !== import_utils61.AST_NODE_TYPES.ObjectExpression) {
|
|
9459
9574
|
return false;
|
|
9460
9575
|
}
|
|
9461
9576
|
for (const prop of init.properties) {
|
|
9462
|
-
if (prop.type ===
|
|
9577
|
+
if (prop.type === import_utils61.AST_NODE_TYPES.SpreadElement) {
|
|
9463
9578
|
return false;
|
|
9464
9579
|
}
|
|
9465
|
-
if (prop.key.type ===
|
|
9580
|
+
if (prop.key.type === import_utils61.AST_NODE_TYPES.Identifier && prop.key.name === "signal" || prop.key.type === import_utils61.AST_NODE_TYPES.Literal && prop.key.value === "signal") {
|
|
9466
9581
|
return false;
|
|
9467
9582
|
}
|
|
9468
9583
|
if (prop.computed) {
|
|
@@ -9472,7 +9587,7 @@ function initProvablyLacksSignal(init) {
|
|
|
9472
9587
|
return true;
|
|
9473
9588
|
}
|
|
9474
9589
|
function isStringish(node) {
|
|
9475
|
-
return node.type ===
|
|
9590
|
+
return node.type === import_utils61.AST_NODE_TYPES.Literal && typeof node.value === "string" || node.type === import_utils61.AST_NODE_TYPES.TemplateLiteral;
|
|
9476
9591
|
}
|
|
9477
9592
|
var require_fetch_timeout_default = createRule({
|
|
9478
9593
|
name: "require-fetch-timeout",
|
|
@@ -9509,14 +9624,14 @@ var require_fetch_timeout_default = createRule({
|
|
|
9509
9624
|
}
|
|
9510
9625
|
function resolvesToGlobal(identifier) {
|
|
9511
9626
|
const scope = context.sourceCode.getScope(identifier);
|
|
9512
|
-
const variable =
|
|
9627
|
+
const variable = import_utils61.ASTUtils.findVariable(scope, identifier.name);
|
|
9513
9628
|
return variable === null || variable.defs.length === 0;
|
|
9514
9629
|
}
|
|
9515
9630
|
function isGlobalFetchCall2(callee) {
|
|
9516
|
-
if (callee.type ===
|
|
9631
|
+
if (callee.type === import_utils61.AST_NODE_TYPES.Identifier) {
|
|
9517
9632
|
return callee.name === "fetch" && resolvesToGlobal(callee);
|
|
9518
9633
|
}
|
|
9519
|
-
return callee.type ===
|
|
9634
|
+
return callee.type === import_utils61.AST_NODE_TYPES.MemberExpression && !callee.computed && callee.property.type === import_utils61.AST_NODE_TYPES.Identifier && callee.property.name === "fetch" && callee.object.type === import_utils61.AST_NODE_TYPES.Identifier && GLOBAL_OBJECTS2.has(callee.object.name) && resolvesToGlobal(callee.object);
|
|
9520
9635
|
}
|
|
9521
9636
|
return {
|
|
9522
9637
|
CallExpression(node) {
|
|
@@ -9536,7 +9651,7 @@ var require_fetch_timeout_default = createRule({
|
|
|
9536
9651
|
});
|
|
9537
9652
|
|
|
9538
9653
|
// src/rules/require-interface-for-injected-service.ts
|
|
9539
|
-
var
|
|
9654
|
+
var import_utils62 = require("@typescript-eslint/utils");
|
|
9540
9655
|
var CONFIGISH_TYPE_RE = /(?:Options|Opts|Config|Configuration|Settings|Params|Props|Args|Env|Environment|Callbacks|Flags)$/;
|
|
9541
9656
|
var CONFIGISH_NAME_RE = /^(?:options|opts|config|configuration|settings|params|props|args|env|environment|callbacks|flags|logger|log|clock)$/i;
|
|
9542
9657
|
var HTTP_TRANSPORT_TYPE_RE = /^(?:KyInstance|AxiosInstance|Session)$/;
|
|
@@ -9544,20 +9659,20 @@ var BUILTIN_CONTAINER_TYPE_RE = /^(?:Record|Map|WeakMap|Set|WeakSet|Array|Readon
|
|
|
9544
9659
|
var TRANSPORT_WRAPPER_NAME_RE = /Client$/;
|
|
9545
9660
|
var ROUTER_FACTORY_NAME = "Router";
|
|
9546
9661
|
var FRAMEWORK_HTTP_TYPES = /* @__PURE__ */ new Set(["Request", "Response", "NextFunction"]);
|
|
9547
|
-
var isExportedClass = (node) => node.parent.type ===
|
|
9548
|
-
var qualifiedName = (name) => name.type ===
|
|
9662
|
+
var isExportedClass = (node) => node.parent.type === import_utils62.AST_NODE_TYPES.ExportNamedDeclaration || node.parent.type === import_utils62.AST_NODE_TYPES.ExportDefaultDeclaration;
|
|
9663
|
+
var qualifiedName = (name) => name.type === import_utils62.AST_NODE_TYPES.Identifier ? name.name : name.type === import_utils62.AST_NODE_TYPES.TSQualifiedName ? `${qualifiedName(name.left)}.${name.right.name}` : "";
|
|
9549
9664
|
var readTypeReference = (annotation) => {
|
|
9550
|
-
if (annotation === void 0 || annotation.type !==
|
|
9665
|
+
if (annotation === void 0 || annotation.type !== import_utils62.AST_NODE_TYPES.TSTypeReference) return null;
|
|
9551
9666
|
const { typeName } = annotation;
|
|
9552
|
-
const rightmost = typeName.type ===
|
|
9667
|
+
const rightmost = typeName.type === import_utils62.AST_NODE_TYPES.Identifier ? typeName.name : typeName.type === import_utils62.AST_NODE_TYPES.TSQualifiedName ? typeName.right.name : null;
|
|
9553
9668
|
if (rightmost === null) return null;
|
|
9554
9669
|
return { typeName: rightmost, display: qualifiedName(typeName) };
|
|
9555
9670
|
};
|
|
9556
9671
|
var namedParameterCollaborator = (annotated) => {
|
|
9557
9672
|
let target = annotated;
|
|
9558
|
-
if (target.type ===
|
|
9559
|
-
if (target.type ===
|
|
9560
|
-
if (target.type !==
|
|
9673
|
+
if (target.type === import_utils62.AST_NODE_TYPES.TSParameterProperty) target = target.parameter;
|
|
9674
|
+
if (target.type === import_utils62.AST_NODE_TYPES.AssignmentPattern) target = target.left;
|
|
9675
|
+
if (target.type !== import_utils62.AST_NODE_TYPES.Identifier) return null;
|
|
9561
9676
|
const reference = readTypeReference(target.typeAnnotation?.typeAnnotation);
|
|
9562
9677
|
if (reference === null) return null;
|
|
9563
9678
|
return { name: target.name, ...reference };
|
|
@@ -9565,8 +9680,8 @@ var namedParameterCollaborator = (annotated) => {
|
|
|
9565
9680
|
var propertySignatureTypes = (members) => {
|
|
9566
9681
|
const types = /* @__PURE__ */ new Map();
|
|
9567
9682
|
for (const member of members) {
|
|
9568
|
-
if (member.type !==
|
|
9569
|
-
if (member.computed || member.key.type !==
|
|
9683
|
+
if (member.type !== import_utils62.AST_NODE_TYPES.TSPropertySignature) continue;
|
|
9684
|
+
if (member.computed || member.key.type !== import_utils62.AST_NODE_TYPES.Identifier) continue;
|
|
9570
9685
|
const reference = readTypeReference(member.typeAnnotation?.typeAnnotation);
|
|
9571
9686
|
if (reference === null) continue;
|
|
9572
9687
|
types.set(member.key.name, reference);
|
|
@@ -9577,18 +9692,18 @@ var fileTypeIndex = (program) => {
|
|
|
9577
9692
|
const objects = /* @__PURE__ */ new Map();
|
|
9578
9693
|
const functionAliases = /* @__PURE__ */ new Set();
|
|
9579
9694
|
for (const statement of program.body) {
|
|
9580
|
-
const declaration = statement.type ===
|
|
9581
|
-
if (declaration?.type ===
|
|
9695
|
+
const declaration = statement.type === import_utils62.AST_NODE_TYPES.ExportNamedDeclaration ? statement.declaration : statement;
|
|
9696
|
+
if (declaration?.type === import_utils62.AST_NODE_TYPES.TSInterfaceDeclaration) {
|
|
9582
9697
|
objects.set(declaration.id.name, propertySignatureTypes(declaration.body.body));
|
|
9583
9698
|
continue;
|
|
9584
9699
|
}
|
|
9585
|
-
if (declaration?.type !==
|
|
9700
|
+
if (declaration?.type !== import_utils62.AST_NODE_TYPES.TSTypeAliasDeclaration) continue;
|
|
9586
9701
|
const aliased = declaration.typeAnnotation;
|
|
9587
|
-
if (aliased.type ===
|
|
9702
|
+
if (aliased.type === import_utils62.AST_NODE_TYPES.TSFunctionType || aliased.type === import_utils62.AST_NODE_TYPES.TSConstructorType) {
|
|
9588
9703
|
functionAliases.add(declaration.id.name);
|
|
9589
9704
|
continue;
|
|
9590
9705
|
}
|
|
9591
|
-
const literals = aliased.type ===
|
|
9706
|
+
const literals = aliased.type === import_utils62.AST_NODE_TYPES.TSTypeLiteral ? [aliased] : aliased.type === import_utils62.AST_NODE_TYPES.TSIntersectionType ? aliased.types.filter((part) => part.type === import_utils62.AST_NODE_TYPES.TSTypeLiteral) : [];
|
|
9592
9707
|
if (literals.length === 0) continue;
|
|
9593
9708
|
const merged = /* @__PURE__ */ new Map();
|
|
9594
9709
|
for (const literal of literals) {
|
|
@@ -9601,10 +9716,10 @@ var fileTypeIndex = (program) => {
|
|
|
9601
9716
|
return { objects, functionAliases };
|
|
9602
9717
|
};
|
|
9603
9718
|
var bagMemberTypes = (annotation, declared) => {
|
|
9604
|
-
if (annotation.type ===
|
|
9719
|
+
if (annotation.type === import_utils62.AST_NODE_TYPES.TSTypeLiteral) {
|
|
9605
9720
|
return propertySignatureTypes(annotation.members);
|
|
9606
9721
|
}
|
|
9607
|
-
if (annotation.type !==
|
|
9722
|
+
if (annotation.type !== import_utils62.AST_NODE_TYPES.TSTypeReference || annotation.typeName.type !== import_utils62.AST_NODE_TYPES.Identifier) {
|
|
9608
9723
|
return null;
|
|
9609
9724
|
}
|
|
9610
9725
|
return declared().objects.get(annotation.typeName.name) ?? null;
|
|
@@ -9616,11 +9731,11 @@ var objectPatternCollaborators = (pattern, declared) => {
|
|
|
9616
9731
|
if (members === null) return [];
|
|
9617
9732
|
const collaborators = [];
|
|
9618
9733
|
for (const property of pattern.properties) {
|
|
9619
|
-
if (property.type !==
|
|
9620
|
-
if (property.key.type !==
|
|
9734
|
+
if (property.type !== import_utils62.AST_NODE_TYPES.Property || property.computed) continue;
|
|
9735
|
+
if (property.key.type !== import_utils62.AST_NODE_TYPES.Identifier) continue;
|
|
9621
9736
|
const key = property.key.name;
|
|
9622
|
-
const bound = property.value.type ===
|
|
9623
|
-
if (bound.type !==
|
|
9737
|
+
const bound = property.value.type === import_utils62.AST_NODE_TYPES.AssignmentPattern ? property.value.left : property.value;
|
|
9738
|
+
if (bound.type !== import_utils62.AST_NODE_TYPES.Identifier) continue;
|
|
9624
9739
|
if (CONFIGISH_NAME_RE.test(key)) continue;
|
|
9625
9740
|
const reference = members.get(key);
|
|
9626
9741
|
if (reference === void 0) continue;
|
|
@@ -9630,8 +9745,8 @@ var objectPatternCollaborators = (pattern, declared) => {
|
|
|
9630
9745
|
};
|
|
9631
9746
|
var parameterCollaborators = (parameter, declared) => {
|
|
9632
9747
|
let target = parameter;
|
|
9633
|
-
if (target.type ===
|
|
9634
|
-
if (target.type ===
|
|
9748
|
+
if (target.type === import_utils62.AST_NODE_TYPES.AssignmentPattern) target = target.left;
|
|
9749
|
+
if (target.type === import_utils62.AST_NODE_TYPES.ObjectPattern) {
|
|
9635
9750
|
return objectPatternCollaborators(target, declared);
|
|
9636
9751
|
}
|
|
9637
9752
|
const named2 = namedParameterCollaborator(parameter);
|
|
@@ -9650,17 +9765,17 @@ var readConstructor = (ctor, declared, typeParameters) => {
|
|
|
9650
9765
|
let constructedFields = 0;
|
|
9651
9766
|
if (body2 !== null && body2 !== void 0) {
|
|
9652
9767
|
for (const statement of body2.body) {
|
|
9653
|
-
if (statement.type !==
|
|
9768
|
+
if (statement.type !== import_utils62.AST_NODE_TYPES.ExpressionStatement) continue;
|
|
9654
9769
|
const expression = statement.expression;
|
|
9655
|
-
if (expression.type !==
|
|
9770
|
+
if (expression.type !== import_utils62.AST_NODE_TYPES.AssignmentExpression || expression.operator !== "=" || expression.left.type !== import_utils62.AST_NODE_TYPES.MemberExpression || expression.left.object.type !== import_utils62.AST_NODE_TYPES.ThisExpression) {
|
|
9656
9771
|
continue;
|
|
9657
9772
|
}
|
|
9658
9773
|
const source = expression.right;
|
|
9659
|
-
if (source.type ===
|
|
9774
|
+
if (source.type === import_utils62.AST_NODE_TYPES.NewExpression) {
|
|
9660
9775
|
constructedFields += 1;
|
|
9661
|
-
} else if (source.type ===
|
|
9776
|
+
} else if (source.type === import_utils62.AST_NODE_TYPES.Identifier) {
|
|
9662
9777
|
storedFrom.add(source.name);
|
|
9663
|
-
} else if (source.type ===
|
|
9778
|
+
} else if (source.type === import_utils62.AST_NODE_TYPES.MemberExpression && source.object.type === import_utils62.AST_NODE_TYPES.Identifier) {
|
|
9664
9779
|
storedFrom.add(source.object.name);
|
|
9665
9780
|
}
|
|
9666
9781
|
}
|
|
@@ -9668,7 +9783,7 @@ var readConstructor = (ctor, declared, typeParameters) => {
|
|
|
9668
9783
|
const collaborators = [];
|
|
9669
9784
|
for (const parameter of ctor.value.params) {
|
|
9670
9785
|
for (const reference of parameterCollaborators(parameter, declared)) {
|
|
9671
|
-
const stored = parameter.type ===
|
|
9786
|
+
const stored = parameter.type === import_utils62.AST_NODE_TYPES.TSParameterProperty || storedFrom.has(reference.name);
|
|
9672
9787
|
if (!stored) continue;
|
|
9673
9788
|
if (CONFIGISH_TYPE_RE.test(reference.typeName)) continue;
|
|
9674
9789
|
if (CONFIGISH_NAME_RE.test(reference.name)) continue;
|
|
@@ -9702,19 +9817,19 @@ var subtreeHas = (root, found) => {
|
|
|
9702
9817
|
return hit;
|
|
9703
9818
|
};
|
|
9704
9819
|
var isFrameworkWiring = (body2) => subtreeHas(body2, (node) => {
|
|
9705
|
-
if (node.type ===
|
|
9820
|
+
if (node.type === import_utils62.AST_NODE_TYPES.CallExpression) {
|
|
9706
9821
|
const { callee } = node;
|
|
9707
|
-
if (callee.type ===
|
|
9708
|
-
return callee.type ===
|
|
9822
|
+
if (callee.type === import_utils62.AST_NODE_TYPES.Identifier) return callee.name === ROUTER_FACTORY_NAME;
|
|
9823
|
+
return callee.type === import_utils62.AST_NODE_TYPES.MemberExpression && !callee.computed && callee.property.type === import_utils62.AST_NODE_TYPES.Identifier && callee.property.name === ROUTER_FACTORY_NAME;
|
|
9709
9824
|
}
|
|
9710
|
-
return node.type ===
|
|
9825
|
+
return node.type === import_utils62.AST_NODE_TYPES.TSTypeReference && node.typeName.type === import_utils62.AST_NODE_TYPES.TSQualifiedName && FRAMEWORK_HTTP_TYPES.has(node.typeName.right.name);
|
|
9711
9826
|
});
|
|
9712
9827
|
var stem2 = (name) => name.replace(/^I(?=[A-Z])/, "").replace(/Impl$/, "");
|
|
9713
9828
|
var fileInterfaceNames = (program) => {
|
|
9714
9829
|
const names = [];
|
|
9715
9830
|
for (const statement of program.body) {
|
|
9716
|
-
const declaration = statement.type ===
|
|
9717
|
-
if (declaration?.type ===
|
|
9831
|
+
const declaration = statement.type === import_utils62.AST_NODE_TYPES.ExportNamedDeclaration ? statement.declaration : statement;
|
|
9832
|
+
if (declaration?.type === import_utils62.AST_NODE_TYPES.TSInterfaceDeclaration) names.push(declaration.id.name);
|
|
9718
9833
|
}
|
|
9719
9834
|
return names;
|
|
9720
9835
|
};
|
|
@@ -9732,11 +9847,11 @@ var isTransportWrapper = (className, collaborators, program) => {
|
|
|
9732
9847
|
var publicMethodNames = (body2) => {
|
|
9733
9848
|
const names = [];
|
|
9734
9849
|
for (const member of body2.body) {
|
|
9735
|
-
if (member.type !==
|
|
9850
|
+
if (member.type !== import_utils62.AST_NODE_TYPES.MethodDefinition) continue;
|
|
9736
9851
|
if (member.kind !== "method" || member.static) continue;
|
|
9737
9852
|
if (member.accessibility === "private" || member.accessibility === "protected") continue;
|
|
9738
|
-
if (member.key.type ===
|
|
9739
|
-
if (member.key.type ===
|
|
9853
|
+
if (member.key.type === import_utils62.AST_NODE_TYPES.PrivateIdentifier) continue;
|
|
9854
|
+
if (member.key.type === import_utils62.AST_NODE_TYPES.Identifier) names.push(member.key.name);
|
|
9740
9855
|
else names.push("\u2026");
|
|
9741
9856
|
}
|
|
9742
9857
|
return names;
|
|
@@ -9769,7 +9884,7 @@ var require_interface_for_injected_service_default = createRule({
|
|
|
9769
9884
|
if (node.implements.length > 0) return;
|
|
9770
9885
|
if (node.decorators.length > 0) return;
|
|
9771
9886
|
const ctor = node.body.body.find(
|
|
9772
|
-
(member) => member.type ===
|
|
9887
|
+
(member) => member.type === import_utils62.AST_NODE_TYPES.MethodDefinition && member.kind === "constructor"
|
|
9773
9888
|
);
|
|
9774
9889
|
if (ctor === void 0) return;
|
|
9775
9890
|
const { collaborators, constructedFields } = readConstructor(
|
|
@@ -9798,37 +9913,37 @@ var require_interface_for_injected_service_default = createRule({
|
|
|
9798
9913
|
});
|
|
9799
9914
|
|
|
9800
9915
|
// src/rules/require-static-next-matcher.ts
|
|
9801
|
-
var
|
|
9916
|
+
var import_utils63 = require("@typescript-eslint/utils");
|
|
9802
9917
|
var NEXT_ENTRY_FILE = /(?:^|[/\\])(?:middleware|proxy)\.[cm]?[jt]sx?$/u;
|
|
9803
9918
|
function unwrapExpression(node) {
|
|
9804
|
-
if (node.type ===
|
|
9919
|
+
if (node.type === import_utils63.AST_NODE_TYPES.TSAsExpression || node.type === import_utils63.AST_NODE_TYPES.TSSatisfiesExpression || node.type === import_utils63.AST_NODE_TYPES.TSNonNullExpression || node.type === import_utils63.AST_NODE_TYPES.TSTypeAssertion) {
|
|
9805
9920
|
return unwrapExpression(node.expression);
|
|
9806
9921
|
}
|
|
9807
9922
|
return node;
|
|
9808
9923
|
}
|
|
9809
9924
|
function isStaticValue(node) {
|
|
9810
9925
|
const value = unwrapExpression(node);
|
|
9811
|
-
if (value.type ===
|
|
9926
|
+
if (value.type === import_utils63.AST_NODE_TYPES.Literal) {
|
|
9812
9927
|
return true;
|
|
9813
9928
|
}
|
|
9814
|
-
if (value.type ===
|
|
9929
|
+
if (value.type === import_utils63.AST_NODE_TYPES.TemplateLiteral) {
|
|
9815
9930
|
return value.expressions.length === 0;
|
|
9816
9931
|
}
|
|
9817
|
-
if (value.type ===
|
|
9932
|
+
if (value.type === import_utils63.AST_NODE_TYPES.ArrayExpression) {
|
|
9818
9933
|
return value.elements.every(
|
|
9819
|
-
(element) => element !== null && element.type !==
|
|
9934
|
+
(element) => element !== null && element.type !== import_utils63.AST_NODE_TYPES.SpreadElement && isStaticValue(element)
|
|
9820
9935
|
);
|
|
9821
9936
|
}
|
|
9822
|
-
if (value.type ===
|
|
9937
|
+
if (value.type === import_utils63.AST_NODE_TYPES.ObjectExpression) {
|
|
9823
9938
|
return value.properties.every(
|
|
9824
|
-
(property) => property.type ===
|
|
9939
|
+
(property) => property.type === import_utils63.AST_NODE_TYPES.Property && property.kind === "init" && !property.computed && property.value.type !== import_utils63.AST_NODE_TYPES.AssignmentPattern && isStaticValue(property.value)
|
|
9825
9940
|
);
|
|
9826
9941
|
}
|
|
9827
9942
|
return false;
|
|
9828
9943
|
}
|
|
9829
9944
|
function propertyName2(property) {
|
|
9830
9945
|
if (property.computed) return null;
|
|
9831
|
-
if (property.key.type ===
|
|
9946
|
+
if (property.key.type === import_utils63.AST_NODE_TYPES.Identifier) return property.key.name;
|
|
9832
9947
|
return typeof property.key.value === "string" ? property.key.value : null;
|
|
9833
9948
|
}
|
|
9834
9949
|
var require_static_next_matcher_default = createRule({
|
|
@@ -9850,19 +9965,19 @@ var require_static_next_matcher_default = createRule({
|
|
|
9850
9965
|
}
|
|
9851
9966
|
return {
|
|
9852
9967
|
ExportNamedDeclaration(node) {
|
|
9853
|
-
if (node.declaration?.type !==
|
|
9968
|
+
if (node.declaration?.type !== import_utils63.AST_NODE_TYPES.VariableDeclaration) {
|
|
9854
9969
|
return;
|
|
9855
9970
|
}
|
|
9856
9971
|
for (const declaration of node.declaration.declarations) {
|
|
9857
|
-
if (declaration.id.type !==
|
|
9972
|
+
if (declaration.id.type !== import_utils63.AST_NODE_TYPES.Identifier || declaration.id.name !== "config" || declaration.init === null) {
|
|
9858
9973
|
continue;
|
|
9859
9974
|
}
|
|
9860
9975
|
const config = unwrapExpression(declaration.init);
|
|
9861
|
-
if (config.type !==
|
|
9976
|
+
if (config.type !== import_utils63.AST_NODE_TYPES.ObjectExpression) {
|
|
9862
9977
|
continue;
|
|
9863
9978
|
}
|
|
9864
9979
|
for (const property of config.properties) {
|
|
9865
|
-
if (property.type !==
|
|
9980
|
+
if (property.type !== import_utils63.AST_NODE_TYPES.Property || propertyName2(property) !== "matcher" || property.value.type === import_utils63.AST_NODE_TYPES.AssignmentPattern) {
|
|
9866
9981
|
continue;
|
|
9867
9982
|
}
|
|
9868
9983
|
if (!isStaticValue(property.value)) {
|
|
@@ -9876,18 +9991,18 @@ var require_static_next_matcher_default = createRule({
|
|
|
9876
9991
|
});
|
|
9877
9992
|
|
|
9878
9993
|
// src/rules/require-zod-form-validation.ts
|
|
9879
|
-
var
|
|
9994
|
+
var import_utils64 = require("@typescript-eslint/utils");
|
|
9880
9995
|
var looksLikeZodSchema = (node) => {
|
|
9881
9996
|
let current = node;
|
|
9882
9997
|
while (true) {
|
|
9883
|
-
if (current.type ===
|
|
9998
|
+
if (current.type === import_utils64.AST_NODE_TYPES.Identifier) {
|
|
9884
9999
|
return current.name === "z" || ZOD_SCHEMA_NAME_RE.test(current.name);
|
|
9885
10000
|
}
|
|
9886
|
-
if (current.type ===
|
|
10001
|
+
if (current.type === import_utils64.AST_NODE_TYPES.CallExpression) {
|
|
9887
10002
|
current = current.callee;
|
|
9888
10003
|
continue;
|
|
9889
10004
|
}
|
|
9890
|
-
if (current.type ===
|
|
10005
|
+
if (current.type === import_utils64.AST_NODE_TYPES.MemberExpression) {
|
|
9891
10006
|
current = current.object;
|
|
9892
10007
|
continue;
|
|
9893
10008
|
}
|
|
@@ -9895,23 +10010,23 @@ var looksLikeZodSchema = (node) => {
|
|
|
9895
10010
|
}
|
|
9896
10011
|
};
|
|
9897
10012
|
var isZodParseCall = (node) => {
|
|
9898
|
-
if (node.type !==
|
|
10013
|
+
if (node.type !== import_utils64.AST_NODE_TYPES.CallExpression) return false;
|
|
9899
10014
|
const callee = node.callee;
|
|
9900
|
-
if (callee.type !==
|
|
10015
|
+
if (callee.type !== import_utils64.AST_NODE_TYPES.MemberExpression) return false;
|
|
9901
10016
|
if (callee.computed) return false;
|
|
9902
|
-
if (callee.property.type !==
|
|
10017
|
+
if (callee.property.type !== import_utils64.AST_NODE_TYPES.Identifier) return false;
|
|
9903
10018
|
const method = callee.property.name;
|
|
9904
10019
|
if (method !== "parse" && method !== "safeParse") return false;
|
|
9905
10020
|
return looksLikeZodSchema(callee.object);
|
|
9906
10021
|
};
|
|
9907
10022
|
var isFormDataMethodCall = (node) => {
|
|
9908
10023
|
let current = node;
|
|
9909
|
-
if (current.type ===
|
|
10024
|
+
if (current.type === import_utils64.AST_NODE_TYPES.AwaitExpression) {
|
|
9910
10025
|
current = current.argument;
|
|
9911
10026
|
}
|
|
9912
|
-
if (current.type !==
|
|
10027
|
+
if (current.type !== import_utils64.AST_NODE_TYPES.CallExpression) return false;
|
|
9913
10028
|
const callee = current.callee;
|
|
9914
|
-
return callee.type ===
|
|
10029
|
+
return callee.type === import_utils64.AST_NODE_TYPES.MemberExpression && !callee.computed && callee.property.type === import_utils64.AST_NODE_TYPES.Identifier && callee.property.name === "formData";
|
|
9915
10030
|
};
|
|
9916
10031
|
var require_zod_form_validation_default = createRule({
|
|
9917
10032
|
name: "require-zod-form-validation",
|
|
@@ -9931,14 +10046,14 @@ var require_zod_form_validation_default = createRule({
|
|
|
9931
10046
|
return {};
|
|
9932
10047
|
}
|
|
9933
10048
|
const isFormSourceIdentifier = (node) => {
|
|
9934
|
-
if (node.type !==
|
|
10049
|
+
if (node.type !== import_utils64.AST_NODE_TYPES.Identifier) return false;
|
|
9935
10050
|
if (/formdata/i.test(node.name)) return true;
|
|
9936
10051
|
let scope = context.sourceCode.getScope(node);
|
|
9937
10052
|
while (scope !== null) {
|
|
9938
10053
|
const variable = scope.set.get(node.name);
|
|
9939
10054
|
if (variable !== void 0 && variable.defs.length === 1) {
|
|
9940
10055
|
const def = variable.defs[0];
|
|
9941
|
-
if (def !== void 0 && def.type === "Variable" && def.node.type ===
|
|
10056
|
+
if (def !== void 0 && def.type === "Variable" && def.node.type === import_utils64.AST_NODE_TYPES.VariableDeclarator && def.node.init !== null) {
|
|
9942
10057
|
return isFormDataMethodCall(def.node.init);
|
|
9943
10058
|
}
|
|
9944
10059
|
return false;
|
|
@@ -9949,8 +10064,8 @@ var require_zod_form_validation_default = createRule({
|
|
|
9949
10064
|
};
|
|
9950
10065
|
const isFormDataGetCall = (node) => {
|
|
9951
10066
|
const callee = node.callee;
|
|
9952
|
-
if (callee.type !==
|
|
9953
|
-
if (callee.property.type !==
|
|
10067
|
+
if (callee.type !== import_utils64.AST_NODE_TYPES.MemberExpression) return false;
|
|
10068
|
+
if (callee.property.type !== import_utils64.AST_NODE_TYPES.Identifier || callee.property.name !== "get") {
|
|
9954
10069
|
return false;
|
|
9955
10070
|
}
|
|
9956
10071
|
return isFormSourceIdentifier(callee.object);
|
|
@@ -9965,11 +10080,11 @@ var require_zod_form_validation_default = createRule({
|
|
|
9965
10080
|
};
|
|
9966
10081
|
const isInstanceofNarrowing = (node) => {
|
|
9967
10082
|
const parent = node.parent;
|
|
9968
|
-
return parent !== null && parent !== void 0 && parent.type ===
|
|
10083
|
+
return parent !== null && parent !== void 0 && parent.type === import_utils64.AST_NODE_TYPES.BinaryExpression && parent.operator === "instanceof" && parent.left === node && parent.right.type === import_utils64.AST_NODE_TYPES.Identifier && (parent.right.name === "File" || parent.right.name === "Blob");
|
|
9969
10084
|
};
|
|
9970
10085
|
const boundDeclarator = (node) => {
|
|
9971
10086
|
const parent = node.parent;
|
|
9972
|
-
if (parent.type ===
|
|
10087
|
+
if (parent.type === import_utils64.AST_NODE_TYPES.VariableDeclarator && parent.init === node && parent.id.type === import_utils64.AST_NODE_TYPES.Identifier) {
|
|
9973
10088
|
return parent;
|
|
9974
10089
|
}
|
|
9975
10090
|
return null;
|
|
@@ -9997,7 +10112,7 @@ var require_zod_form_validation_default = createRule({
|
|
|
9997
10112
|
});
|
|
9998
10113
|
|
|
9999
10114
|
// src/rules/store-insert-requires-on-conflict.ts
|
|
10000
|
-
var
|
|
10115
|
+
var import_utils65 = require("@typescript-eslint/utils");
|
|
10001
10116
|
var INSERT_WRITE = /\bINSERT\s+(?:OR\s+\w+\s+)?INTO\s+[\w."'`?$:@-]+\s*(?:\([^)]*\)\s*)?(?:VALUES|SELECT|DEFAULT\s+VALUES)\b/i;
|
|
10002
10117
|
var CONFLICT_HANDLED = /\bON\s+CONFLICT\b|\bON\s+DUPLICATE\s+KEY\b|\bINSERT\s+OR\s+(?:IGNORE|REPLACE)\b/i;
|
|
10003
10118
|
var INSERT_GATE = /insert/i;
|
|
@@ -10028,7 +10143,7 @@ var store_insert_requires_on_conflict_default = createRule({
|
|
|
10028
10143
|
});
|
|
10029
10144
|
|
|
10030
10145
|
// src/rules/zod-naming-convention.ts
|
|
10031
|
-
var
|
|
10146
|
+
var import_utils66 = require("@typescript-eslint/utils");
|
|
10032
10147
|
var CONVENTIONS = {
|
|
10033
10148
|
prefix: { test: ZOD_PREFIX_RE, messageId: "zPrefix" },
|
|
10034
10149
|
suffix: { test: ZOD_SUFFIX_RE, messageId: "schemaSuffix" },
|
|
@@ -10053,15 +10168,15 @@ var NON_SCHEMA_TERMINALS = /* @__PURE__ */ new Set([
|
|
|
10053
10168
|
"registry",
|
|
10054
10169
|
"implement"
|
|
10055
10170
|
]);
|
|
10056
|
-
var terminalMethodName = (callee) => !callee.computed && callee.property.type ===
|
|
10171
|
+
var terminalMethodName = (callee) => !callee.computed && callee.property.type === import_utils66.AST_NODE_TYPES.Identifier ? callee.property.name : null;
|
|
10057
10172
|
var calleeChainStartsWithZ = (node) => {
|
|
10058
10173
|
let current = node;
|
|
10059
|
-
while (current.type ===
|
|
10174
|
+
while (current.type === import_utils66.AST_NODE_TYPES.MemberExpression) {
|
|
10060
10175
|
const receiver = current.object;
|
|
10061
|
-
if (receiver.type ===
|
|
10176
|
+
if (receiver.type === import_utils66.AST_NODE_TYPES.Identifier && receiver.name === "z") {
|
|
10062
10177
|
return true;
|
|
10063
10178
|
}
|
|
10064
|
-
if (receiver.type ===
|
|
10179
|
+
if (receiver.type === import_utils66.AST_NODE_TYPES.CallExpression) {
|
|
10065
10180
|
current = receiver.callee;
|
|
10066
10181
|
continue;
|
|
10067
10182
|
}
|
|
@@ -10106,13 +10221,13 @@ var zod_naming_convention_default = createRule({
|
|
|
10106
10221
|
VariableDeclarator(node) {
|
|
10107
10222
|
const init = node.init;
|
|
10108
10223
|
if (init === null || init === void 0) return;
|
|
10109
|
-
if (init.type !==
|
|
10224
|
+
if (init.type !== import_utils66.AST_NODE_TYPES.CallExpression) return;
|
|
10110
10225
|
const callee = init.callee;
|
|
10111
|
-
if (callee.type !==
|
|
10226
|
+
if (callee.type !== import_utils66.AST_NODE_TYPES.MemberExpression) return;
|
|
10112
10227
|
if (!calleeChainStartsWithZ(callee)) return;
|
|
10113
10228
|
const terminal = terminalMethodName(callee);
|
|
10114
10229
|
if (terminal !== null && NON_SCHEMA_TERMINALS.has(terminal)) return;
|
|
10115
|
-
if (node.id.type !==
|
|
10230
|
+
if (node.id.type !== import_utils66.AST_NODE_TYPES.Identifier) return;
|
|
10116
10231
|
if (test.test(node.id.name)) return;
|
|
10117
10232
|
if (acceptsSchemaWord && CONTAINS_SCHEMA_RE.test(node.id.name)) return;
|
|
10118
10233
|
context.report({
|
|
@@ -10223,10 +10338,11 @@ var rules = {
|
|
|
10223
10338
|
"no-zod-native-enum": no_zod_native_enum_default,
|
|
10224
10339
|
"prefer-constant-time-secret-compare": prefer_constant_time_secret_compare_default,
|
|
10225
10340
|
"prefer-discriminated-union": prefer_discriminated_union_default,
|
|
10341
|
+
"prefer-input-group-search": prefer_input_group_search_default,
|
|
10226
10342
|
"prefer-module-level-constant": prefer_module_level_constant_default,
|
|
10227
10343
|
"prefer-module-level-schema": prefer_module_level_schema_default,
|
|
10228
|
-
"prefer-non-nullable-collection": prefer_non_nullable_collection_default,
|
|
10229
10344
|
"prefer-native-random-uuid": prefer_native_random_uuid_default,
|
|
10345
|
+
"prefer-non-nullable-collection": prefer_non_nullable_collection_default,
|
|
10230
10346
|
"prefer-schema-for-api-payload": prefer_schema_for_api_payload_default,
|
|
10231
10347
|
"prefer-semantic-colors": prefer_semantic_colors_default,
|
|
10232
10348
|
"prefer-server-actions": prefer_server_actions_default,
|
|
@@ -10245,7 +10361,7 @@ var rules = {
|
|
|
10245
10361
|
};
|
|
10246
10362
|
var meta = {
|
|
10247
10363
|
name: "@sarj/eslint-plugin",
|
|
10248
|
-
version: "9.
|
|
10364
|
+
version: "9.11.0"
|
|
10249
10365
|
};
|
|
10250
10366
|
var applicationOnlyRules = [
|
|
10251
10367
|
"no-restricted-library-load",
|
|
@@ -10288,6 +10404,7 @@ var recommendedRules = {
|
|
|
10288
10404
|
"@sarj/no-zod-native-enum": "warn",
|
|
10289
10405
|
"@sarj/prefer-constant-time-secret-compare": "error",
|
|
10290
10406
|
"@sarj/prefer-discriminated-union": "warn",
|
|
10407
|
+
"@sarj/prefer-input-group-search": "error",
|
|
10291
10408
|
"@sarj/prefer-module-level-constant": "warn",
|
|
10292
10409
|
"@sarj/prefer-module-level-schema": "warn",
|
|
10293
10410
|
"@sarj/prefer-non-nullable-collection": "warn",
|
|
@@ -10348,6 +10465,7 @@ var strictRules = {
|
|
|
10348
10465
|
"@sarj/no-zod-native-enum": "error",
|
|
10349
10466
|
"@sarj/prefer-constant-time-secret-compare": "error",
|
|
10350
10467
|
"@sarj/prefer-discriminated-union": "error",
|
|
10468
|
+
"@sarj/prefer-input-group-search": "error",
|
|
10351
10469
|
"@sarj/prefer-module-level-constant": "error",
|
|
10352
10470
|
"@sarj/prefer-module-level-schema": "error",
|
|
10353
10471
|
"@sarj/prefer-non-nullable-collection": "error",
|