@sarj/eslint-plugin 9.10.0 → 9.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/dist/index.cjs +475 -338
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +470 -333
- package/dist/index.js.map +1 -1
- package/package.json +9 -2
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+(?:<[^\n]*>)?)+(?:\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) {
|
|
@@ -6745,8 +6747,141 @@ var prefer_input_group_search_default = createRule({
|
|
|
6745
6747
|
}
|
|
6746
6748
|
});
|
|
6747
6749
|
|
|
6748
|
-
// src/rules/prefer-
|
|
6750
|
+
// src/rules/prefer-shadcn-primitives.ts
|
|
6749
6751
|
var import_utils49 = require("@typescript-eslint/utils");
|
|
6752
|
+
var SHADCN_PRIMITIVES = {
|
|
6753
|
+
button: "Button",
|
|
6754
|
+
dialog: "Dialog or AlertDialog family",
|
|
6755
|
+
input: "Input",
|
|
6756
|
+
label: "Label",
|
|
6757
|
+
progress: "Progress",
|
|
6758
|
+
select: "Select family",
|
|
6759
|
+
table: "Table family",
|
|
6760
|
+
textarea: "Textarea"
|
|
6761
|
+
};
|
|
6762
|
+
var LABELABLE_ELEMENTS = /* @__PURE__ */ new Set([
|
|
6763
|
+
"button",
|
|
6764
|
+
"input",
|
|
6765
|
+
"meter",
|
|
6766
|
+
"output",
|
|
6767
|
+
"progress",
|
|
6768
|
+
"select",
|
|
6769
|
+
"textarea"
|
|
6770
|
+
]);
|
|
6771
|
+
function rawElementName(node) {
|
|
6772
|
+
if (node.name.type !== import_utils49.AST_NODE_TYPES.JSXIdentifier) return null;
|
|
6773
|
+
const name = node.name.name;
|
|
6774
|
+
return Object.hasOwn(SHADCN_PRIMITIVES, name) ? name : null;
|
|
6775
|
+
}
|
|
6776
|
+
function staticExpressionString(expression) {
|
|
6777
|
+
if (expression.type === import_utils49.AST_NODE_TYPES.Literal) {
|
|
6778
|
+
return typeof expression.value === "string" ? expression.value : null;
|
|
6779
|
+
}
|
|
6780
|
+
if (expression.type === import_utils49.AST_NODE_TYPES.TemplateLiteral) {
|
|
6781
|
+
let value = expression.quasis[0]?.value.cooked ?? "";
|
|
6782
|
+
for (const [index, substitution] of expression.expressions.entries()) {
|
|
6783
|
+
const staticSubstitution = staticExpressionString(substitution);
|
|
6784
|
+
if (staticSubstitution === null) return null;
|
|
6785
|
+
value += staticSubstitution;
|
|
6786
|
+
value += expression.quasis[index + 1]?.value.cooked ?? "";
|
|
6787
|
+
}
|
|
6788
|
+
return value;
|
|
6789
|
+
}
|
|
6790
|
+
if (expression.type === import_utils49.AST_NODE_TYPES.TSAsExpression || expression.type === import_utils49.AST_NODE_TYPES.TSNonNullExpression || expression.type === import_utils49.AST_NODE_TYPES.TSSatisfiesExpression || expression.type === import_utils49.AST_NODE_TYPES.TSTypeAssertion) {
|
|
6791
|
+
return staticExpressionString(expression.expression);
|
|
6792
|
+
}
|
|
6793
|
+
return null;
|
|
6794
|
+
}
|
|
6795
|
+
function staticString(value) {
|
|
6796
|
+
if (value?.type === import_utils49.AST_NODE_TYPES.Literal) {
|
|
6797
|
+
return typeof value.value === "string" ? value.value : null;
|
|
6798
|
+
}
|
|
6799
|
+
if (value?.type !== import_utils49.AST_NODE_TYPES.JSXExpressionContainer) return null;
|
|
6800
|
+
return staticExpressionString(value.expression);
|
|
6801
|
+
}
|
|
6802
|
+
function effectiveAttribute(node, attributeName) {
|
|
6803
|
+
for (const attribute of node.attributes.toReversed()) {
|
|
6804
|
+
if (attribute.type === import_utils49.AST_NODE_TYPES.JSXSpreadAttribute) {
|
|
6805
|
+
return { kind: "unknown" };
|
|
6806
|
+
}
|
|
6807
|
+
if (attribute.name.type !== import_utils49.AST_NODE_TYPES.JSXIdentifier || attribute.name.name !== attributeName) {
|
|
6808
|
+
continue;
|
|
6809
|
+
}
|
|
6810
|
+
const value = staticString(attribute.value);
|
|
6811
|
+
return value === null ? { kind: "unknown" } : { kind: "known", value };
|
|
6812
|
+
}
|
|
6813
|
+
return { kind: "missing" };
|
|
6814
|
+
}
|
|
6815
|
+
function isLabelableElement(node) {
|
|
6816
|
+
if (node.openingElement.name.type !== import_utils49.AST_NODE_TYPES.JSXIdentifier) {
|
|
6817
|
+
return false;
|
|
6818
|
+
}
|
|
6819
|
+
const name = node.openingElement.name.name;
|
|
6820
|
+
if (!LABELABLE_ELEMENTS.has(name)) return false;
|
|
6821
|
+
if (name !== "input") return true;
|
|
6822
|
+
const typeAttribute = effectiveAttribute(node.openingElement, "type");
|
|
6823
|
+
if (typeAttribute.kind === "unknown") return false;
|
|
6824
|
+
return !(typeAttribute.kind === "known" && typeAttribute.value.toLowerCase() === "hidden");
|
|
6825
|
+
}
|
|
6826
|
+
function containsLabelableElement(node) {
|
|
6827
|
+
return node.children.some((child) => {
|
|
6828
|
+
if (child.type === import_utils49.AST_NODE_TYPES.JSXElement) {
|
|
6829
|
+
return isLabelableElement(child) || containsLabelableElement(child);
|
|
6830
|
+
}
|
|
6831
|
+
if (child.type === import_utils49.AST_NODE_TYPES.JSXFragment) {
|
|
6832
|
+
return containsLabelableElement(child);
|
|
6833
|
+
}
|
|
6834
|
+
return false;
|
|
6835
|
+
});
|
|
6836
|
+
}
|
|
6837
|
+
function isStaticallyAssociatedLabel(node) {
|
|
6838
|
+
const htmlFor = effectiveAttribute(node, "htmlFor");
|
|
6839
|
+
if (htmlFor.kind === "known" && htmlFor.value.trim().length > 0) return true;
|
|
6840
|
+
return node.parent.type === import_utils49.AST_NODE_TYPES.JSXElement && containsLabelableElement(node.parent);
|
|
6841
|
+
}
|
|
6842
|
+
function replacementFor(node, element) {
|
|
6843
|
+
if (element !== "input") return SHADCN_PRIMITIVES[element];
|
|
6844
|
+
const typeAttribute = effectiveAttribute(node, "type");
|
|
6845
|
+
if (typeAttribute.kind === "unknown") return null;
|
|
6846
|
+
const inputType = typeAttribute.kind === "known" ? typeAttribute.value.toLowerCase() : "text";
|
|
6847
|
+
if (inputType === "hidden" || inputType === "file") return null;
|
|
6848
|
+
if (inputType === "checkbox") return "Checkbox";
|
|
6849
|
+
if (inputType === "radio") return "RadioGroup family";
|
|
6850
|
+
return "Input";
|
|
6851
|
+
}
|
|
6852
|
+
var prefer_shadcn_primitives_default = createRule({
|
|
6853
|
+
name: "prefer-shadcn-primitives",
|
|
6854
|
+
meta: {
|
|
6855
|
+
type: "suggestion",
|
|
6856
|
+
docs: {
|
|
6857
|
+
description: "Require visible raw JSX controls to use the corresponding shared shadcn primitive."
|
|
6858
|
+
},
|
|
6859
|
+
schema: [],
|
|
6860
|
+
messages: {
|
|
6861
|
+
preferShadcnPrimitive: "Use the shared {{ replacement }} shadcn primitive instead of raw <{{ element }}> markup."
|
|
6862
|
+
}
|
|
6863
|
+
},
|
|
6864
|
+
defaultOptions: [],
|
|
6865
|
+
create(context) {
|
|
6866
|
+
return {
|
|
6867
|
+
JSXOpeningElement(node) {
|
|
6868
|
+
const element = rawElementName(node);
|
|
6869
|
+
if (element === null) return;
|
|
6870
|
+
if (element === "label" && !isStaticallyAssociatedLabel(node)) return;
|
|
6871
|
+
const replacement = replacementFor(node, element);
|
|
6872
|
+
if (replacement === null) return;
|
|
6873
|
+
context.report({
|
|
6874
|
+
node,
|
|
6875
|
+
messageId: "preferShadcnPrimitive",
|
|
6876
|
+
data: { element, replacement }
|
|
6877
|
+
});
|
|
6878
|
+
}
|
|
6879
|
+
};
|
|
6880
|
+
}
|
|
6881
|
+
});
|
|
6882
|
+
|
|
6883
|
+
// src/rules/prefer-module-level-constant.ts
|
|
6884
|
+
var import_utils50 = require("@typescript-eslint/utils");
|
|
6750
6885
|
var DEFAULT_MIN_ELEMENTS = 3;
|
|
6751
6886
|
var MAX_LITERAL_DEPTH = 4;
|
|
6752
6887
|
var IGNORE_PATTERNS2 = [
|
|
@@ -6775,9 +6910,9 @@ var MUTATING_METHODS = /* @__PURE__ */ new Set([
|
|
|
6775
6910
|
"assign"
|
|
6776
6911
|
]);
|
|
6777
6912
|
var FUNCTION_TYPES5 = /* @__PURE__ */ new Set([
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6913
|
+
import_utils50.AST_NODE_TYPES.FunctionDeclaration,
|
|
6914
|
+
import_utils50.AST_NODE_TYPES.FunctionExpression,
|
|
6915
|
+
import_utils50.AST_NODE_TYPES.ArrowFunctionExpression
|
|
6781
6916
|
]);
|
|
6782
6917
|
var COLLECTION_CONSTRUCTORS = /* @__PURE__ */ new Set(["Set", "Map"]);
|
|
6783
6918
|
function isIgnoredFile2(filename, sourceText) {
|
|
@@ -6790,14 +6925,14 @@ function isLocalFixtureFile(filename) {
|
|
|
6790
6925
|
return isTestFile(filename) || isStoryFile(filename);
|
|
6791
6926
|
}
|
|
6792
6927
|
function unwrap3(node) {
|
|
6793
|
-
if (node.type ===
|
|
6928
|
+
if (node.type === import_utils50.AST_NODE_TYPES.TSAsExpression || node.type === import_utils50.AST_NODE_TYPES.TSSatisfiesExpression || node.type === import_utils50.AST_NODE_TYPES.TSNonNullExpression) {
|
|
6794
6929
|
return unwrap3(node.expression);
|
|
6795
6930
|
}
|
|
6796
6931
|
return node;
|
|
6797
6932
|
}
|
|
6798
6933
|
var HAS_STATEFUL_FLAG_RE = /[gy]/;
|
|
6799
6934
|
function isRegexLiteral(node) {
|
|
6800
|
-
return node.type ===
|
|
6935
|
+
return node.type === import_utils50.AST_NODE_TYPES.Literal && "regex" in node && node.regex !== void 0;
|
|
6801
6936
|
}
|
|
6802
6937
|
function isLiteralOnly(node, depth) {
|
|
6803
6938
|
if (depth > MAX_LITERAL_DEPTH) {
|
|
@@ -6805,29 +6940,29 @@ function isLiteralOnly(node, depth) {
|
|
|
6805
6940
|
}
|
|
6806
6941
|
const inner = unwrap3(node);
|
|
6807
6942
|
switch (inner.type) {
|
|
6808
|
-
case
|
|
6943
|
+
case import_utils50.AST_NODE_TYPES.Literal: {
|
|
6809
6944
|
return !(isRegexLiteral(inner) && HAS_STATEFUL_FLAG_RE.test(inner.regex.flags));
|
|
6810
6945
|
}
|
|
6811
|
-
case
|
|
6946
|
+
case import_utils50.AST_NODE_TYPES.TemplateLiteral: {
|
|
6812
6947
|
return inner.expressions.length === 0;
|
|
6813
6948
|
}
|
|
6814
|
-
case
|
|
6815
|
-
return (inner.operator === "-" || inner.operator === "+") && inner.argument.type ===
|
|
6949
|
+
case import_utils50.AST_NODE_TYPES.UnaryExpression: {
|
|
6950
|
+
return (inner.operator === "-" || inner.operator === "+") && inner.argument.type === import_utils50.AST_NODE_TYPES.Literal && typeof inner.argument.value === "number";
|
|
6816
6951
|
}
|
|
6817
|
-
case
|
|
6952
|
+
case import_utils50.AST_NODE_TYPES.ArrayExpression: {
|
|
6818
6953
|
return inner.elements.every(
|
|
6819
|
-
(el) => el !== null && el.type !==
|
|
6954
|
+
(el) => el !== null && el.type !== import_utils50.AST_NODE_TYPES.SpreadElement && isLiteralOnly(el, depth + 1)
|
|
6820
6955
|
);
|
|
6821
6956
|
}
|
|
6822
|
-
case
|
|
6957
|
+
case import_utils50.AST_NODE_TYPES.ObjectExpression: {
|
|
6823
6958
|
return inner.properties.every((prop) => {
|
|
6824
|
-
if (prop.type !==
|
|
6959
|
+
if (prop.type !== import_utils50.AST_NODE_TYPES.Property) {
|
|
6825
6960
|
return false;
|
|
6826
6961
|
}
|
|
6827
6962
|
if (prop.shorthand || prop.method || prop.kind !== "init") {
|
|
6828
6963
|
return false;
|
|
6829
6964
|
}
|
|
6830
|
-
if (prop.computed && prop.key.type !==
|
|
6965
|
+
if (prop.computed && prop.key.type !== import_utils50.AST_NODE_TYPES.Literal) {
|
|
6831
6966
|
return false;
|
|
6832
6967
|
}
|
|
6833
6968
|
return isLiteralOnly(prop.value, depth + 1);
|
|
@@ -6840,7 +6975,7 @@ function isLiteralOnly(node, depth) {
|
|
|
6840
6975
|
}
|
|
6841
6976
|
function unwrapObjectFreeze(node) {
|
|
6842
6977
|
const inner = unwrap3(node);
|
|
6843
|
-
if (inner.type ===
|
|
6978
|
+
if (inner.type === import_utils50.AST_NODE_TYPES.CallExpression && inner.callee.type === import_utils50.AST_NODE_TYPES.MemberExpression && !inner.callee.computed && inner.callee.object.type === import_utils50.AST_NODE_TYPES.Identifier && inner.callee.object.name === "Object" && inner.callee.property.type === import_utils50.AST_NODE_TYPES.Identifier && inner.callee.property.name === "freeze" && inner.arguments.length === 1 && inner.arguments[0] !== void 0 && inner.arguments[0].type !== import_utils50.AST_NODE_TYPES.SpreadElement) {
|
|
6844
6979
|
return unwrap3(inner.arguments[0]);
|
|
6845
6980
|
}
|
|
6846
6981
|
return inner;
|
|
@@ -6856,19 +6991,19 @@ function classify(init, checkRegex) {
|
|
|
6856
6991
|
}
|
|
6857
6992
|
return { kind: "regex", size: 1 };
|
|
6858
6993
|
}
|
|
6859
|
-
if (node.type ===
|
|
6994
|
+
if (node.type === import_utils50.AST_NODE_TYPES.ArrayExpression) {
|
|
6860
6995
|
return isLiteralOnly(node, 0) ? { kind: "array", size: node.elements.length } : null;
|
|
6861
6996
|
}
|
|
6862
|
-
if (node.type ===
|
|
6997
|
+
if (node.type === import_utils50.AST_NODE_TYPES.ObjectExpression) {
|
|
6863
6998
|
return isLiteralOnly(node, 0) ? { kind: "object", size: node.properties.length } : null;
|
|
6864
6999
|
}
|
|
6865
|
-
if (node.type ===
|
|
7000
|
+
if (node.type === import_utils50.AST_NODE_TYPES.NewExpression && node.callee.type === import_utils50.AST_NODE_TYPES.Identifier && COLLECTION_CONSTRUCTORS.has(node.callee.name)) {
|
|
6866
7001
|
const arg = node.arguments[0];
|
|
6867
|
-
if (node.arguments.length !== 1 || arg === void 0 || arg.type ===
|
|
7002
|
+
if (node.arguments.length !== 1 || arg === void 0 || arg.type === import_utils50.AST_NODE_TYPES.SpreadElement) {
|
|
6868
7003
|
return null;
|
|
6869
7004
|
}
|
|
6870
7005
|
const entries = unwrap3(arg);
|
|
6871
|
-
if (entries.type !==
|
|
7006
|
+
if (entries.type !== import_utils50.AST_NODE_TYPES.ArrayExpression) {
|
|
6872
7007
|
return null;
|
|
6873
7008
|
}
|
|
6874
7009
|
return isLiteralOnly(entries, 0) ? { kind: node.callee.name === "Set" ? "Set" : "Map", size: entries.elements.length } : null;
|
|
@@ -6897,10 +7032,10 @@ var NON_RETAINING_BUILTINS = /* @__PURE__ */ new Map(
|
|
|
6897
7032
|
);
|
|
6898
7033
|
function isNonRetainingBuiltinCall(node, argument) {
|
|
6899
7034
|
const callee = node.callee;
|
|
6900
|
-
if (callee.type ===
|
|
7035
|
+
if (callee.type === import_utils50.AST_NODE_TYPES.Identifier && callee.name === "structuredClone") {
|
|
6901
7036
|
return true;
|
|
6902
7037
|
}
|
|
6903
|
-
if (callee.type !==
|
|
7038
|
+
if (callee.type !== import_utils50.AST_NODE_TYPES.MemberExpression || callee.computed || callee.object.type !== import_utils50.AST_NODE_TYPES.Identifier || callee.property.type !== import_utils50.AST_NODE_TYPES.Identifier) {
|
|
6904
7039
|
return false;
|
|
6905
7040
|
}
|
|
6906
7041
|
const members = NON_RETAINING_BUILTINS.get(callee.object.name);
|
|
@@ -6914,38 +7049,38 @@ function isNonRetainingBuiltinCall(node, argument) {
|
|
|
6914
7049
|
}
|
|
6915
7050
|
function isSafeRead(identifier) {
|
|
6916
7051
|
const parent = identifier.parent;
|
|
6917
|
-
if (parent.type ===
|
|
7052
|
+
if (parent.type === import_utils50.AST_NODE_TYPES.MemberExpression) {
|
|
6918
7053
|
if (parent.object !== identifier) {
|
|
6919
7054
|
return true;
|
|
6920
7055
|
}
|
|
6921
7056
|
const grandparent = parent.parent;
|
|
6922
|
-
if (grandparent.type ===
|
|
7057
|
+
if (grandparent.type === import_utils50.AST_NODE_TYPES.AssignmentExpression && grandparent.left === parent) {
|
|
6923
7058
|
return false;
|
|
6924
7059
|
}
|
|
6925
|
-
if (grandparent.type ===
|
|
7060
|
+
if (grandparent.type === import_utils50.AST_NODE_TYPES.UpdateExpression) {
|
|
6926
7061
|
return false;
|
|
6927
7062
|
}
|
|
6928
|
-
if (grandparent.type ===
|
|
7063
|
+
if (grandparent.type === import_utils50.AST_NODE_TYPES.UnaryExpression && grandparent.operator === "delete") {
|
|
6929
7064
|
return false;
|
|
6930
7065
|
}
|
|
6931
|
-
if (!parent.computed && parent.property.type ===
|
|
7066
|
+
if (!parent.computed && parent.property.type === import_utils50.AST_NODE_TYPES.Identifier && MUTATING_METHODS.has(parent.property.name) && grandparent.type === import_utils50.AST_NODE_TYPES.CallExpression && grandparent.callee === parent) {
|
|
6932
7067
|
return false;
|
|
6933
7068
|
}
|
|
6934
7069
|
return true;
|
|
6935
7070
|
}
|
|
6936
|
-
if (parent.type ===
|
|
7071
|
+
if (parent.type === import_utils50.AST_NODE_TYPES.ForOfStatement && parent.right === identifier) {
|
|
6937
7072
|
return true;
|
|
6938
7073
|
}
|
|
6939
|
-
if (parent.type ===
|
|
7074
|
+
if (parent.type === import_utils50.AST_NODE_TYPES.SpreadElement) {
|
|
6940
7075
|
return true;
|
|
6941
7076
|
}
|
|
6942
|
-
if (parent.type ===
|
|
7077
|
+
if (parent.type === import_utils50.AST_NODE_TYPES.BinaryExpression) {
|
|
6943
7078
|
return true;
|
|
6944
7079
|
}
|
|
6945
|
-
if (parent.type ===
|
|
7080
|
+
if (parent.type === import_utils50.AST_NODE_TYPES.CallExpression && parent.arguments.includes(identifier) && isNonRetainingBuiltinCall(parent, identifier)) {
|
|
6946
7081
|
return true;
|
|
6947
7082
|
}
|
|
6948
|
-
if (parent.type ===
|
|
7083
|
+
if (parent.type === import_utils50.AST_NODE_TYPES.UnaryExpression && parent.operator !== "delete") {
|
|
6949
7084
|
return true;
|
|
6950
7085
|
}
|
|
6951
7086
|
return false;
|
|
@@ -7000,7 +7135,7 @@ var prefer_module_level_constant_default = createRule({
|
|
|
7000
7135
|
if (reference.isWrite()) {
|
|
7001
7136
|
return false;
|
|
7002
7137
|
}
|
|
7003
|
-
if (reference.identifier.type !==
|
|
7138
|
+
if (reference.identifier.type !== import_utils50.AST_NODE_TYPES.Identifier) {
|
|
7004
7139
|
return false;
|
|
7005
7140
|
}
|
|
7006
7141
|
if (!isSafeRead(reference.identifier)) {
|
|
@@ -7012,10 +7147,10 @@ var prefer_module_level_constant_default = createRule({
|
|
|
7012
7147
|
return {
|
|
7013
7148
|
VariableDeclarator(node) {
|
|
7014
7149
|
const declaration = node.parent;
|
|
7015
|
-
if (declaration.type !==
|
|
7150
|
+
if (declaration.type !== import_utils50.AST_NODE_TYPES.VariableDeclaration || declaration.kind !== "const" || declaration.declare === true) {
|
|
7016
7151
|
return;
|
|
7017
7152
|
}
|
|
7018
|
-
if (node.id.type !==
|
|
7153
|
+
if (node.id.type !== import_utils50.AST_NODE_TYPES.Identifier || node.init === null) {
|
|
7019
7154
|
return;
|
|
7020
7155
|
}
|
|
7021
7156
|
if (enclosingFunction2(node) === null) {
|
|
@@ -7042,7 +7177,7 @@ var prefer_module_level_constant_default = createRule({
|
|
|
7042
7177
|
});
|
|
7043
7178
|
|
|
7044
7179
|
// src/rules/prefer-module-level-schema.ts
|
|
7045
|
-
var
|
|
7180
|
+
var import_utils51 = require("@typescript-eslint/utils");
|
|
7046
7181
|
|
|
7047
7182
|
// src/rules/_zod.ts
|
|
7048
7183
|
var ZOD_PREFIX_RE = /^Z[A-Z]/;
|
|
@@ -7108,9 +7243,9 @@ var I18N_RECEIVER_NAMES = /* @__PURE__ */ new Set([
|
|
|
7108
7243
|
"intl"
|
|
7109
7244
|
]);
|
|
7110
7245
|
var FUNCTION_TYPES6 = /* @__PURE__ */ new Set([
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7246
|
+
import_utils51.AST_NODE_TYPES.ArrowFunctionExpression,
|
|
7247
|
+
import_utils51.AST_NODE_TYPES.FunctionDeclaration,
|
|
7248
|
+
import_utils51.AST_NODE_TYPES.FunctionExpression
|
|
7114
7249
|
]);
|
|
7115
7250
|
function schemaExpression(node) {
|
|
7116
7251
|
let current = node;
|
|
@@ -7119,10 +7254,10 @@ function schemaExpression(node) {
|
|
|
7119
7254
|
if (parent === void 0) {
|
|
7120
7255
|
return current;
|
|
7121
7256
|
}
|
|
7122
|
-
if (parent.type ===
|
|
7257
|
+
if (parent.type === import_utils51.AST_NODE_TYPES.MemberExpression && parent.object === current && !parent.computed && parent.property.type === import_utils51.AST_NODE_TYPES.Identifier && TERMINAL_METHODS.has(parent.property.name)) {
|
|
7123
7258
|
return current;
|
|
7124
7259
|
}
|
|
7125
|
-
if (parent.type ===
|
|
7260
|
+
if (parent.type === import_utils51.AST_NODE_TYPES.MemberExpression && parent.object === current || parent.type === import_utils51.AST_NODE_TYPES.CallExpression && parent.callee === current || parent.type === import_utils51.AST_NODE_TYPES.TSAsExpression && parent.expression === current || parent.type === import_utils51.AST_NODE_TYPES.TSNonNullExpression && parent.expression === current) {
|
|
7126
7261
|
current = parent;
|
|
7127
7262
|
continue;
|
|
7128
7263
|
}
|
|
@@ -7173,22 +7308,22 @@ function subtreeSome(root, predicate) {
|
|
|
7173
7308
|
function readsReceiver(node) {
|
|
7174
7309
|
return subtreeSome(
|
|
7175
7310
|
node,
|
|
7176
|
-
(inner) => inner.type ===
|
|
7311
|
+
(inner) => inner.type === import_utils51.AST_NODE_TYPES.ThisExpression || inner.type === import_utils51.AST_NODE_TYPES.Super || inner.type === import_utils51.AST_NODE_TYPES.Identifier && inner.name === "arguments"
|
|
7177
7312
|
);
|
|
7178
7313
|
}
|
|
7179
7314
|
function buildsLocalizedText(node) {
|
|
7180
7315
|
return subtreeSome(node, (inner) => {
|
|
7181
|
-
if (inner.type ===
|
|
7316
|
+
if (inner.type === import_utils51.AST_NODE_TYPES.TaggedTemplateExpression) {
|
|
7182
7317
|
return true;
|
|
7183
7318
|
}
|
|
7184
|
-
if (inner.type !==
|
|
7319
|
+
if (inner.type !== import_utils51.AST_NODE_TYPES.CallExpression) {
|
|
7185
7320
|
return false;
|
|
7186
7321
|
}
|
|
7187
7322
|
const { callee } = inner;
|
|
7188
|
-
if (callee.type ===
|
|
7323
|
+
if (callee.type === import_utils51.AST_NODE_TYPES.Identifier) {
|
|
7189
7324
|
return I18N_CALLEE_NAMES.has(callee.name);
|
|
7190
7325
|
}
|
|
7191
|
-
return callee.type ===
|
|
7326
|
+
return callee.type === import_utils51.AST_NODE_TYPES.MemberExpression && !callee.computed && callee.object.type === import_utils51.AST_NODE_TYPES.Identifier && I18N_RECEIVER_NAMES.has(callee.object.name);
|
|
7192
7327
|
});
|
|
7193
7328
|
}
|
|
7194
7329
|
function collectReferences(scope, out) {
|
|
@@ -7245,15 +7380,15 @@ var prefer_module_level_schema_default = createRule({
|
|
|
7245
7380
|
}
|
|
7246
7381
|
const zodNamespaces = /* @__PURE__ */ new Set();
|
|
7247
7382
|
function isZodCall(node) {
|
|
7248
|
-
return node.type ===
|
|
7383
|
+
return node.type === import_utils51.AST_NODE_TYPES.CallExpression && node.callee.type === import_utils51.AST_NODE_TYPES.MemberExpression && !node.callee.computed && node.callee.object.type === import_utils51.AST_NODE_TYPES.Identifier && zodNamespaces.has(node.callee.object.name);
|
|
7249
7384
|
}
|
|
7250
7385
|
function isCovered(node) {
|
|
7251
7386
|
let current = node.parent ?? void 0;
|
|
7252
7387
|
while (current !== void 0) {
|
|
7253
|
-
if (current !== node && isZodCall(current) && current.callee.type ===
|
|
7388
|
+
if (current !== node && isZodCall(current) && current.callee.type === import_utils51.AST_NODE_TYPES.MemberExpression && current.callee.property.type === import_utils51.AST_NODE_TYPES.Identifier && factories.has(current.callee.property.name)) {
|
|
7254
7389
|
return true;
|
|
7255
7390
|
}
|
|
7256
|
-
if (current.type ===
|
|
7391
|
+
if (current.type === import_utils51.AST_NODE_TYPES.CallExpression && (current.callee.type === import_utils51.AST_NODE_TYPES.Identifier && MEMO_CALLEES.has(current.callee.name) || current.callee.type === import_utils51.AST_NODE_TYPES.MemberExpression && !current.callee.computed && current.callee.property.type === import_utils51.AST_NODE_TYPES.Identifier && MEMO_CALLEES.has(current.callee.property.name))) {
|
|
7257
7392
|
return true;
|
|
7258
7393
|
}
|
|
7259
7394
|
current = current.parent ?? void 0;
|
|
@@ -7268,11 +7403,11 @@ var prefer_module_level_schema_default = createRule({
|
|
|
7268
7403
|
if (parent === void 0) {
|
|
7269
7404
|
return confirmed;
|
|
7270
7405
|
}
|
|
7271
|
-
if (parent.type ===
|
|
7406
|
+
if (parent.type === import_utils51.AST_NODE_TYPES.Property && parent.value === current || parent.type === import_utils51.AST_NODE_TYPES.ObjectExpression || parent.type === import_utils51.AST_NODE_TYPES.ArrayExpression) {
|
|
7272
7407
|
current = parent;
|
|
7273
7408
|
continue;
|
|
7274
7409
|
}
|
|
7275
|
-
if (parent.type ===
|
|
7410
|
+
if (parent.type === import_utils51.AST_NODE_TYPES.CallExpression && parent.arguments.includes(current) && isSchemaComposition(parent)) {
|
|
7276
7411
|
current = schemaExpression(parent);
|
|
7277
7412
|
confirmed = current;
|
|
7278
7413
|
continue;
|
|
@@ -7282,7 +7417,7 @@ var prefer_module_level_schema_default = createRule({
|
|
|
7282
7417
|
}
|
|
7283
7418
|
function isSchemaComposition(node) {
|
|
7284
7419
|
const { callee } = node;
|
|
7285
|
-
const isCombinator = callee.type ===
|
|
7420
|
+
const isCombinator = callee.type === import_utils51.AST_NODE_TYPES.MemberExpression && !callee.computed && callee.property.type === import_utils51.AST_NODE_TYPES.Identifier && ZOD_COMBINATOR_METHODS.has(callee.property.name);
|
|
7286
7421
|
return isCombinator || isZodCall(node);
|
|
7287
7422
|
}
|
|
7288
7423
|
function closesOverNothing(node, enclosing) {
|
|
@@ -7316,13 +7451,13 @@ var prefer_module_level_schema_default = createRule({
|
|
|
7316
7451
|
}
|
|
7317
7452
|
function ownerName(enclosing) {
|
|
7318
7453
|
const parent = enclosing.parent ?? void 0;
|
|
7319
|
-
if (enclosing.type ===
|
|
7454
|
+
if (enclosing.type === import_utils51.AST_NODE_TYPES.FunctionDeclaration && enclosing.id !== null) {
|
|
7320
7455
|
return enclosing.id.name;
|
|
7321
7456
|
}
|
|
7322
|
-
if (parent !== void 0 && parent.type ===
|
|
7457
|
+
if (parent !== void 0 && parent.type === import_utils51.AST_NODE_TYPES.VariableDeclarator && parent.id.type === import_utils51.AST_NODE_TYPES.Identifier) {
|
|
7323
7458
|
return parent.id.name;
|
|
7324
7459
|
}
|
|
7325
|
-
if (parent !== void 0 && (parent.type ===
|
|
7460
|
+
if (parent !== void 0 && (parent.type === import_utils51.AST_NODE_TYPES.MethodDefinition || parent.type === import_utils51.AST_NODE_TYPES.Property) && parent.key.type === import_utils51.AST_NODE_TYPES.Identifier) {
|
|
7326
7461
|
return parent.key.name;
|
|
7327
7462
|
}
|
|
7328
7463
|
return "this function";
|
|
@@ -7333,7 +7468,7 @@ var prefer_module_level_schema_default = createRule({
|
|
|
7333
7468
|
return;
|
|
7334
7469
|
}
|
|
7335
7470
|
for (const specifier of node.specifiers) {
|
|
7336
|
-
if (specifier.type ===
|
|
7471
|
+
if (specifier.type === import_utils51.AST_NODE_TYPES.ImportNamespaceSpecifier || specifier.type === import_utils51.AST_NODE_TYPES.ImportDefaultSpecifier || specifier.type === import_utils51.AST_NODE_TYPES.ImportSpecifier && specifier.imported.type === import_utils51.AST_NODE_TYPES.Identifier && specifier.imported.name === "z") {
|
|
7337
7472
|
zodNamespaces.add(specifier.local.name);
|
|
7338
7473
|
}
|
|
7339
7474
|
}
|
|
@@ -7343,7 +7478,7 @@ var prefer_module_level_schema_default = createRule({
|
|
|
7343
7478
|
return;
|
|
7344
7479
|
}
|
|
7345
7480
|
const callee = node.callee;
|
|
7346
|
-
if (callee.property.type !==
|
|
7481
|
+
if (callee.property.type !== import_utils51.AST_NODE_TYPES.Identifier) {
|
|
7347
7482
|
return;
|
|
7348
7483
|
}
|
|
7349
7484
|
const factory = callee.property.name;
|
|
@@ -7358,7 +7493,7 @@ var prefer_module_level_schema_default = createRule({
|
|
|
7358
7493
|
return;
|
|
7359
7494
|
}
|
|
7360
7495
|
const shape = node.arguments[0];
|
|
7361
|
-
if (shape !== void 0 && shape.type ===
|
|
7496
|
+
if (shape !== void 0 && shape.type === import_utils51.AST_NODE_TYPES.ObjectExpression && shape.properties.length < minProperties) {
|
|
7362
7497
|
return;
|
|
7363
7498
|
}
|
|
7364
7499
|
const expression = schemaExpression(node);
|
|
@@ -7386,9 +7521,9 @@ var prefer_module_level_schema_default = createRule({
|
|
|
7386
7521
|
});
|
|
7387
7522
|
|
|
7388
7523
|
// src/rules/prefer-native-random-uuid.ts
|
|
7389
|
-
var
|
|
7524
|
+
var import_utils52 = require("@typescript-eslint/utils");
|
|
7390
7525
|
function requireUuid(node) {
|
|
7391
|
-
return node?.type ===
|
|
7526
|
+
return node?.type === import_utils52.AST_NODE_TYPES.CallExpression && node.callee.type === import_utils52.AST_NODE_TYPES.Identifier && node.callee.name === "require" && node.arguments.length === 1 && node.arguments[0]?.type === import_utils52.AST_NODE_TYPES.Literal && node.arguments[0].value === "uuid";
|
|
7392
7527
|
}
|
|
7393
7528
|
var prefer_native_random_uuid_default = createRule({
|
|
7394
7529
|
name: "prefer-native-random-uuid",
|
|
@@ -7409,7 +7544,7 @@ var prefer_native_random_uuid_default = createRule({
|
|
|
7409
7544
|
const directBindings = /* @__PURE__ */ new Set();
|
|
7410
7545
|
const namespaceBindings = /* @__PURE__ */ new Set();
|
|
7411
7546
|
function resolve(identifier) {
|
|
7412
|
-
return
|
|
7547
|
+
return import_utils52.ASTUtils.findVariable(context.sourceCode.getScope(identifier), identifier.name);
|
|
7413
7548
|
}
|
|
7414
7549
|
function record(identifier, destination) {
|
|
7415
7550
|
const variable = resolve(identifier);
|
|
@@ -7431,37 +7566,37 @@ var prefer_native_random_uuid_default = createRule({
|
|
|
7431
7566
|
ImportDeclaration(node) {
|
|
7432
7567
|
if (node.source.value !== "uuid") return;
|
|
7433
7568
|
for (const specifier of node.specifiers) {
|
|
7434
|
-
if (specifier.type ===
|
|
7569
|
+
if (specifier.type === import_utils52.AST_NODE_TYPES.ImportSpecifier && (specifier.imported.type === import_utils52.AST_NODE_TYPES.Identifier ? specifier.imported.name === "v4" : specifier.imported.value === "v4")) {
|
|
7435
7570
|
record(specifier.local, directBindings);
|
|
7436
|
-
} else if (specifier.type ===
|
|
7571
|
+
} else if (specifier.type === import_utils52.AST_NODE_TYPES.ImportNamespaceSpecifier) {
|
|
7437
7572
|
record(specifier.local, namespaceBindings);
|
|
7438
7573
|
}
|
|
7439
7574
|
}
|
|
7440
7575
|
},
|
|
7441
7576
|
VariableDeclarator(node) {
|
|
7442
7577
|
if (node.parent.kind !== "const" || !requireUuid(node.init)) return;
|
|
7443
|
-
if (node.init?.type !==
|
|
7578
|
+
if (node.init?.type !== import_utils52.AST_NODE_TYPES.CallExpression || node.init.callee.type !== import_utils52.AST_NODE_TYPES.Identifier || (resolve(node.init.callee)?.defs.length ?? 0) > 0) {
|
|
7444
7579
|
return;
|
|
7445
7580
|
}
|
|
7446
|
-
if (node.id.type ===
|
|
7581
|
+
if (node.id.type === import_utils52.AST_NODE_TYPES.Identifier) {
|
|
7447
7582
|
record(node.id, namespaceBindings);
|
|
7448
7583
|
return;
|
|
7449
7584
|
}
|
|
7450
|
-
if (node.id.type !==
|
|
7585
|
+
if (node.id.type !== import_utils52.AST_NODE_TYPES.ObjectPattern) return;
|
|
7451
7586
|
for (const property of node.id.properties) {
|
|
7452
|
-
if (property.type ===
|
|
7587
|
+
if (property.type === import_utils52.AST_NODE_TYPES.Property && !property.computed && (property.key.type === import_utils52.AST_NODE_TYPES.Identifier && property.key.name === "v4" || property.key.type === import_utils52.AST_NODE_TYPES.Literal && property.key.value === "v4") && property.value.type === import_utils52.AST_NODE_TYPES.Identifier) {
|
|
7453
7588
|
record(property.value, directBindings);
|
|
7454
7589
|
}
|
|
7455
7590
|
}
|
|
7456
7591
|
},
|
|
7457
7592
|
"CallExpression:exit"(node) {
|
|
7458
7593
|
if (node.arguments.length !== 0) return;
|
|
7459
|
-
if (node.callee.type ===
|
|
7594
|
+
if (node.callee.type === import_utils52.AST_NODE_TYPES.Identifier) {
|
|
7460
7595
|
const variable2 = resolve(node.callee);
|
|
7461
7596
|
if (variable2 !== null && directBindings.has(variable2)) report(node);
|
|
7462
7597
|
return;
|
|
7463
7598
|
}
|
|
7464
|
-
if (node.callee.type !==
|
|
7599
|
+
if (node.callee.type !== import_utils52.AST_NODE_TYPES.MemberExpression || node.callee.computed || node.callee.object.type !== import_utils52.AST_NODE_TYPES.Identifier || node.callee.property.type !== import_utils52.AST_NODE_TYPES.Identifier || node.callee.property.name !== "v4") {
|
|
7465
7600
|
return;
|
|
7466
7601
|
}
|
|
7467
7602
|
const variable = resolve(node.callee.object);
|
|
@@ -7472,20 +7607,20 @@ var prefer_native_random_uuid_default = createRule({
|
|
|
7472
7607
|
});
|
|
7473
7608
|
|
|
7474
7609
|
// src/rules/prefer-non-nullable-collection.ts
|
|
7475
|
-
var
|
|
7610
|
+
var import_utils53 = require("@typescript-eslint/utils");
|
|
7476
7611
|
var ARRAY_TYPE_NAMES = /* @__PURE__ */ new Set(["Array", "ReadonlyArray"]);
|
|
7477
7612
|
function propertyName(node) {
|
|
7478
7613
|
const key = node.key;
|
|
7479
|
-
if (key.type ===
|
|
7480
|
-
if (key.type ===
|
|
7614
|
+
if (key.type === import_utils53.AST_NODE_TYPES.Identifier) return key.name;
|
|
7615
|
+
if (key.type === import_utils53.AST_NODE_TYPES.Literal) return String(key.value);
|
|
7481
7616
|
return "collection";
|
|
7482
7617
|
}
|
|
7483
7618
|
function isArrayType(node) {
|
|
7484
|
-
if (node.type ===
|
|
7485
|
-
return node.type ===
|
|
7619
|
+
if (node.type === import_utils53.AST_NODE_TYPES.TSArrayType) return true;
|
|
7620
|
+
return node.type === import_utils53.AST_NODE_TYPES.TSTypeReference && node.typeName.type === import_utils53.AST_NODE_TYPES.Identifier && ARRAY_TYPE_NAMES.has(node.typeName.name);
|
|
7486
7621
|
}
|
|
7487
7622
|
function isNullishType(node) {
|
|
7488
|
-
return node.type ===
|
|
7623
|
+
return node.type === import_utils53.AST_NODE_TYPES.TSNullKeyword || node.type === import_utils53.AST_NODE_TYPES.TSUndefinedKeyword;
|
|
7489
7624
|
}
|
|
7490
7625
|
function isNullableArrayOnly(node) {
|
|
7491
7626
|
const values = node.types.filter((member) => !isNullishType(member));
|
|
@@ -7513,7 +7648,7 @@ var prefer_non_nullable_collection_default = createRule({
|
|
|
7513
7648
|
if (node.optional) return;
|
|
7514
7649
|
const annotation = node.typeAnnotation?.typeAnnotation;
|
|
7515
7650
|
if (annotation === void 0) return;
|
|
7516
|
-
if (annotation.type !==
|
|
7651
|
+
if (annotation.type !== import_utils53.AST_NODE_TYPES.TSUnionType || !isNullableArrayOnly(annotation)) {
|
|
7517
7652
|
return;
|
|
7518
7653
|
}
|
|
7519
7654
|
context.report({
|
|
@@ -7526,7 +7661,7 @@ var prefer_non_nullable_collection_default = createRule({
|
|
|
7526
7661
|
TSPropertySignature: checkOptionalProperty,
|
|
7527
7662
|
PropertyDefinition: checkOptionalProperty,
|
|
7528
7663
|
TSTypeAliasDeclaration(node) {
|
|
7529
|
-
if (node.typeAnnotation.type !==
|
|
7664
|
+
if (node.typeAnnotation.type !== import_utils53.AST_NODE_TYPES.TSUnionType) return;
|
|
7530
7665
|
if (!isNullableArrayOnly(node.typeAnnotation)) return;
|
|
7531
7666
|
context.report({
|
|
7532
7667
|
node,
|
|
@@ -7539,13 +7674,13 @@ var prefer_non_nullable_collection_default = createRule({
|
|
|
7539
7674
|
});
|
|
7540
7675
|
|
|
7541
7676
|
// src/rules/prefer-schema-for-api-payload.ts
|
|
7542
|
-
var
|
|
7677
|
+
var import_utils54 = require("@typescript-eslint/utils");
|
|
7543
7678
|
var unwrap4 = (node) => {
|
|
7544
7679
|
let current = node;
|
|
7545
7680
|
while (current !== null && current !== void 0) {
|
|
7546
|
-
if (current.type ===
|
|
7681
|
+
if (current.type === import_utils54.AST_NODE_TYPES.TSAsExpression || current.type === import_utils54.AST_NODE_TYPES.TSTypeAssertion || current.type === import_utils54.AST_NODE_TYPES.TSNonNullExpression || current.type === import_utils54.AST_NODE_TYPES.TSSatisfiesExpression) {
|
|
7547
7682
|
current = current.expression;
|
|
7548
|
-
} else if (current.type ===
|
|
7683
|
+
} else if (current.type === import_utils54.AST_NODE_TYPES.ChainExpression) {
|
|
7549
7684
|
current = current.expression;
|
|
7550
7685
|
} else {
|
|
7551
7686
|
break;
|
|
@@ -7560,23 +7695,23 @@ var PROMISE_CHAIN_METHODS = /* @__PURE__ */ new Set([
|
|
|
7560
7695
|
]);
|
|
7561
7696
|
var isSchemaParseReference = (node) => {
|
|
7562
7697
|
const inner = unwrap4(node);
|
|
7563
|
-
return inner !== null && inner.type ===
|
|
7698
|
+
return inner !== null && inner.type === import_utils54.AST_NODE_TYPES.MemberExpression && !inner.computed && inner.property.type === import_utils54.AST_NODE_TYPES.Identifier && (inner.property.name === "parse" || inner.property.name === "safeParse");
|
|
7564
7699
|
};
|
|
7565
7700
|
var isRawPayloadSource = (node) => {
|
|
7566
7701
|
let current = unwrap4(node);
|
|
7567
7702
|
if (current === null) return false;
|
|
7568
|
-
if (current.type ===
|
|
7703
|
+
if (current.type === import_utils54.AST_NODE_TYPES.AwaitExpression) {
|
|
7569
7704
|
current = unwrap4(current.argument);
|
|
7570
7705
|
}
|
|
7571
|
-
if (current === null || current.type !==
|
|
7706
|
+
if (current === null || current.type !== import_utils54.AST_NODE_TYPES.CallExpression) {
|
|
7572
7707
|
return false;
|
|
7573
7708
|
}
|
|
7574
7709
|
const callee = unwrap4(current.callee);
|
|
7575
|
-
if (callee === null || callee.type !==
|
|
7710
|
+
if (callee === null || callee.type !== import_utils54.AST_NODE_TYPES.MemberExpression) {
|
|
7576
7711
|
return false;
|
|
7577
7712
|
}
|
|
7578
7713
|
const property = unwrap4(callee.property);
|
|
7579
|
-
if (property === null || property.type !==
|
|
7714
|
+
if (property === null || property.type !== import_utils54.AST_NODE_TYPES.Identifier) {
|
|
7580
7715
|
return false;
|
|
7581
7716
|
}
|
|
7582
7717
|
if (property.name === "json") {
|
|
@@ -7586,16 +7721,16 @@ var isRawPayloadSource = (node) => {
|
|
|
7586
7721
|
return !current.arguments.some(isSchemaParseReference) && isRawPayloadSource(callee.object);
|
|
7587
7722
|
}
|
|
7588
7723
|
const object = unwrap4(callee.object);
|
|
7589
|
-
return property.name === "parse" && object !== null && object.type ===
|
|
7724
|
+
return property.name === "parse" && object !== null && object.type === import_utils54.AST_NODE_TYPES.Identifier && object.name === "JSON" && !isLocalFileRead(current.arguments[0]);
|
|
7590
7725
|
};
|
|
7591
7726
|
var FILE_READ_RE = /^(readFile|readFileSync|readJson|readJsonSync|readJSON)$/;
|
|
7592
7727
|
var isLocalFileRead = (node) => {
|
|
7593
7728
|
let found = false;
|
|
7594
7729
|
const visit = (current) => {
|
|
7595
7730
|
if (found || current === null || current === void 0) return;
|
|
7596
|
-
if (current.type ===
|
|
7731
|
+
if (current.type === import_utils54.AST_NODE_TYPES.CallExpression) {
|
|
7597
7732
|
const callee = unwrap4(current.callee);
|
|
7598
|
-
const name = callee?.type ===
|
|
7733
|
+
const name = callee?.type === import_utils54.AST_NODE_TYPES.Identifier ? callee.name : callee?.type === import_utils54.AST_NODE_TYPES.MemberExpression && !callee.computed && callee.property.type === import_utils54.AST_NODE_TYPES.Identifier ? callee.property.name : null;
|
|
7599
7734
|
if (name !== null && FILE_READ_RE.test(name)) {
|
|
7600
7735
|
found = true;
|
|
7601
7736
|
return;
|
|
@@ -7617,15 +7752,15 @@ var isLocalFileRead = (node) => {
|
|
|
7617
7752
|
var ASSERTION_CALLEE_RE = /^(expect|assert|should|invariant)$/;
|
|
7618
7753
|
var isInsideAssertion = (node) => {
|
|
7619
7754
|
for (let current = node.parent; current !== void 0 && current !== null; current = current.parent) {
|
|
7620
|
-
if (current.type !==
|
|
7755
|
+
if (current.type !== import_utils54.AST_NODE_TYPES.CallExpression) continue;
|
|
7621
7756
|
let callee = current.callee;
|
|
7622
|
-
while (callee.type ===
|
|
7757
|
+
while (callee.type === import_utils54.AST_NODE_TYPES.MemberExpression) {
|
|
7623
7758
|
callee = callee.object;
|
|
7624
7759
|
}
|
|
7625
|
-
if (callee.type ===
|
|
7760
|
+
if (callee.type === import_utils54.AST_NODE_TYPES.CallExpression) {
|
|
7626
7761
|
callee = callee.callee;
|
|
7627
7762
|
}
|
|
7628
|
-
if (callee.type ===
|
|
7763
|
+
if (callee.type === import_utils54.AST_NODE_TYPES.Identifier && ASSERTION_CALLEE_RE.test(callee.name)) {
|
|
7629
7764
|
return true;
|
|
7630
7765
|
}
|
|
7631
7766
|
}
|
|
@@ -7644,39 +7779,39 @@ var GUARD_NAME_RE = /^(?:is|validate|parse|assert|decode|coerce)[A-Z]/;
|
|
|
7644
7779
|
var isValidationRead = (node) => {
|
|
7645
7780
|
let current = node;
|
|
7646
7781
|
let parent = current.parent;
|
|
7647
|
-
while (parent !== null && parent !== void 0 && (parent.type ===
|
|
7782
|
+
while (parent !== null && parent !== void 0 && (parent.type === import_utils54.AST_NODE_TYPES.TSAsExpression || parent.type === import_utils54.AST_NODE_TYPES.TSTypeAssertion || parent.type === import_utils54.AST_NODE_TYPES.TSNonNullExpression || parent.type === import_utils54.AST_NODE_TYPES.TSSatisfiesExpression || parent.type === import_utils54.AST_NODE_TYPES.ChainExpression)) {
|
|
7648
7783
|
current = parent;
|
|
7649
7784
|
parent = parent.parent;
|
|
7650
7785
|
}
|
|
7651
7786
|
if (parent === null || parent === void 0) return false;
|
|
7652
|
-
if (parent.type ===
|
|
7787
|
+
if (parent.type === import_utils54.AST_NODE_TYPES.UnaryExpression && parent.operator === "typeof" && parent.argument === current) {
|
|
7653
7788
|
return true;
|
|
7654
7789
|
}
|
|
7655
|
-
if (parent.type !==
|
|
7790
|
+
if (parent.type !== import_utils54.AST_NODE_TYPES.CallExpression || !parent.arguments.some((arg) => arg === current)) {
|
|
7656
7791
|
return false;
|
|
7657
7792
|
}
|
|
7658
7793
|
const callee = parent.callee;
|
|
7659
|
-
if (callee.type ===
|
|
7794
|
+
if (callee.type === import_utils54.AST_NODE_TYPES.MemberExpression && !callee.computed && callee.object.type === import_utils54.AST_NODE_TYPES.Identifier && callee.object.name === "Array" && callee.property.type === import_utils54.AST_NODE_TYPES.Identifier && callee.property.name === "isArray") {
|
|
7660
7795
|
return parent.arguments.length === 1;
|
|
7661
7796
|
}
|
|
7662
|
-
return callee.type ===
|
|
7797
|
+
return callee.type === import_utils54.AST_NODE_TYPES.Identifier && GUARD_NAME_RE.test(callee.name);
|
|
7663
7798
|
};
|
|
7664
7799
|
var isGuardTestPosition = (node) => {
|
|
7665
7800
|
let current = node;
|
|
7666
7801
|
let parent = current.parent;
|
|
7667
7802
|
while (parent !== void 0 && parent !== null) {
|
|
7668
7803
|
switch (parent.type) {
|
|
7669
|
-
case
|
|
7670
|
-
case
|
|
7671
|
-
case
|
|
7804
|
+
case import_utils54.AST_NODE_TYPES.UnaryExpression:
|
|
7805
|
+
case import_utils54.AST_NODE_TYPES.LogicalExpression:
|
|
7806
|
+
case import_utils54.AST_NODE_TYPES.ChainExpression:
|
|
7672
7807
|
current = parent;
|
|
7673
7808
|
parent = parent.parent;
|
|
7674
7809
|
continue;
|
|
7675
|
-
case
|
|
7676
|
-
case
|
|
7677
|
-
case
|
|
7678
|
-
case
|
|
7679
|
-
case
|
|
7810
|
+
case import_utils54.AST_NODE_TYPES.IfStatement:
|
|
7811
|
+
case import_utils54.AST_NODE_TYPES.ConditionalExpression:
|
|
7812
|
+
case import_utils54.AST_NODE_TYPES.WhileStatement:
|
|
7813
|
+
case import_utils54.AST_NODE_TYPES.DoWhileStatement:
|
|
7814
|
+
case import_utils54.AST_NODE_TYPES.ForStatement:
|
|
7680
7815
|
return parent.test === current;
|
|
7681
7816
|
default:
|
|
7682
7817
|
return false;
|
|
@@ -7686,7 +7821,7 @@ var isGuardTestPosition = (node) => {
|
|
|
7686
7821
|
};
|
|
7687
7822
|
var isUnvalidatedVariableRef = (node, scope, tracked) => {
|
|
7688
7823
|
const unwrapped = unwrap4(node);
|
|
7689
|
-
if (unwrapped === null || unwrapped.type !==
|
|
7824
|
+
if (unwrapped === null || unwrapped.type !== import_utils54.AST_NODE_TYPES.Identifier) {
|
|
7690
7825
|
return false;
|
|
7691
7826
|
}
|
|
7692
7827
|
const variable = findVariable2(scope, unwrapped.name);
|
|
@@ -7729,11 +7864,11 @@ var prefer_schema_for_api_payload_default = createRule({
|
|
|
7729
7864
|
return {
|
|
7730
7865
|
VariableDeclarator(node) {
|
|
7731
7866
|
const scope = context.sourceCode.getScope(node);
|
|
7732
|
-
if (node.id.type ===
|
|
7867
|
+
if (node.id.type === import_utils54.AST_NODE_TYPES.Identifier) {
|
|
7733
7868
|
trackInitializer(node);
|
|
7734
7869
|
return;
|
|
7735
7870
|
}
|
|
7736
|
-
if (node.id.type ===
|
|
7871
|
+
if (node.id.type === import_utils54.AST_NODE_TYPES.ObjectPattern || node.id.type === import_utils54.AST_NODE_TYPES.ArrayPattern) {
|
|
7737
7872
|
if (isRawPayloadSource(node.init)) {
|
|
7738
7873
|
if (!isFullyNarrowedPattern(node)) {
|
|
7739
7874
|
context.report({ node: node.id, messageId: "unparsedJsonAccess" });
|
|
@@ -7747,7 +7882,7 @@ var prefer_schema_for_api_payload_default = createRule({
|
|
|
7747
7882
|
},
|
|
7748
7883
|
AssignmentExpression(node) {
|
|
7749
7884
|
const scope = context.sourceCode.getScope(node);
|
|
7750
|
-
if (node.left.type ===
|
|
7885
|
+
if (node.left.type === import_utils54.AST_NODE_TYPES.Identifier) {
|
|
7751
7886
|
const variable = findVariable2(scope, node.left.name);
|
|
7752
7887
|
if (variable === null) return;
|
|
7753
7888
|
if (isRawPayloadSource(node.right)) {
|
|
@@ -7757,7 +7892,7 @@ var prefer_schema_for_api_payload_default = createRule({
|
|
|
7757
7892
|
}
|
|
7758
7893
|
return;
|
|
7759
7894
|
}
|
|
7760
|
-
if (node.left.type ===
|
|
7895
|
+
if (node.left.type === import_utils54.AST_NODE_TYPES.ObjectPattern || node.left.type === import_utils54.AST_NODE_TYPES.ArrayPattern) {
|
|
7761
7896
|
if (isRawPayloadSource(node.right)) {
|
|
7762
7897
|
context.report({
|
|
7763
7898
|
node: node.left,
|
|
@@ -7774,15 +7909,15 @@ var prefer_schema_for_api_payload_default = createRule({
|
|
|
7774
7909
|
}
|
|
7775
7910
|
},
|
|
7776
7911
|
CallExpression(node) {
|
|
7777
|
-
if (node.callee.type !==
|
|
7912
|
+
if (node.callee.type !== import_utils54.AST_NODE_TYPES.Identifier) return;
|
|
7778
7913
|
if (!GUARD_NAME_RE.test(node.callee.name) && !isGuardTestPosition(node)) {
|
|
7779
7914
|
return;
|
|
7780
7915
|
}
|
|
7781
7916
|
const scope = context.sourceCode.getScope(node);
|
|
7782
7917
|
for (const arg of node.arguments) {
|
|
7783
|
-
if (arg.type ===
|
|
7918
|
+
if (arg.type === import_utils54.AST_NODE_TYPES.SpreadElement) continue;
|
|
7784
7919
|
const unwrapped = unwrap4(arg);
|
|
7785
|
-
if (unwrapped === null || unwrapped.type !==
|
|
7920
|
+
if (unwrapped === null || unwrapped.type !== import_utils54.AST_NODE_TYPES.Identifier) {
|
|
7786
7921
|
continue;
|
|
7787
7922
|
}
|
|
7788
7923
|
const variable = findVariable2(scope, unwrapped.name);
|
|
@@ -7796,13 +7931,13 @@ var prefer_schema_for_api_payload_default = createRule({
|
|
|
7796
7931
|
const obj = unwrap4(node.object);
|
|
7797
7932
|
if (isRawPayloadSource(obj)) {
|
|
7798
7933
|
const parent = node.parent;
|
|
7799
|
-
if (parent.type ===
|
|
7934
|
+
if (parent.type === import_utils54.AST_NODE_TYPES.CallExpression && parent.callee === node && node.property.type === import_utils54.AST_NODE_TYPES.Identifier && (node.property.name === "parse" || node.property.name === "safeParse" || PROMISE_CHAIN_METHODS.has(node.property.name))) {
|
|
7800
7935
|
return;
|
|
7801
7936
|
}
|
|
7802
7937
|
context.report({ node, messageId: "unparsedJsonAccess" });
|
|
7803
7938
|
return;
|
|
7804
7939
|
}
|
|
7805
|
-
if (obj !== null && obj.type ===
|
|
7940
|
+
if (obj !== null && obj.type === import_utils54.AST_NODE_TYPES.Identifier && isUnvalidatedVariableRef(obj, scope, unvalidatedVariables)) {
|
|
7806
7941
|
context.report({ node, messageId: "unparsedJsonAccess" });
|
|
7807
7942
|
const variable = findVariable2(scope, obj.name);
|
|
7808
7943
|
if (variable !== null) {
|
|
@@ -7815,7 +7950,7 @@ var prefer_schema_for_api_payload_default = createRule({
|
|
|
7815
7950
|
});
|
|
7816
7951
|
|
|
7817
7952
|
// src/rules/prefer-semantic-colors.ts
|
|
7818
|
-
var
|
|
7953
|
+
var import_utils55 = require("@typescript-eslint/utils");
|
|
7819
7954
|
var import_fs = require("fs");
|
|
7820
7955
|
var import_path = require("path");
|
|
7821
7956
|
|
|
@@ -7915,8 +8050,8 @@ var SVG_EXEMPT_COLOR_VALUES = /* @__PURE__ */ new Set([
|
|
|
7915
8050
|
]);
|
|
7916
8051
|
function jsxElementName(node) {
|
|
7917
8052
|
const name = node.openingElement.name;
|
|
7918
|
-
if (name.type ===
|
|
7919
|
-
if (name.type ===
|
|
8053
|
+
if (name.type === import_utils55.AST_NODE_TYPES.JSXIdentifier) return name.name;
|
|
8054
|
+
if (name.type === import_utils55.AST_NODE_TYPES.JSXMemberExpression && name.property.type === import_utils55.AST_NODE_TYPES.JSXIdentifier) {
|
|
7920
8055
|
return name.property.name;
|
|
7921
8056
|
}
|
|
7922
8057
|
return null;
|
|
@@ -7942,7 +8077,7 @@ var EMAIL_OR_PDF_MODULE_RE = /^@react-(?:email|pdf)\//;
|
|
|
7942
8077
|
var isInsideSvg = (node) => {
|
|
7943
8078
|
let current = node.parent;
|
|
7944
8079
|
while (current !== void 0 && current !== null) {
|
|
7945
|
-
if (current.type ===
|
|
8080
|
+
if (current.type === import_utils55.AST_NODE_TYPES.JSXElement) {
|
|
7946
8081
|
const name = jsxElementName(current);
|
|
7947
8082
|
if (name !== null && isSvgLikeElementName(name)) return true;
|
|
7948
8083
|
}
|
|
@@ -7953,7 +8088,7 @@ var isInsideSvg = (node) => {
|
|
|
7953
8088
|
var isInsideIconFactoryPath = (node) => {
|
|
7954
8089
|
let current = node.parent;
|
|
7955
8090
|
while (current !== void 0 && current !== null) {
|
|
7956
|
-
if (current.type ===
|
|
8091
|
+
if (current.type === import_utils55.AST_NODE_TYPES.Property && propName(current.key) === "path" && current.parent.type === import_utils55.AST_NODE_TYPES.ObjectExpression && current.parent.parent.type === import_utils55.AST_NODE_TYPES.CallExpression && current.parent.parent.callee.type === import_utils55.AST_NODE_TYPES.Identifier && current.parent.parent.callee.name === "createIcon") {
|
|
7957
8092
|
return true;
|
|
7958
8093
|
}
|
|
7959
8094
|
current = current.parent;
|
|
@@ -8090,12 +8225,12 @@ var hasSemanticTokenSystem = (filename) => {
|
|
|
8090
8225
|
return root !== null && workspaceHasMarker(root);
|
|
8091
8226
|
};
|
|
8092
8227
|
var propName = (key) => {
|
|
8093
|
-
if (key.type ===
|
|
8094
|
-
if (key.type ===
|
|
8228
|
+
if (key.type === import_utils55.AST_NODE_TYPES.Identifier) return key.name;
|
|
8229
|
+
if (key.type === import_utils55.AST_NODE_TYPES.Literal && typeof key.value === "string") return key.value;
|
|
8095
8230
|
return null;
|
|
8096
8231
|
};
|
|
8097
8232
|
var staticallyImportsEmailOrPdfRenderer = (program) => program.body.some((statement) => {
|
|
8098
|
-
if (statement.type !==
|
|
8233
|
+
if (statement.type !== import_utils55.AST_NODE_TYPES.ImportDeclaration && statement.type !== import_utils55.AST_NODE_TYPES.ExportNamedDeclaration && statement.type !== import_utils55.AST_NODE_TYPES.ExportAllDeclaration) {
|
|
8099
8234
|
return false;
|
|
8100
8235
|
}
|
|
8101
8236
|
return statement.source !== null && typeof statement.source.value === "string" && EMAIL_OR_PDF_MODULE_RE.test(statement.source.value);
|
|
@@ -8147,27 +8282,27 @@ var prefer_semantic_colors_default = createRule({
|
|
|
8147
8282
|
const checkClassNode = (node) => {
|
|
8148
8283
|
if (node === null) return;
|
|
8149
8284
|
switch (node.type) {
|
|
8150
|
-
case
|
|
8285
|
+
case import_utils55.AST_NODE_TYPES.Literal:
|
|
8151
8286
|
if (typeof node.value === "string") reportClasses(node.value, node);
|
|
8152
8287
|
break;
|
|
8153
|
-
case
|
|
8288
|
+
case import_utils55.AST_NODE_TYPES.TemplateLiteral:
|
|
8154
8289
|
for (const quasi of node.quasis) reportClasses(quasi.value.cooked ?? "", quasi);
|
|
8155
8290
|
break;
|
|
8156
|
-
case
|
|
8291
|
+
case import_utils55.AST_NODE_TYPES.ArrayExpression:
|
|
8157
8292
|
for (const element of node.elements) {
|
|
8158
|
-
if (element !== null && element.type !==
|
|
8293
|
+
if (element !== null && element.type !== import_utils55.AST_NODE_TYPES.SpreadElement) checkClassNode(element);
|
|
8159
8294
|
}
|
|
8160
8295
|
break;
|
|
8161
|
-
case
|
|
8296
|
+
case import_utils55.AST_NODE_TYPES.ObjectExpression:
|
|
8162
8297
|
for (const property of node.properties) {
|
|
8163
|
-
if (property.type ===
|
|
8298
|
+
if (property.type === import_utils55.AST_NODE_TYPES.Property) checkClassNode(property.value);
|
|
8164
8299
|
}
|
|
8165
8300
|
break;
|
|
8166
|
-
case
|
|
8301
|
+
case import_utils55.AST_NODE_TYPES.ConditionalExpression:
|
|
8167
8302
|
checkClassNode(node.consequent);
|
|
8168
8303
|
checkClassNode(node.alternate);
|
|
8169
8304
|
break;
|
|
8170
|
-
case
|
|
8305
|
+
case import_utils55.AST_NODE_TYPES.LogicalExpression:
|
|
8171
8306
|
checkClassNode(node.right);
|
|
8172
8307
|
break;
|
|
8173
8308
|
default:
|
|
@@ -8175,32 +8310,32 @@ var prefer_semantic_colors_default = createRule({
|
|
|
8175
8310
|
}
|
|
8176
8311
|
};
|
|
8177
8312
|
const checkColorValueNode = (node) => {
|
|
8178
|
-
if (node.type ===
|
|
8313
|
+
if (node.type === import_utils55.AST_NODE_TYPES.Literal && typeof node.value === "string" && RAW_COLOR_VALUE_RE.test(node.value) && !CSS_VAR_REFERENCE_RE.test(node.value)) {
|
|
8179
8314
|
report(node, "inlineColor", { value: node.value });
|
|
8180
8315
|
}
|
|
8181
8316
|
};
|
|
8182
8317
|
return {
|
|
8183
8318
|
"JSXAttribute[name.name='className']"(node) {
|
|
8184
8319
|
if (node.value === null) return;
|
|
8185
|
-
if (node.value.type ===
|
|
8186
|
-
else if (node.value.type ===
|
|
8187
|
-
if (node.value.expression.type !==
|
|
8320
|
+
if (node.value.type === import_utils55.AST_NODE_TYPES.Literal) checkClassNode(node.value);
|
|
8321
|
+
else if (node.value.type === import_utils55.AST_NODE_TYPES.JSXExpressionContainer) {
|
|
8322
|
+
if (node.value.expression.type !== import_utils55.AST_NODE_TYPES.JSXEmptyExpression) {
|
|
8188
8323
|
checkClassNode(node.value.expression);
|
|
8189
8324
|
}
|
|
8190
8325
|
}
|
|
8191
8326
|
},
|
|
8192
8327
|
CallExpression(node) {
|
|
8193
|
-
if (node.callee.type ===
|
|
8328
|
+
if (node.callee.type === import_utils55.AST_NODE_TYPES.Identifier && node.callee.name === "require" && node.arguments[0]?.type === import_utils55.AST_NODE_TYPES.Literal && typeof node.arguments[0].value === "string" && EMAIL_OR_PDF_MODULE_RE.test(node.arguments[0].value)) {
|
|
8194
8329
|
importsEmailOrPdfRenderer = true;
|
|
8195
8330
|
}
|
|
8196
|
-
if (node.callee.type ===
|
|
8331
|
+
if (node.callee.type === import_utils55.AST_NODE_TYPES.Identifier && CLASS_FNS.has(node.callee.name)) {
|
|
8197
8332
|
for (const arg of node.arguments) {
|
|
8198
|
-
if (arg.type !==
|
|
8333
|
+
if (arg.type !== import_utils55.AST_NODE_TYPES.SpreadElement) checkClassNode(arg);
|
|
8199
8334
|
}
|
|
8200
8335
|
}
|
|
8201
8336
|
},
|
|
8202
8337
|
VariableDeclarator(node) {
|
|
8203
|
-
if (node.id.type ===
|
|
8338
|
+
if (node.id.type === import_utils55.AST_NODE_TYPES.Identifier && CLASS_NAME_RE.test(node.id.name)) {
|
|
8204
8339
|
checkClassNode(node.init);
|
|
8205
8340
|
}
|
|
8206
8341
|
},
|
|
@@ -8210,9 +8345,9 @@ var prefer_semantic_colors_default = createRule({
|
|
|
8210
8345
|
},
|
|
8211
8346
|
// SVG artwork colors are exempt; component presentation colors still report.
|
|
8212
8347
|
"JSXAttribute[name.name=/^(fill|stroke|color)$/]"(node) {
|
|
8213
|
-
if (node.value?.type !==
|
|
8348
|
+
if (node.value?.type !== import_utils55.AST_NODE_TYPES.Literal) return;
|
|
8214
8349
|
const owner = node.parent.name;
|
|
8215
|
-
if (owner.type ===
|
|
8350
|
+
if (owner.type === import_utils55.AST_NODE_TYPES.JSXIdentifier && SVG_SHAPE_PRIMITIVES.has(owner.name)) {
|
|
8216
8351
|
return;
|
|
8217
8352
|
}
|
|
8218
8353
|
if (typeof node.value.value === "string" && SVG_EXEMPT_COLOR_VALUES.has(node.value.value.toLowerCase())) {
|
|
@@ -8226,7 +8361,7 @@ var prefer_semantic_colors_default = createRule({
|
|
|
8226
8361
|
if (name !== null && STYLE_COLOR_PROPS.has(name)) checkColorValueNode(node.value);
|
|
8227
8362
|
},
|
|
8228
8363
|
ImportExpression(node) {
|
|
8229
|
-
if (node.source.type ===
|
|
8364
|
+
if (node.source.type === import_utils55.AST_NODE_TYPES.Literal && typeof node.source.value === "string" && EMAIL_OR_PDF_MODULE_RE.test(node.source.value)) {
|
|
8230
8365
|
importsEmailOrPdfRenderer = true;
|
|
8231
8366
|
}
|
|
8232
8367
|
},
|
|
@@ -8239,7 +8374,7 @@ var prefer_semantic_colors_default = createRule({
|
|
|
8239
8374
|
});
|
|
8240
8375
|
|
|
8241
8376
|
// src/rules/prefer-server-actions.ts
|
|
8242
|
-
var
|
|
8377
|
+
var import_utils56 = require("@typescript-eslint/utils");
|
|
8243
8378
|
var MUTATION_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "DELETE", "PATCH"]);
|
|
8244
8379
|
var AXIOS_MUTATION_METHODS = /* @__PURE__ */ new Set(["post", "put", "delete", "patch"]);
|
|
8245
8380
|
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\/)/;
|
|
@@ -8430,7 +8565,7 @@ var prefer_single_sentence_comment_default = createRule({
|
|
|
8430
8565
|
});
|
|
8431
8566
|
|
|
8432
8567
|
// src/rules/prefer-string-literal-union.ts
|
|
8433
|
-
var
|
|
8568
|
+
var import_utils57 = require("@typescript-eslint/utils");
|
|
8434
8569
|
var ts2 = __toESM(require("typescript"), 1);
|
|
8435
8570
|
var CHOICE_TOKENS = /* @__PURE__ */ new Set([
|
|
8436
8571
|
"status",
|
|
@@ -8473,19 +8608,19 @@ function isChoiceLikeName(name) {
|
|
|
8473
8608
|
return CHOICE_TOKENS.has(lastWord(name));
|
|
8474
8609
|
}
|
|
8475
8610
|
function keyName(key) {
|
|
8476
|
-
if (key.type ===
|
|
8611
|
+
if (key.type === import_utils57.AST_NODE_TYPES.Identifier) {
|
|
8477
8612
|
return key.name;
|
|
8478
8613
|
}
|
|
8479
|
-
if (key.type ===
|
|
8614
|
+
if (key.type === import_utils57.AST_NODE_TYPES.Literal && typeof key.value === "string") {
|
|
8480
8615
|
return key.value;
|
|
8481
8616
|
}
|
|
8482
8617
|
return null;
|
|
8483
8618
|
}
|
|
8484
8619
|
function isStringLiteralMember(t) {
|
|
8485
|
-
return t.type ===
|
|
8620
|
+
return t.type === import_utils57.AST_NODE_TYPES.TSLiteralType && t.literal.type === import_utils57.AST_NODE_TYPES.Literal && typeof t.literal.value === "string";
|
|
8486
8621
|
}
|
|
8487
8622
|
function isStringLiteralUnion(node) {
|
|
8488
|
-
if (node?.type !==
|
|
8623
|
+
if (node?.type !== import_utils57.AST_NODE_TYPES.TSUnionType) {
|
|
8489
8624
|
return false;
|
|
8490
8625
|
}
|
|
8491
8626
|
return node.types.filter(isStringLiteralMember).length >= MIN_CLUSTER_SIZE;
|
|
@@ -8514,12 +8649,12 @@ function bindingSourceExpression(decl) {
|
|
|
8514
8649
|
return ts2.isForOfStatement(node) ? node.expression : node.initializer;
|
|
8515
8650
|
}
|
|
8516
8651
|
function refKey(node) {
|
|
8517
|
-
if (node.type ===
|
|
8652
|
+
if (node.type === import_utils57.AST_NODE_TYPES.Identifier) {
|
|
8518
8653
|
return node.name;
|
|
8519
8654
|
}
|
|
8520
|
-
if (node.type ===
|
|
8655
|
+
if (node.type === import_utils57.AST_NODE_TYPES.MemberExpression && !node.computed) {
|
|
8521
8656
|
const inner = refKey(node.object);
|
|
8522
|
-
if (inner === null || node.property.type !==
|
|
8657
|
+
if (inner === null || node.property.type !== import_utils57.AST_NODE_TYPES.Identifier) {
|
|
8523
8658
|
return null;
|
|
8524
8659
|
}
|
|
8525
8660
|
return `${inner}.${node.property.name}`;
|
|
@@ -8527,7 +8662,7 @@ function refKey(node) {
|
|
|
8527
8662
|
return null;
|
|
8528
8663
|
}
|
|
8529
8664
|
function strLiteral(node) {
|
|
8530
|
-
if (node.type ===
|
|
8665
|
+
if (node.type === import_utils57.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
8531
8666
|
return node.value;
|
|
8532
8667
|
}
|
|
8533
8668
|
return null;
|
|
@@ -8568,7 +8703,7 @@ var prefer_string_literal_union_default = createRule({
|
|
|
8568
8703
|
);
|
|
8569
8704
|
let services;
|
|
8570
8705
|
try {
|
|
8571
|
-
services =
|
|
8706
|
+
services = import_utils57.ESLintUtils.getParserServices(context);
|
|
8572
8707
|
} catch {
|
|
8573
8708
|
services = null;
|
|
8574
8709
|
}
|
|
@@ -8680,7 +8815,7 @@ var prefer_string_literal_union_default = createRule({
|
|
|
8680
8815
|
containersWithUnion.add(container);
|
|
8681
8816
|
return;
|
|
8682
8817
|
}
|
|
8683
|
-
if (typeNode?.type !==
|
|
8818
|
+
if (typeNode?.type !== import_utils57.AST_NODE_TYPES.TSStringKeyword) {
|
|
8684
8819
|
return;
|
|
8685
8820
|
}
|
|
8686
8821
|
const name = keyName(key);
|
|
@@ -8768,10 +8903,10 @@ var prefer_string_literal_union_default = createRule({
|
|
|
8768
8903
|
}
|
|
8769
8904
|
};
|
|
8770
8905
|
function refKeyText(node) {
|
|
8771
|
-
if (node.type ===
|
|
8906
|
+
if (node.type === import_utils57.AST_NODE_TYPES.BinaryExpression) {
|
|
8772
8907
|
return refKey(node.left) ?? refKey(node.right) ?? "value";
|
|
8773
8908
|
}
|
|
8774
|
-
if (node.type ===
|
|
8909
|
+
if (node.type === import_utils57.AST_NODE_TYPES.SwitchStatement) {
|
|
8775
8910
|
return refKey(node.discriminant) ?? "value";
|
|
8776
8911
|
}
|
|
8777
8912
|
return "value";
|
|
@@ -8780,7 +8915,7 @@ var prefer_string_literal_union_default = createRule({
|
|
|
8780
8915
|
});
|
|
8781
8916
|
|
|
8782
8917
|
// src/rules/prefer-whole-object-assertion.ts
|
|
8783
|
-
var
|
|
8918
|
+
var import_utils58 = require("@typescript-eslint/utils");
|
|
8784
8919
|
var MERGEABLE_MATCHERS = /* @__PURE__ */ new Set(["toBe", "toEqual", "toStrictEqual"]);
|
|
8785
8920
|
var ARRAY_MATCHERS = /* @__PURE__ */ new Set(["toEqual", "toStrictEqual"]);
|
|
8786
8921
|
var COLLECTION_PROPERTIES = /* @__PURE__ */ new Set(["length", "size"]);
|
|
@@ -8789,11 +8924,11 @@ var NUMERIC_SIGNS2 = /* @__PURE__ */ new Set(["-", "+"]);
|
|
|
8789
8924
|
var MIN_RUN_LENGTH = 2;
|
|
8790
8925
|
function literalText(node, getText) {
|
|
8791
8926
|
switch (node.type) {
|
|
8792
|
-
case
|
|
8927
|
+
case import_utils58.AST_NODE_TYPES.Literal:
|
|
8793
8928
|
return "regex" in node ? null : getText(node);
|
|
8794
|
-
case
|
|
8929
|
+
case import_utils58.AST_NODE_TYPES.TemplateLiteral:
|
|
8795
8930
|
return node.expressions.length === 0 ? getText(node) : null;
|
|
8796
|
-
case
|
|
8931
|
+
case import_utils58.AST_NODE_TYPES.UnaryExpression:
|
|
8797
8932
|
return NUMERIC_SIGNS2.has(node.operator) && literalText(node.argument, getText) !== null ? getText(node) : null;
|
|
8798
8933
|
default:
|
|
8799
8934
|
return null;
|
|
@@ -8801,15 +8936,15 @@ function literalText(node, getText) {
|
|
|
8801
8936
|
}
|
|
8802
8937
|
function isPureReceiver(node) {
|
|
8803
8938
|
switch (node.type) {
|
|
8804
|
-
case
|
|
8805
|
-
case
|
|
8939
|
+
case import_utils58.AST_NODE_TYPES.Identifier:
|
|
8940
|
+
case import_utils58.AST_NODE_TYPES.ThisExpression:
|
|
8806
8941
|
return true;
|
|
8807
|
-
case
|
|
8942
|
+
case import_utils58.AST_NODE_TYPES.MemberExpression:
|
|
8808
8943
|
if (node.optional) {
|
|
8809
8944
|
return false;
|
|
8810
8945
|
}
|
|
8811
8946
|
if (node.computed) {
|
|
8812
|
-
return node.property.type ===
|
|
8947
|
+
return node.property.type === import_utils58.AST_NODE_TYPES.Literal && isPureReceiver(node.object);
|
|
8813
8948
|
}
|
|
8814
8949
|
return isPureReceiver(node.object);
|
|
8815
8950
|
default:
|
|
@@ -8817,7 +8952,7 @@ function isPureReceiver(node) {
|
|
|
8817
8952
|
}
|
|
8818
8953
|
}
|
|
8819
8954
|
function literalIndex(node) {
|
|
8820
|
-
if (node.type !==
|
|
8955
|
+
if (node.type !== import_utils58.AST_NODE_TYPES.Literal || typeof node.value !== "number") {
|
|
8821
8956
|
return null;
|
|
8822
8957
|
}
|
|
8823
8958
|
return Number.isInteger(node.value) && node.value >= 0 ? node.value : null;
|
|
@@ -8843,24 +8978,24 @@ var prefer_whole_object_assertion_default = createRule({
|
|
|
8843
8978
|
}
|
|
8844
8979
|
const { sourceCode } = context;
|
|
8845
8980
|
function parseAssertion(statement) {
|
|
8846
|
-
if (statement.type !==
|
|
8981
|
+
if (statement.type !== import_utils58.AST_NODE_TYPES.ExpressionStatement) {
|
|
8847
8982
|
return null;
|
|
8848
8983
|
}
|
|
8849
8984
|
const call = statement.expression;
|
|
8850
|
-
if (call.type !==
|
|
8985
|
+
if (call.type !== import_utils58.AST_NODE_TYPES.CallExpression) {
|
|
8851
8986
|
return null;
|
|
8852
8987
|
}
|
|
8853
8988
|
const callee = call.callee;
|
|
8854
|
-
if (callee.type !==
|
|
8989
|
+
if (callee.type !== import_utils58.AST_NODE_TYPES.MemberExpression || callee.computed || callee.property.type !== import_utils58.AST_NODE_TYPES.Identifier) {
|
|
8855
8990
|
return null;
|
|
8856
8991
|
}
|
|
8857
8992
|
const matcher = callee.property.name;
|
|
8858
8993
|
const expectCall = callee.object;
|
|
8859
|
-
if (expectCall.type !==
|
|
8994
|
+
if (expectCall.type !== import_utils58.AST_NODE_TYPES.CallExpression || expectCall.callee.type !== import_utils58.AST_NODE_TYPES.Identifier || expectCall.callee.name !== "expect" || expectCall.arguments.length !== 1) {
|
|
8860
8995
|
return null;
|
|
8861
8996
|
}
|
|
8862
8997
|
const actual = expectCall.arguments[0];
|
|
8863
|
-
if (actual === void 0 || actual.type !==
|
|
8998
|
+
if (actual === void 0 || actual.type !== import_utils58.AST_NODE_TYPES.MemberExpression || actual.optional) {
|
|
8864
8999
|
return null;
|
|
8865
9000
|
}
|
|
8866
9001
|
if (!isPureReceiver(actual.object)) {
|
|
@@ -8874,7 +9009,7 @@ var prefer_whole_object_assertion_default = createRule({
|
|
|
8874
9009
|
}
|
|
8875
9010
|
key = { kind: "index", index };
|
|
8876
9011
|
} else {
|
|
8877
|
-
if (actual.property.type !==
|
|
9012
|
+
if (actual.property.type !== import_utils58.AST_NODE_TYPES.Identifier || COLLECTION_PROPERTIES.has(actual.property.name) || LITERAL_KEY_HAZARDS.has(actual.property.name)) {
|
|
8878
9013
|
return null;
|
|
8879
9014
|
}
|
|
8880
9015
|
key = { kind: "property", name: actual.property.name };
|
|
@@ -8886,7 +9021,7 @@ var prefer_whole_object_assertion_default = createRule({
|
|
|
8886
9021
|
return null;
|
|
8887
9022
|
}
|
|
8888
9023
|
const expected = call.arguments[0];
|
|
8889
|
-
if (call.arguments.length !== 1 || expected === void 0 || expected.type ===
|
|
9024
|
+
if (call.arguments.length !== 1 || expected === void 0 || expected.type === import_utils58.AST_NODE_TYPES.SpreadElement) {
|
|
8890
9025
|
return null;
|
|
8891
9026
|
}
|
|
8892
9027
|
const literal = literalText(expected, (node) => sourceCode.getText(node));
|
|
@@ -9001,7 +9136,7 @@ var prefer_whole_object_assertion_default = createRule({
|
|
|
9001
9136
|
});
|
|
9002
9137
|
|
|
9003
9138
|
// src/rules/prefer-zod-enum.ts
|
|
9004
|
-
var
|
|
9139
|
+
var import_utils59 = require("@typescript-eslint/utils");
|
|
9005
9140
|
var prefer_zod_enum_default = createRule({
|
|
9006
9141
|
name: "prefer-zod-enum",
|
|
9007
9142
|
meta: {
|
|
@@ -9021,25 +9156,25 @@ var prefer_zod_enum_default = createRule({
|
|
|
9021
9156
|
const zodNamespaces = /* @__PURE__ */ new Set();
|
|
9022
9157
|
function enumValues(node) {
|
|
9023
9158
|
const callee = node.callee;
|
|
9024
|
-
if (callee.type !==
|
|
9159
|
+
if (callee.type !== import_utils59.AST_NODE_TYPES.MemberExpression || callee.computed || callee.object.type !== import_utils59.AST_NODE_TYPES.Identifier || !zodNamespaces.has(callee.object.name) || callee.property.type !== import_utils59.AST_NODE_TYPES.Identifier || callee.property.name !== "union" || node.arguments.length !== 1) {
|
|
9025
9160
|
return null;
|
|
9026
9161
|
}
|
|
9027
9162
|
const argument = node.arguments[0];
|
|
9028
|
-
if (argument === void 0 || argument.type !==
|
|
9163
|
+
if (argument === void 0 || argument.type !== import_utils59.AST_NODE_TYPES.ArrayExpression || argument.elements.length === 0) {
|
|
9029
9164
|
return null;
|
|
9030
9165
|
}
|
|
9031
9166
|
const values = [];
|
|
9032
9167
|
let canFix = true;
|
|
9033
9168
|
for (const element of argument.elements) {
|
|
9034
|
-
if (element?.type ===
|
|
9169
|
+
if (element?.type === import_utils59.AST_NODE_TYPES.SpreadElement) {
|
|
9035
9170
|
canFix = false;
|
|
9036
9171
|
continue;
|
|
9037
9172
|
}
|
|
9038
|
-
if (element === null || element.type !==
|
|
9173
|
+
if (element === null || element.type !== import_utils59.AST_NODE_TYPES.CallExpression || element.callee.type !== import_utils59.AST_NODE_TYPES.MemberExpression || element.callee.computed || element.callee.object.type !== import_utils59.AST_NODE_TYPES.Identifier || !zodNamespaces.has(element.callee.object.name) || element.callee.property.type !== import_utils59.AST_NODE_TYPES.Identifier || element.callee.property.name !== "literal") {
|
|
9039
9174
|
return null;
|
|
9040
9175
|
}
|
|
9041
9176
|
const value = element.arguments[0];
|
|
9042
|
-
if (element.arguments.length !== 1 || value === void 0 || value.type !==
|
|
9177
|
+
if (element.arguments.length !== 1 || value === void 0 || value.type !== import_utils59.AST_NODE_TYPES.Literal || typeof value.value !== "string") {
|
|
9043
9178
|
canFix = false;
|
|
9044
9179
|
continue;
|
|
9045
9180
|
}
|
|
@@ -9049,11 +9184,11 @@ var prefer_zod_enum_default = createRule({
|
|
|
9049
9184
|
}
|
|
9050
9185
|
function buildFix(node, values) {
|
|
9051
9186
|
const argument = node.arguments[0];
|
|
9052
|
-
if (argument === void 0 || argument.type !==
|
|
9187
|
+
if (argument === void 0 || argument.type !== import_utils59.AST_NODE_TYPES.ArrayExpression || sourceCode.getCommentsInside(argument).length > 0) {
|
|
9053
9188
|
return void 0;
|
|
9054
9189
|
}
|
|
9055
9190
|
const callee = node.callee;
|
|
9056
|
-
if (callee.type !==
|
|
9191
|
+
if (callee.type !== import_utils59.AST_NODE_TYPES.MemberExpression || callee.property.type !== import_utils59.AST_NODE_TYPES.Identifier) {
|
|
9057
9192
|
return void 0;
|
|
9058
9193
|
}
|
|
9059
9194
|
return (fixer) => [
|
|
@@ -9070,7 +9205,7 @@ var prefer_zod_enum_default = createRule({
|
|
|
9070
9205
|
return;
|
|
9071
9206
|
}
|
|
9072
9207
|
for (const specifier of node.specifiers) {
|
|
9073
|
-
if (specifier.type ===
|
|
9208
|
+
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") {
|
|
9074
9209
|
zodNamespaces.add(specifier.local.name);
|
|
9075
9210
|
}
|
|
9076
9211
|
}
|
|
@@ -9092,7 +9227,7 @@ var prefer_zod_enum_default = createRule({
|
|
|
9092
9227
|
});
|
|
9093
9228
|
|
|
9094
9229
|
// src/rules/prefer-zod-infer.ts
|
|
9095
|
-
var
|
|
9230
|
+
var import_utils60 = require("@typescript-eslint/utils");
|
|
9096
9231
|
var SHAPE_PRESERVING_METHODS = /* @__PURE__ */ new Set([
|
|
9097
9232
|
"describe",
|
|
9098
9233
|
"refine",
|
|
@@ -9129,44 +9264,44 @@ var ZOD_TYPE_CONSTRAINTS = /* @__PURE__ */ new Set([
|
|
|
9129
9264
|
"Schema"
|
|
9130
9265
|
]);
|
|
9131
9266
|
var LEAF_NODE_TYPES = {
|
|
9132
|
-
string: [
|
|
9133
|
-
email: [
|
|
9134
|
-
url: [
|
|
9135
|
-
uuid: [
|
|
9136
|
-
ulid: [
|
|
9137
|
-
cuid: [
|
|
9138
|
-
cuid2: [
|
|
9139
|
-
nanoid: [
|
|
9140
|
-
iso: [
|
|
9141
|
-
number: [
|
|
9142
|
-
int: [
|
|
9143
|
-
float32: [
|
|
9144
|
-
float64: [
|
|
9145
|
-
boolean: [
|
|
9146
|
-
bigint: [
|
|
9147
|
-
symbol: [
|
|
9148
|
-
any: [
|
|
9149
|
-
unknown: [
|
|
9150
|
-
never: [
|
|
9151
|
-
void: [
|
|
9152
|
-
null: [
|
|
9153
|
-
undefined: [
|
|
9154
|
-
literal: [
|
|
9155
|
-
date: [
|
|
9156
|
-
array: [
|
|
9157
|
-
tuple: [
|
|
9158
|
-
object: [
|
|
9159
|
-
strictObject: [
|
|
9160
|
-
looseObject: [
|
|
9161
|
-
record: [
|
|
9162
|
-
map: [
|
|
9163
|
-
set: [
|
|
9164
|
-
promise: [
|
|
9165
|
-
enum: [
|
|
9166
|
-
nativeEnum: [
|
|
9167
|
-
union: [
|
|
9168
|
-
discriminatedUnion: [
|
|
9169
|
-
intersection: [
|
|
9267
|
+
string: [import_utils60.AST_NODE_TYPES.TSStringKeyword],
|
|
9268
|
+
email: [import_utils60.AST_NODE_TYPES.TSStringKeyword],
|
|
9269
|
+
url: [import_utils60.AST_NODE_TYPES.TSStringKeyword],
|
|
9270
|
+
uuid: [import_utils60.AST_NODE_TYPES.TSStringKeyword],
|
|
9271
|
+
ulid: [import_utils60.AST_NODE_TYPES.TSStringKeyword],
|
|
9272
|
+
cuid: [import_utils60.AST_NODE_TYPES.TSStringKeyword],
|
|
9273
|
+
cuid2: [import_utils60.AST_NODE_TYPES.TSStringKeyword],
|
|
9274
|
+
nanoid: [import_utils60.AST_NODE_TYPES.TSStringKeyword],
|
|
9275
|
+
iso: [import_utils60.AST_NODE_TYPES.TSStringKeyword],
|
|
9276
|
+
number: [import_utils60.AST_NODE_TYPES.TSNumberKeyword],
|
|
9277
|
+
int: [import_utils60.AST_NODE_TYPES.TSNumberKeyword],
|
|
9278
|
+
float32: [import_utils60.AST_NODE_TYPES.TSNumberKeyword],
|
|
9279
|
+
float64: [import_utils60.AST_NODE_TYPES.TSNumberKeyword],
|
|
9280
|
+
boolean: [import_utils60.AST_NODE_TYPES.TSBooleanKeyword],
|
|
9281
|
+
bigint: [import_utils60.AST_NODE_TYPES.TSBigIntKeyword],
|
|
9282
|
+
symbol: [import_utils60.AST_NODE_TYPES.TSSymbolKeyword],
|
|
9283
|
+
any: [import_utils60.AST_NODE_TYPES.TSAnyKeyword],
|
|
9284
|
+
unknown: [import_utils60.AST_NODE_TYPES.TSUnknownKeyword],
|
|
9285
|
+
never: [import_utils60.AST_NODE_TYPES.TSNeverKeyword],
|
|
9286
|
+
void: [import_utils60.AST_NODE_TYPES.TSVoidKeyword],
|
|
9287
|
+
null: [import_utils60.AST_NODE_TYPES.TSNullKeyword],
|
|
9288
|
+
undefined: [import_utils60.AST_NODE_TYPES.TSUndefinedKeyword],
|
|
9289
|
+
literal: [import_utils60.AST_NODE_TYPES.TSLiteralType],
|
|
9290
|
+
date: [import_utils60.AST_NODE_TYPES.TSTypeReference],
|
|
9291
|
+
array: [import_utils60.AST_NODE_TYPES.TSArrayType, import_utils60.AST_NODE_TYPES.TSTypeReference],
|
|
9292
|
+
tuple: [import_utils60.AST_NODE_TYPES.TSTupleType],
|
|
9293
|
+
object: [import_utils60.AST_NODE_TYPES.TSTypeLiteral, import_utils60.AST_NODE_TYPES.TSTypeReference],
|
|
9294
|
+
strictObject: [import_utils60.AST_NODE_TYPES.TSTypeLiteral, import_utils60.AST_NODE_TYPES.TSTypeReference],
|
|
9295
|
+
looseObject: [import_utils60.AST_NODE_TYPES.TSTypeLiteral, import_utils60.AST_NODE_TYPES.TSTypeReference],
|
|
9296
|
+
record: [import_utils60.AST_NODE_TYPES.TSTypeReference, import_utils60.AST_NODE_TYPES.TSTypeLiteral],
|
|
9297
|
+
map: [import_utils60.AST_NODE_TYPES.TSTypeReference],
|
|
9298
|
+
set: [import_utils60.AST_NODE_TYPES.TSTypeReference],
|
|
9299
|
+
promise: [import_utils60.AST_NODE_TYPES.TSTypeReference],
|
|
9300
|
+
enum: [import_utils60.AST_NODE_TYPES.TSUnionType, import_utils60.AST_NODE_TYPES.TSTypeReference, import_utils60.AST_NODE_TYPES.TSLiteralType],
|
|
9301
|
+
nativeEnum: [import_utils60.AST_NODE_TYPES.TSUnionType, import_utils60.AST_NODE_TYPES.TSTypeReference, import_utils60.AST_NODE_TYPES.TSLiteralType],
|
|
9302
|
+
union: [import_utils60.AST_NODE_TYPES.TSUnionType, import_utils60.AST_NODE_TYPES.TSTypeReference],
|
|
9303
|
+
discriminatedUnion: [import_utils60.AST_NODE_TYPES.TSUnionType, import_utils60.AST_NODE_TYPES.TSTypeReference],
|
|
9304
|
+
intersection: [import_utils60.AST_NODE_TYPES.TSIntersectionType, import_utils60.AST_NODE_TYPES.TSTypeReference]
|
|
9170
9305
|
};
|
|
9171
9306
|
function normalizeSchemaName(name) {
|
|
9172
9307
|
return name.replace(/Schema$/i, "").replace(/^Z(?=[A-Z])/, "").toLowerCase();
|
|
@@ -9175,20 +9310,20 @@ function normalizeTypeName(name) {
|
|
|
9175
9310
|
return name.replace(/Type$/, "").toLowerCase();
|
|
9176
9311
|
}
|
|
9177
9312
|
function unwrapNullish(annotation) {
|
|
9178
|
-
if (annotation.type !==
|
|
9313
|
+
if (annotation.type !== import_utils60.AST_NODE_TYPES.TSUnionType) {
|
|
9179
9314
|
return {
|
|
9180
9315
|
core: annotation,
|
|
9181
|
-
nullable: annotation.type ===
|
|
9316
|
+
nullable: annotation.type === import_utils60.AST_NODE_TYPES.TSNullKeyword
|
|
9182
9317
|
};
|
|
9183
9318
|
}
|
|
9184
9319
|
const rest = [];
|
|
9185
9320
|
let nullable = false;
|
|
9186
9321
|
for (const member of annotation.types) {
|
|
9187
|
-
if (member.type ===
|
|
9322
|
+
if (member.type === import_utils60.AST_NODE_TYPES.TSNullKeyword) {
|
|
9188
9323
|
nullable = true;
|
|
9189
9324
|
continue;
|
|
9190
9325
|
}
|
|
9191
|
-
if (member.type ===
|
|
9326
|
+
if (member.type === import_utils60.AST_NODE_TYPES.TSUndefinedKeyword) {
|
|
9192
9327
|
continue;
|
|
9193
9328
|
}
|
|
9194
9329
|
rest.push(member);
|
|
@@ -9253,14 +9388,14 @@ var prefer_zod_infer_default = createRule({
|
|
|
9253
9388
|
function zodCallChain(node) {
|
|
9254
9389
|
const chain = [];
|
|
9255
9390
|
let current = node;
|
|
9256
|
-
while (current.type ===
|
|
9391
|
+
while (current.type === import_utils60.AST_NODE_TYPES.CallExpression) {
|
|
9257
9392
|
const callee = current.callee;
|
|
9258
|
-
if (callee.type !==
|
|
9393
|
+
if (callee.type !== import_utils60.AST_NODE_TYPES.MemberExpression || callee.computed || callee.property.type !== import_utils60.AST_NODE_TYPES.Identifier) {
|
|
9259
9394
|
return null;
|
|
9260
9395
|
}
|
|
9261
9396
|
chain.push(current);
|
|
9262
9397
|
const receiver = callee.object;
|
|
9263
|
-
if (receiver.type ===
|
|
9398
|
+
if (receiver.type === import_utils60.AST_NODE_TYPES.Identifier) {
|
|
9264
9399
|
return zodNamespaces.has(receiver.name) ? chain.reverse() : null;
|
|
9265
9400
|
}
|
|
9266
9401
|
current = receiver;
|
|
@@ -9269,19 +9404,19 @@ var prefer_zod_infer_default = createRule({
|
|
|
9269
9404
|
}
|
|
9270
9405
|
function methodName(call) {
|
|
9271
9406
|
const callee = call.callee;
|
|
9272
|
-
return callee.type ===
|
|
9407
|
+
return callee.type === import_utils60.AST_NODE_TYPES.MemberExpression && callee.property.type === import_utils60.AST_NODE_TYPES.Identifier ? callee.property.name : "";
|
|
9273
9408
|
}
|
|
9274
9409
|
function schemaField(node) {
|
|
9275
9410
|
const modifiers = [];
|
|
9276
9411
|
let current = node;
|
|
9277
9412
|
let leaf = null;
|
|
9278
|
-
while (current.type ===
|
|
9413
|
+
while (current.type === import_utils60.AST_NODE_TYPES.CallExpression) {
|
|
9279
9414
|
const callee = current.callee;
|
|
9280
|
-
if (callee.type !==
|
|
9415
|
+
if (callee.type !== import_utils60.AST_NODE_TYPES.MemberExpression || callee.computed || callee.property.type !== import_utils60.AST_NODE_TYPES.Identifier) {
|
|
9281
9416
|
break;
|
|
9282
9417
|
}
|
|
9283
9418
|
const receiver = callee.object;
|
|
9284
|
-
if (receiver.type ===
|
|
9419
|
+
if (receiver.type === import_utils60.AST_NODE_TYPES.Identifier && zodNamespaces.has(receiver.name)) {
|
|
9285
9420
|
leaf = callee.property.name;
|
|
9286
9421
|
break;
|
|
9287
9422
|
}
|
|
@@ -9312,16 +9447,16 @@ var prefer_zod_infer_default = createRule({
|
|
|
9312
9447
|
return null;
|
|
9313
9448
|
}
|
|
9314
9449
|
const shape = base.arguments[0];
|
|
9315
|
-
if (shape === void 0 || shape.type !==
|
|
9450
|
+
if (shape === void 0 || shape.type !== import_utils60.AST_NODE_TYPES.ObjectExpression) {
|
|
9316
9451
|
return null;
|
|
9317
9452
|
}
|
|
9318
9453
|
const fields = /* @__PURE__ */ new Map();
|
|
9319
9454
|
for (const property of shape.properties) {
|
|
9320
|
-
if (property.type !==
|
|
9455
|
+
if (property.type !== import_utils60.AST_NODE_TYPES.Property || property.computed) {
|
|
9321
9456
|
return null;
|
|
9322
9457
|
}
|
|
9323
9458
|
const { key } = property;
|
|
9324
|
-
const name = key.type ===
|
|
9459
|
+
const name = key.type === import_utils60.AST_NODE_TYPES.Identifier ? key.name : key.type === import_utils60.AST_NODE_TYPES.Literal && typeof key.value === "string" ? key.value : null;
|
|
9325
9460
|
if (name === null) {
|
|
9326
9461
|
return null;
|
|
9327
9462
|
}
|
|
@@ -9332,11 +9467,11 @@ var prefer_zod_infer_default = createRule({
|
|
|
9332
9467
|
function typeMembers(members) {
|
|
9333
9468
|
const result = /* @__PURE__ */ new Map();
|
|
9334
9469
|
for (const member of members) {
|
|
9335
|
-
if (member.type !==
|
|
9470
|
+
if (member.type !== import_utils60.AST_NODE_TYPES.TSPropertySignature || member.computed) {
|
|
9336
9471
|
return null;
|
|
9337
9472
|
}
|
|
9338
9473
|
const { key } = member;
|
|
9339
|
-
const name = key.type ===
|
|
9474
|
+
const name = key.type === import_utils60.AST_NODE_TYPES.Identifier ? key.name : key.type === import_utils60.AST_NODE_TYPES.Literal && typeof key.value === "string" ? key.value : null;
|
|
9340
9475
|
if (name === null) {
|
|
9341
9476
|
return null;
|
|
9342
9477
|
}
|
|
@@ -9350,8 +9485,8 @@ var prefer_zod_infer_default = createRule({
|
|
|
9350
9485
|
return result.size === 0 ? null : result;
|
|
9351
9486
|
}
|
|
9352
9487
|
function collectConstrainedNames(node) {
|
|
9353
|
-
if (node.type ===
|
|
9354
|
-
if (node.typeName.type ===
|
|
9488
|
+
if (node.type === import_utils60.AST_NODE_TYPES.TSTypeReference) {
|
|
9489
|
+
if (node.typeName.type === import_utils60.AST_NODE_TYPES.Identifier) {
|
|
9355
9490
|
constrainedTypeNames.add(node.typeName.name);
|
|
9356
9491
|
}
|
|
9357
9492
|
for (const argument of node.typeArguments?.params ?? []) {
|
|
@@ -9359,11 +9494,11 @@ var prefer_zod_infer_default = createRule({
|
|
|
9359
9494
|
}
|
|
9360
9495
|
return;
|
|
9361
9496
|
}
|
|
9362
|
-
if (node.type ===
|
|
9497
|
+
if (node.type === import_utils60.AST_NODE_TYPES.TSArrayType) {
|
|
9363
9498
|
collectConstrainedNames(node.elementType);
|
|
9364
9499
|
return;
|
|
9365
9500
|
}
|
|
9366
|
-
if (node.type ===
|
|
9501
|
+
if (node.type === import_utils60.AST_NODE_TYPES.TSUnionType || node.type === import_utils60.AST_NODE_TYPES.TSIntersectionType) {
|
|
9367
9502
|
for (const member of node.types) {
|
|
9368
9503
|
collectConstrainedNames(member);
|
|
9369
9504
|
}
|
|
@@ -9407,13 +9542,13 @@ var prefer_zod_infer_default = createRule({
|
|
|
9407
9542
|
return;
|
|
9408
9543
|
}
|
|
9409
9544
|
for (const specifier of node.specifiers) {
|
|
9410
|
-
if (specifier.type ===
|
|
9545
|
+
if (specifier.type === import_utils60.AST_NODE_TYPES.ImportNamespaceSpecifier || specifier.type === import_utils60.AST_NODE_TYPES.ImportDefaultSpecifier || specifier.type === import_utils60.AST_NODE_TYPES.ImportSpecifier && specifier.imported.type === import_utils60.AST_NODE_TYPES.Identifier && specifier.imported.name === "z") {
|
|
9411
9546
|
zodNamespaces.add(specifier.local.name);
|
|
9412
9547
|
}
|
|
9413
9548
|
}
|
|
9414
9549
|
},
|
|
9415
9550
|
VariableDeclarator(node) {
|
|
9416
|
-
if (node.id.type !==
|
|
9551
|
+
if (node.id.type !== import_utils60.AST_NODE_TYPES.Identifier || node.init == null) {
|
|
9417
9552
|
return;
|
|
9418
9553
|
}
|
|
9419
9554
|
const fields = schemaFields(node.init);
|
|
@@ -9423,14 +9558,14 @@ var prefer_zod_infer_default = createRule({
|
|
|
9423
9558
|
},
|
|
9424
9559
|
/** Records `XSchema.transform(...)` and equivalent module-level reshaping. */
|
|
9425
9560
|
"MemberExpression[computed=false]"(node) {
|
|
9426
|
-
if (node.object.type ===
|
|
9561
|
+
if (node.object.type === import_utils60.AST_NODE_TYPES.Identifier && node.property.type === import_utils60.AST_NODE_TYPES.Identifier && MODULE_LEVEL_RESHAPERS.has(node.property.name)) {
|
|
9427
9562
|
reshapedSchemaNames.add(node.object.name);
|
|
9428
9563
|
}
|
|
9429
9564
|
},
|
|
9430
9565
|
/** Records every type argument carried by a Zod constraint. */
|
|
9431
9566
|
TSTypeReference(node) {
|
|
9432
9567
|
const { typeName } = node;
|
|
9433
|
-
const referenced = typeName.type ===
|
|
9568
|
+
const referenced = typeName.type === import_utils60.AST_NODE_TYPES.Identifier ? typeName.name : typeName.type === import_utils60.AST_NODE_TYPES.TSQualifiedName && typeName.right.type === import_utils60.AST_NODE_TYPES.Identifier ? typeName.right.name : null;
|
|
9434
9569
|
if (referenced === null || !ZOD_TYPE_CONSTRAINTS.has(referenced)) {
|
|
9435
9570
|
return;
|
|
9436
9571
|
}
|
|
@@ -9448,7 +9583,7 @@ var prefer_zod_infer_default = createRule({
|
|
|
9448
9583
|
}
|
|
9449
9584
|
},
|
|
9450
9585
|
TSTypeAliasDeclaration(node) {
|
|
9451
|
-
if (node.typeParameters !== void 0 || node.typeAnnotation.type !==
|
|
9586
|
+
if (node.typeParameters !== void 0 || node.typeAnnotation.type !== import_utils60.AST_NODE_TYPES.TSTypeLiteral) {
|
|
9452
9587
|
return;
|
|
9453
9588
|
}
|
|
9454
9589
|
const members = typeMembers(node.typeAnnotation.members);
|
|
@@ -9493,10 +9628,10 @@ var prefer_zod_infer_default = createRule({
|
|
|
9493
9628
|
});
|
|
9494
9629
|
|
|
9495
9630
|
// src/rules/require-assert-never.ts
|
|
9496
|
-
var
|
|
9631
|
+
var import_utils61 = require("@typescript-eslint/utils");
|
|
9497
9632
|
var isRuntimeHandlingStatement = (statement) => {
|
|
9498
|
-
if (statement.type ===
|
|
9499
|
-
if (statement.type ===
|
|
9633
|
+
if (statement.type === import_utils61.AST_NODE_TYPES.EmptyStatement) return false;
|
|
9634
|
+
if (statement.type === import_utils61.AST_NODE_TYPES.BlockStatement) {
|
|
9500
9635
|
return statement.body.some(isRuntimeHandlingStatement);
|
|
9501
9636
|
}
|
|
9502
9637
|
return true;
|
|
@@ -9512,7 +9647,7 @@ var isCommentOnlyNoopDefault = (defaultCase, sourceCode) => {
|
|
|
9512
9647
|
return colonToken !== null && sourceCode.getCommentsAfter(colonToken).length > 0;
|
|
9513
9648
|
}
|
|
9514
9649
|
const only = defaultCase.consequent[0];
|
|
9515
|
-
if (only !== void 0 && defaultCase.consequent.length === 1 && only.type ===
|
|
9650
|
+
if (only !== void 0 && defaultCase.consequent.length === 1 && only.type === import_utils61.AST_NODE_TYPES.BlockStatement && only.body.length === 0) {
|
|
9516
9651
|
return sourceCode.getCommentsInside(only).length > 0;
|
|
9517
9652
|
}
|
|
9518
9653
|
return false;
|
|
@@ -9552,7 +9687,7 @@ var require_assert_never_default = createRule({
|
|
|
9552
9687
|
});
|
|
9553
9688
|
|
|
9554
9689
|
// src/rules/require-fetch-timeout.ts
|
|
9555
|
-
var
|
|
9690
|
+
var import_utils62 = require("@typescript-eslint/utils");
|
|
9556
9691
|
var GLOBAL_OBJECTS2 = /* @__PURE__ */ new Set([
|
|
9557
9692
|
"globalThis",
|
|
9558
9693
|
"window",
|
|
@@ -9568,14 +9703,14 @@ function matchesAnyPattern3(filename, patterns) {
|
|
|
9568
9703
|
return false;
|
|
9569
9704
|
}
|
|
9570
9705
|
function initProvablyLacksSignal(init) {
|
|
9571
|
-
if (init.type !==
|
|
9706
|
+
if (init.type !== import_utils62.AST_NODE_TYPES.ObjectExpression) {
|
|
9572
9707
|
return false;
|
|
9573
9708
|
}
|
|
9574
9709
|
for (const prop of init.properties) {
|
|
9575
|
-
if (prop.type ===
|
|
9710
|
+
if (prop.type === import_utils62.AST_NODE_TYPES.SpreadElement) {
|
|
9576
9711
|
return false;
|
|
9577
9712
|
}
|
|
9578
|
-
if (prop.key.type ===
|
|
9713
|
+
if (prop.key.type === import_utils62.AST_NODE_TYPES.Identifier && prop.key.name === "signal" || prop.key.type === import_utils62.AST_NODE_TYPES.Literal && prop.key.value === "signal") {
|
|
9579
9714
|
return false;
|
|
9580
9715
|
}
|
|
9581
9716
|
if (prop.computed) {
|
|
@@ -9585,7 +9720,7 @@ function initProvablyLacksSignal(init) {
|
|
|
9585
9720
|
return true;
|
|
9586
9721
|
}
|
|
9587
9722
|
function isStringish(node) {
|
|
9588
|
-
return node.type ===
|
|
9723
|
+
return node.type === import_utils62.AST_NODE_TYPES.Literal && typeof node.value === "string" || node.type === import_utils62.AST_NODE_TYPES.TemplateLiteral;
|
|
9589
9724
|
}
|
|
9590
9725
|
var require_fetch_timeout_default = createRule({
|
|
9591
9726
|
name: "require-fetch-timeout",
|
|
@@ -9622,14 +9757,14 @@ var require_fetch_timeout_default = createRule({
|
|
|
9622
9757
|
}
|
|
9623
9758
|
function resolvesToGlobal(identifier) {
|
|
9624
9759
|
const scope = context.sourceCode.getScope(identifier);
|
|
9625
|
-
const variable =
|
|
9760
|
+
const variable = import_utils62.ASTUtils.findVariable(scope, identifier.name);
|
|
9626
9761
|
return variable === null || variable.defs.length === 0;
|
|
9627
9762
|
}
|
|
9628
9763
|
function isGlobalFetchCall2(callee) {
|
|
9629
|
-
if (callee.type ===
|
|
9764
|
+
if (callee.type === import_utils62.AST_NODE_TYPES.Identifier) {
|
|
9630
9765
|
return callee.name === "fetch" && resolvesToGlobal(callee);
|
|
9631
9766
|
}
|
|
9632
|
-
return callee.type ===
|
|
9767
|
+
return callee.type === import_utils62.AST_NODE_TYPES.MemberExpression && !callee.computed && callee.property.type === import_utils62.AST_NODE_TYPES.Identifier && callee.property.name === "fetch" && callee.object.type === import_utils62.AST_NODE_TYPES.Identifier && GLOBAL_OBJECTS2.has(callee.object.name) && resolvesToGlobal(callee.object);
|
|
9633
9768
|
}
|
|
9634
9769
|
return {
|
|
9635
9770
|
CallExpression(node) {
|
|
@@ -9649,7 +9784,7 @@ var require_fetch_timeout_default = createRule({
|
|
|
9649
9784
|
});
|
|
9650
9785
|
|
|
9651
9786
|
// src/rules/require-interface-for-injected-service.ts
|
|
9652
|
-
var
|
|
9787
|
+
var import_utils63 = require("@typescript-eslint/utils");
|
|
9653
9788
|
var CONFIGISH_TYPE_RE = /(?:Options|Opts|Config|Configuration|Settings|Params|Props|Args|Env|Environment|Callbacks|Flags)$/;
|
|
9654
9789
|
var CONFIGISH_NAME_RE = /^(?:options|opts|config|configuration|settings|params|props|args|env|environment|callbacks|flags|logger|log|clock)$/i;
|
|
9655
9790
|
var HTTP_TRANSPORT_TYPE_RE = /^(?:KyInstance|AxiosInstance|Session)$/;
|
|
@@ -9657,20 +9792,20 @@ var BUILTIN_CONTAINER_TYPE_RE = /^(?:Record|Map|WeakMap|Set|WeakSet|Array|Readon
|
|
|
9657
9792
|
var TRANSPORT_WRAPPER_NAME_RE = /Client$/;
|
|
9658
9793
|
var ROUTER_FACTORY_NAME = "Router";
|
|
9659
9794
|
var FRAMEWORK_HTTP_TYPES = /* @__PURE__ */ new Set(["Request", "Response", "NextFunction"]);
|
|
9660
|
-
var isExportedClass = (node) => node.parent.type ===
|
|
9661
|
-
var qualifiedName = (name) => name.type ===
|
|
9795
|
+
var isExportedClass = (node) => node.parent.type === import_utils63.AST_NODE_TYPES.ExportNamedDeclaration || node.parent.type === import_utils63.AST_NODE_TYPES.ExportDefaultDeclaration;
|
|
9796
|
+
var qualifiedName = (name) => name.type === import_utils63.AST_NODE_TYPES.Identifier ? name.name : name.type === import_utils63.AST_NODE_TYPES.TSQualifiedName ? `${qualifiedName(name.left)}.${name.right.name}` : "";
|
|
9662
9797
|
var readTypeReference = (annotation) => {
|
|
9663
|
-
if (annotation === void 0 || annotation.type !==
|
|
9798
|
+
if (annotation === void 0 || annotation.type !== import_utils63.AST_NODE_TYPES.TSTypeReference) return null;
|
|
9664
9799
|
const { typeName } = annotation;
|
|
9665
|
-
const rightmost = typeName.type ===
|
|
9800
|
+
const rightmost = typeName.type === import_utils63.AST_NODE_TYPES.Identifier ? typeName.name : typeName.type === import_utils63.AST_NODE_TYPES.TSQualifiedName ? typeName.right.name : null;
|
|
9666
9801
|
if (rightmost === null) return null;
|
|
9667
9802
|
return { typeName: rightmost, display: qualifiedName(typeName) };
|
|
9668
9803
|
};
|
|
9669
9804
|
var namedParameterCollaborator = (annotated) => {
|
|
9670
9805
|
let target = annotated;
|
|
9671
|
-
if (target.type ===
|
|
9672
|
-
if (target.type ===
|
|
9673
|
-
if (target.type !==
|
|
9806
|
+
if (target.type === import_utils63.AST_NODE_TYPES.TSParameterProperty) target = target.parameter;
|
|
9807
|
+
if (target.type === import_utils63.AST_NODE_TYPES.AssignmentPattern) target = target.left;
|
|
9808
|
+
if (target.type !== import_utils63.AST_NODE_TYPES.Identifier) return null;
|
|
9674
9809
|
const reference = readTypeReference(target.typeAnnotation?.typeAnnotation);
|
|
9675
9810
|
if (reference === null) return null;
|
|
9676
9811
|
return { name: target.name, ...reference };
|
|
@@ -9678,8 +9813,8 @@ var namedParameterCollaborator = (annotated) => {
|
|
|
9678
9813
|
var propertySignatureTypes = (members) => {
|
|
9679
9814
|
const types = /* @__PURE__ */ new Map();
|
|
9680
9815
|
for (const member of members) {
|
|
9681
|
-
if (member.type !==
|
|
9682
|
-
if (member.computed || member.key.type !==
|
|
9816
|
+
if (member.type !== import_utils63.AST_NODE_TYPES.TSPropertySignature) continue;
|
|
9817
|
+
if (member.computed || member.key.type !== import_utils63.AST_NODE_TYPES.Identifier) continue;
|
|
9683
9818
|
const reference = readTypeReference(member.typeAnnotation?.typeAnnotation);
|
|
9684
9819
|
if (reference === null) continue;
|
|
9685
9820
|
types.set(member.key.name, reference);
|
|
@@ -9690,18 +9825,18 @@ var fileTypeIndex = (program) => {
|
|
|
9690
9825
|
const objects = /* @__PURE__ */ new Map();
|
|
9691
9826
|
const functionAliases = /* @__PURE__ */ new Set();
|
|
9692
9827
|
for (const statement of program.body) {
|
|
9693
|
-
const declaration = statement.type ===
|
|
9694
|
-
if (declaration?.type ===
|
|
9828
|
+
const declaration = statement.type === import_utils63.AST_NODE_TYPES.ExportNamedDeclaration ? statement.declaration : statement;
|
|
9829
|
+
if (declaration?.type === import_utils63.AST_NODE_TYPES.TSInterfaceDeclaration) {
|
|
9695
9830
|
objects.set(declaration.id.name, propertySignatureTypes(declaration.body.body));
|
|
9696
9831
|
continue;
|
|
9697
9832
|
}
|
|
9698
|
-
if (declaration?.type !==
|
|
9833
|
+
if (declaration?.type !== import_utils63.AST_NODE_TYPES.TSTypeAliasDeclaration) continue;
|
|
9699
9834
|
const aliased = declaration.typeAnnotation;
|
|
9700
|
-
if (aliased.type ===
|
|
9835
|
+
if (aliased.type === import_utils63.AST_NODE_TYPES.TSFunctionType || aliased.type === import_utils63.AST_NODE_TYPES.TSConstructorType) {
|
|
9701
9836
|
functionAliases.add(declaration.id.name);
|
|
9702
9837
|
continue;
|
|
9703
9838
|
}
|
|
9704
|
-
const literals = aliased.type ===
|
|
9839
|
+
const literals = aliased.type === import_utils63.AST_NODE_TYPES.TSTypeLiteral ? [aliased] : aliased.type === import_utils63.AST_NODE_TYPES.TSIntersectionType ? aliased.types.filter((part) => part.type === import_utils63.AST_NODE_TYPES.TSTypeLiteral) : [];
|
|
9705
9840
|
if (literals.length === 0) continue;
|
|
9706
9841
|
const merged = /* @__PURE__ */ new Map();
|
|
9707
9842
|
for (const literal of literals) {
|
|
@@ -9714,10 +9849,10 @@ var fileTypeIndex = (program) => {
|
|
|
9714
9849
|
return { objects, functionAliases };
|
|
9715
9850
|
};
|
|
9716
9851
|
var bagMemberTypes = (annotation, declared) => {
|
|
9717
|
-
if (annotation.type ===
|
|
9852
|
+
if (annotation.type === import_utils63.AST_NODE_TYPES.TSTypeLiteral) {
|
|
9718
9853
|
return propertySignatureTypes(annotation.members);
|
|
9719
9854
|
}
|
|
9720
|
-
if (annotation.type !==
|
|
9855
|
+
if (annotation.type !== import_utils63.AST_NODE_TYPES.TSTypeReference || annotation.typeName.type !== import_utils63.AST_NODE_TYPES.Identifier) {
|
|
9721
9856
|
return null;
|
|
9722
9857
|
}
|
|
9723
9858
|
return declared().objects.get(annotation.typeName.name) ?? null;
|
|
@@ -9729,11 +9864,11 @@ var objectPatternCollaborators = (pattern, declared) => {
|
|
|
9729
9864
|
if (members === null) return [];
|
|
9730
9865
|
const collaborators = [];
|
|
9731
9866
|
for (const property of pattern.properties) {
|
|
9732
|
-
if (property.type !==
|
|
9733
|
-
if (property.key.type !==
|
|
9867
|
+
if (property.type !== import_utils63.AST_NODE_TYPES.Property || property.computed) continue;
|
|
9868
|
+
if (property.key.type !== import_utils63.AST_NODE_TYPES.Identifier) continue;
|
|
9734
9869
|
const key = property.key.name;
|
|
9735
|
-
const bound = property.value.type ===
|
|
9736
|
-
if (bound.type !==
|
|
9870
|
+
const bound = property.value.type === import_utils63.AST_NODE_TYPES.AssignmentPattern ? property.value.left : property.value;
|
|
9871
|
+
if (bound.type !== import_utils63.AST_NODE_TYPES.Identifier) continue;
|
|
9737
9872
|
if (CONFIGISH_NAME_RE.test(key)) continue;
|
|
9738
9873
|
const reference = members.get(key);
|
|
9739
9874
|
if (reference === void 0) continue;
|
|
@@ -9743,8 +9878,8 @@ var objectPatternCollaborators = (pattern, declared) => {
|
|
|
9743
9878
|
};
|
|
9744
9879
|
var parameterCollaborators = (parameter, declared) => {
|
|
9745
9880
|
let target = parameter;
|
|
9746
|
-
if (target.type ===
|
|
9747
|
-
if (target.type ===
|
|
9881
|
+
if (target.type === import_utils63.AST_NODE_TYPES.AssignmentPattern) target = target.left;
|
|
9882
|
+
if (target.type === import_utils63.AST_NODE_TYPES.ObjectPattern) {
|
|
9748
9883
|
return objectPatternCollaborators(target, declared);
|
|
9749
9884
|
}
|
|
9750
9885
|
const named2 = namedParameterCollaborator(parameter);
|
|
@@ -9763,17 +9898,17 @@ var readConstructor = (ctor, declared, typeParameters) => {
|
|
|
9763
9898
|
let constructedFields = 0;
|
|
9764
9899
|
if (body2 !== null && body2 !== void 0) {
|
|
9765
9900
|
for (const statement of body2.body) {
|
|
9766
|
-
if (statement.type !==
|
|
9901
|
+
if (statement.type !== import_utils63.AST_NODE_TYPES.ExpressionStatement) continue;
|
|
9767
9902
|
const expression = statement.expression;
|
|
9768
|
-
if (expression.type !==
|
|
9903
|
+
if (expression.type !== import_utils63.AST_NODE_TYPES.AssignmentExpression || expression.operator !== "=" || expression.left.type !== import_utils63.AST_NODE_TYPES.MemberExpression || expression.left.object.type !== import_utils63.AST_NODE_TYPES.ThisExpression) {
|
|
9769
9904
|
continue;
|
|
9770
9905
|
}
|
|
9771
9906
|
const source = expression.right;
|
|
9772
|
-
if (source.type ===
|
|
9907
|
+
if (source.type === import_utils63.AST_NODE_TYPES.NewExpression) {
|
|
9773
9908
|
constructedFields += 1;
|
|
9774
|
-
} else if (source.type ===
|
|
9909
|
+
} else if (source.type === import_utils63.AST_NODE_TYPES.Identifier) {
|
|
9775
9910
|
storedFrom.add(source.name);
|
|
9776
|
-
} else if (source.type ===
|
|
9911
|
+
} else if (source.type === import_utils63.AST_NODE_TYPES.MemberExpression && source.object.type === import_utils63.AST_NODE_TYPES.Identifier) {
|
|
9777
9912
|
storedFrom.add(source.object.name);
|
|
9778
9913
|
}
|
|
9779
9914
|
}
|
|
@@ -9781,7 +9916,7 @@ var readConstructor = (ctor, declared, typeParameters) => {
|
|
|
9781
9916
|
const collaborators = [];
|
|
9782
9917
|
for (const parameter of ctor.value.params) {
|
|
9783
9918
|
for (const reference of parameterCollaborators(parameter, declared)) {
|
|
9784
|
-
const stored = parameter.type ===
|
|
9919
|
+
const stored = parameter.type === import_utils63.AST_NODE_TYPES.TSParameterProperty || storedFrom.has(reference.name);
|
|
9785
9920
|
if (!stored) continue;
|
|
9786
9921
|
if (CONFIGISH_TYPE_RE.test(reference.typeName)) continue;
|
|
9787
9922
|
if (CONFIGISH_NAME_RE.test(reference.name)) continue;
|
|
@@ -9815,19 +9950,19 @@ var subtreeHas = (root, found) => {
|
|
|
9815
9950
|
return hit;
|
|
9816
9951
|
};
|
|
9817
9952
|
var isFrameworkWiring = (body2) => subtreeHas(body2, (node) => {
|
|
9818
|
-
if (node.type ===
|
|
9953
|
+
if (node.type === import_utils63.AST_NODE_TYPES.CallExpression) {
|
|
9819
9954
|
const { callee } = node;
|
|
9820
|
-
if (callee.type ===
|
|
9821
|
-
return callee.type ===
|
|
9955
|
+
if (callee.type === import_utils63.AST_NODE_TYPES.Identifier) return callee.name === ROUTER_FACTORY_NAME;
|
|
9956
|
+
return callee.type === import_utils63.AST_NODE_TYPES.MemberExpression && !callee.computed && callee.property.type === import_utils63.AST_NODE_TYPES.Identifier && callee.property.name === ROUTER_FACTORY_NAME;
|
|
9822
9957
|
}
|
|
9823
|
-
return node.type ===
|
|
9958
|
+
return node.type === import_utils63.AST_NODE_TYPES.TSTypeReference && node.typeName.type === import_utils63.AST_NODE_TYPES.TSQualifiedName && FRAMEWORK_HTTP_TYPES.has(node.typeName.right.name);
|
|
9824
9959
|
});
|
|
9825
9960
|
var stem2 = (name) => name.replace(/^I(?=[A-Z])/, "").replace(/Impl$/, "");
|
|
9826
9961
|
var fileInterfaceNames = (program) => {
|
|
9827
9962
|
const names = [];
|
|
9828
9963
|
for (const statement of program.body) {
|
|
9829
|
-
const declaration = statement.type ===
|
|
9830
|
-
if (declaration?.type ===
|
|
9964
|
+
const declaration = statement.type === import_utils63.AST_NODE_TYPES.ExportNamedDeclaration ? statement.declaration : statement;
|
|
9965
|
+
if (declaration?.type === import_utils63.AST_NODE_TYPES.TSInterfaceDeclaration) names.push(declaration.id.name);
|
|
9831
9966
|
}
|
|
9832
9967
|
return names;
|
|
9833
9968
|
};
|
|
@@ -9845,11 +9980,11 @@ var isTransportWrapper = (className, collaborators, program) => {
|
|
|
9845
9980
|
var publicMethodNames = (body2) => {
|
|
9846
9981
|
const names = [];
|
|
9847
9982
|
for (const member of body2.body) {
|
|
9848
|
-
if (member.type !==
|
|
9983
|
+
if (member.type !== import_utils63.AST_NODE_TYPES.MethodDefinition) continue;
|
|
9849
9984
|
if (member.kind !== "method" || member.static) continue;
|
|
9850
9985
|
if (member.accessibility === "private" || member.accessibility === "protected") continue;
|
|
9851
|
-
if (member.key.type ===
|
|
9852
|
-
if (member.key.type ===
|
|
9986
|
+
if (member.key.type === import_utils63.AST_NODE_TYPES.PrivateIdentifier) continue;
|
|
9987
|
+
if (member.key.type === import_utils63.AST_NODE_TYPES.Identifier) names.push(member.key.name);
|
|
9853
9988
|
else names.push("\u2026");
|
|
9854
9989
|
}
|
|
9855
9990
|
return names;
|
|
@@ -9882,7 +10017,7 @@ var require_interface_for_injected_service_default = createRule({
|
|
|
9882
10017
|
if (node.implements.length > 0) return;
|
|
9883
10018
|
if (node.decorators.length > 0) return;
|
|
9884
10019
|
const ctor = node.body.body.find(
|
|
9885
|
-
(member) => member.type ===
|
|
10020
|
+
(member) => member.type === import_utils63.AST_NODE_TYPES.MethodDefinition && member.kind === "constructor"
|
|
9886
10021
|
);
|
|
9887
10022
|
if (ctor === void 0) return;
|
|
9888
10023
|
const { collaborators, constructedFields } = readConstructor(
|
|
@@ -9911,37 +10046,37 @@ var require_interface_for_injected_service_default = createRule({
|
|
|
9911
10046
|
});
|
|
9912
10047
|
|
|
9913
10048
|
// src/rules/require-static-next-matcher.ts
|
|
9914
|
-
var
|
|
10049
|
+
var import_utils64 = require("@typescript-eslint/utils");
|
|
9915
10050
|
var NEXT_ENTRY_FILE = /(?:^|[/\\])(?:middleware|proxy)\.[cm]?[jt]sx?$/u;
|
|
9916
10051
|
function unwrapExpression(node) {
|
|
9917
|
-
if (node.type ===
|
|
10052
|
+
if (node.type === import_utils64.AST_NODE_TYPES.TSAsExpression || node.type === import_utils64.AST_NODE_TYPES.TSSatisfiesExpression || node.type === import_utils64.AST_NODE_TYPES.TSNonNullExpression || node.type === import_utils64.AST_NODE_TYPES.TSTypeAssertion) {
|
|
9918
10053
|
return unwrapExpression(node.expression);
|
|
9919
10054
|
}
|
|
9920
10055
|
return node;
|
|
9921
10056
|
}
|
|
9922
10057
|
function isStaticValue(node) {
|
|
9923
10058
|
const value = unwrapExpression(node);
|
|
9924
|
-
if (value.type ===
|
|
10059
|
+
if (value.type === import_utils64.AST_NODE_TYPES.Literal) {
|
|
9925
10060
|
return true;
|
|
9926
10061
|
}
|
|
9927
|
-
if (value.type ===
|
|
10062
|
+
if (value.type === import_utils64.AST_NODE_TYPES.TemplateLiteral) {
|
|
9928
10063
|
return value.expressions.length === 0;
|
|
9929
10064
|
}
|
|
9930
|
-
if (value.type ===
|
|
10065
|
+
if (value.type === import_utils64.AST_NODE_TYPES.ArrayExpression) {
|
|
9931
10066
|
return value.elements.every(
|
|
9932
|
-
(element) => element !== null && element.type !==
|
|
10067
|
+
(element) => element !== null && element.type !== import_utils64.AST_NODE_TYPES.SpreadElement && isStaticValue(element)
|
|
9933
10068
|
);
|
|
9934
10069
|
}
|
|
9935
|
-
if (value.type ===
|
|
10070
|
+
if (value.type === import_utils64.AST_NODE_TYPES.ObjectExpression) {
|
|
9936
10071
|
return value.properties.every(
|
|
9937
|
-
(property) => property.type ===
|
|
10072
|
+
(property) => property.type === import_utils64.AST_NODE_TYPES.Property && property.kind === "init" && !property.computed && property.value.type !== import_utils64.AST_NODE_TYPES.AssignmentPattern && isStaticValue(property.value)
|
|
9938
10073
|
);
|
|
9939
10074
|
}
|
|
9940
10075
|
return false;
|
|
9941
10076
|
}
|
|
9942
10077
|
function propertyName2(property) {
|
|
9943
10078
|
if (property.computed) return null;
|
|
9944
|
-
if (property.key.type ===
|
|
10079
|
+
if (property.key.type === import_utils64.AST_NODE_TYPES.Identifier) return property.key.name;
|
|
9945
10080
|
return typeof property.key.value === "string" ? property.key.value : null;
|
|
9946
10081
|
}
|
|
9947
10082
|
var require_static_next_matcher_default = createRule({
|
|
@@ -9963,19 +10098,19 @@ var require_static_next_matcher_default = createRule({
|
|
|
9963
10098
|
}
|
|
9964
10099
|
return {
|
|
9965
10100
|
ExportNamedDeclaration(node) {
|
|
9966
|
-
if (node.declaration?.type !==
|
|
10101
|
+
if (node.declaration?.type !== import_utils64.AST_NODE_TYPES.VariableDeclaration) {
|
|
9967
10102
|
return;
|
|
9968
10103
|
}
|
|
9969
10104
|
for (const declaration of node.declaration.declarations) {
|
|
9970
|
-
if (declaration.id.type !==
|
|
10105
|
+
if (declaration.id.type !== import_utils64.AST_NODE_TYPES.Identifier || declaration.id.name !== "config" || declaration.init === null) {
|
|
9971
10106
|
continue;
|
|
9972
10107
|
}
|
|
9973
10108
|
const config = unwrapExpression(declaration.init);
|
|
9974
|
-
if (config.type !==
|
|
10109
|
+
if (config.type !== import_utils64.AST_NODE_TYPES.ObjectExpression) {
|
|
9975
10110
|
continue;
|
|
9976
10111
|
}
|
|
9977
10112
|
for (const property of config.properties) {
|
|
9978
|
-
if (property.type !==
|
|
10113
|
+
if (property.type !== import_utils64.AST_NODE_TYPES.Property || propertyName2(property) !== "matcher" || property.value.type === import_utils64.AST_NODE_TYPES.AssignmentPattern) {
|
|
9979
10114
|
continue;
|
|
9980
10115
|
}
|
|
9981
10116
|
if (!isStaticValue(property.value)) {
|
|
@@ -9989,18 +10124,18 @@ var require_static_next_matcher_default = createRule({
|
|
|
9989
10124
|
});
|
|
9990
10125
|
|
|
9991
10126
|
// src/rules/require-zod-form-validation.ts
|
|
9992
|
-
var
|
|
10127
|
+
var import_utils65 = require("@typescript-eslint/utils");
|
|
9993
10128
|
var looksLikeZodSchema = (node) => {
|
|
9994
10129
|
let current = node;
|
|
9995
10130
|
while (true) {
|
|
9996
|
-
if (current.type ===
|
|
10131
|
+
if (current.type === import_utils65.AST_NODE_TYPES.Identifier) {
|
|
9997
10132
|
return current.name === "z" || ZOD_SCHEMA_NAME_RE.test(current.name);
|
|
9998
10133
|
}
|
|
9999
|
-
if (current.type ===
|
|
10134
|
+
if (current.type === import_utils65.AST_NODE_TYPES.CallExpression) {
|
|
10000
10135
|
current = current.callee;
|
|
10001
10136
|
continue;
|
|
10002
10137
|
}
|
|
10003
|
-
if (current.type ===
|
|
10138
|
+
if (current.type === import_utils65.AST_NODE_TYPES.MemberExpression) {
|
|
10004
10139
|
current = current.object;
|
|
10005
10140
|
continue;
|
|
10006
10141
|
}
|
|
@@ -10008,23 +10143,23 @@ var looksLikeZodSchema = (node) => {
|
|
|
10008
10143
|
}
|
|
10009
10144
|
};
|
|
10010
10145
|
var isZodParseCall = (node) => {
|
|
10011
|
-
if (node.type !==
|
|
10146
|
+
if (node.type !== import_utils65.AST_NODE_TYPES.CallExpression) return false;
|
|
10012
10147
|
const callee = node.callee;
|
|
10013
|
-
if (callee.type !==
|
|
10148
|
+
if (callee.type !== import_utils65.AST_NODE_TYPES.MemberExpression) return false;
|
|
10014
10149
|
if (callee.computed) return false;
|
|
10015
|
-
if (callee.property.type !==
|
|
10150
|
+
if (callee.property.type !== import_utils65.AST_NODE_TYPES.Identifier) return false;
|
|
10016
10151
|
const method = callee.property.name;
|
|
10017
10152
|
if (method !== "parse" && method !== "safeParse") return false;
|
|
10018
10153
|
return looksLikeZodSchema(callee.object);
|
|
10019
10154
|
};
|
|
10020
10155
|
var isFormDataMethodCall = (node) => {
|
|
10021
10156
|
let current = node;
|
|
10022
|
-
if (current.type ===
|
|
10157
|
+
if (current.type === import_utils65.AST_NODE_TYPES.AwaitExpression) {
|
|
10023
10158
|
current = current.argument;
|
|
10024
10159
|
}
|
|
10025
|
-
if (current.type !==
|
|
10160
|
+
if (current.type !== import_utils65.AST_NODE_TYPES.CallExpression) return false;
|
|
10026
10161
|
const callee = current.callee;
|
|
10027
|
-
return callee.type ===
|
|
10162
|
+
return callee.type === import_utils65.AST_NODE_TYPES.MemberExpression && !callee.computed && callee.property.type === import_utils65.AST_NODE_TYPES.Identifier && callee.property.name === "formData";
|
|
10028
10163
|
};
|
|
10029
10164
|
var require_zod_form_validation_default = createRule({
|
|
10030
10165
|
name: "require-zod-form-validation",
|
|
@@ -10044,14 +10179,14 @@ var require_zod_form_validation_default = createRule({
|
|
|
10044
10179
|
return {};
|
|
10045
10180
|
}
|
|
10046
10181
|
const isFormSourceIdentifier = (node) => {
|
|
10047
|
-
if (node.type !==
|
|
10182
|
+
if (node.type !== import_utils65.AST_NODE_TYPES.Identifier) return false;
|
|
10048
10183
|
if (/formdata/i.test(node.name)) return true;
|
|
10049
10184
|
let scope = context.sourceCode.getScope(node);
|
|
10050
10185
|
while (scope !== null) {
|
|
10051
10186
|
const variable = scope.set.get(node.name);
|
|
10052
10187
|
if (variable !== void 0 && variable.defs.length === 1) {
|
|
10053
10188
|
const def = variable.defs[0];
|
|
10054
|
-
if (def !== void 0 && def.type === "Variable" && def.node.type ===
|
|
10189
|
+
if (def !== void 0 && def.type === "Variable" && def.node.type === import_utils65.AST_NODE_TYPES.VariableDeclarator && def.node.init !== null) {
|
|
10055
10190
|
return isFormDataMethodCall(def.node.init);
|
|
10056
10191
|
}
|
|
10057
10192
|
return false;
|
|
@@ -10062,8 +10197,8 @@ var require_zod_form_validation_default = createRule({
|
|
|
10062
10197
|
};
|
|
10063
10198
|
const isFormDataGetCall = (node) => {
|
|
10064
10199
|
const callee = node.callee;
|
|
10065
|
-
if (callee.type !==
|
|
10066
|
-
if (callee.property.type !==
|
|
10200
|
+
if (callee.type !== import_utils65.AST_NODE_TYPES.MemberExpression) return false;
|
|
10201
|
+
if (callee.property.type !== import_utils65.AST_NODE_TYPES.Identifier || callee.property.name !== "get") {
|
|
10067
10202
|
return false;
|
|
10068
10203
|
}
|
|
10069
10204
|
return isFormSourceIdentifier(callee.object);
|
|
@@ -10078,11 +10213,11 @@ var require_zod_form_validation_default = createRule({
|
|
|
10078
10213
|
};
|
|
10079
10214
|
const isInstanceofNarrowing = (node) => {
|
|
10080
10215
|
const parent = node.parent;
|
|
10081
|
-
return parent !== null && parent !== void 0 && parent.type ===
|
|
10216
|
+
return parent !== null && parent !== void 0 && parent.type === import_utils65.AST_NODE_TYPES.BinaryExpression && parent.operator === "instanceof" && parent.left === node && parent.right.type === import_utils65.AST_NODE_TYPES.Identifier && (parent.right.name === "File" || parent.right.name === "Blob");
|
|
10082
10217
|
};
|
|
10083
10218
|
const boundDeclarator = (node) => {
|
|
10084
10219
|
const parent = node.parent;
|
|
10085
|
-
if (parent.type ===
|
|
10220
|
+
if (parent.type === import_utils65.AST_NODE_TYPES.VariableDeclarator && parent.init === node && parent.id.type === import_utils65.AST_NODE_TYPES.Identifier) {
|
|
10086
10221
|
return parent;
|
|
10087
10222
|
}
|
|
10088
10223
|
return null;
|
|
@@ -10110,7 +10245,7 @@ var require_zod_form_validation_default = createRule({
|
|
|
10110
10245
|
});
|
|
10111
10246
|
|
|
10112
10247
|
// src/rules/store-insert-requires-on-conflict.ts
|
|
10113
|
-
var
|
|
10248
|
+
var import_utils66 = require("@typescript-eslint/utils");
|
|
10114
10249
|
var INSERT_WRITE = /\bINSERT\s+(?:OR\s+\w+\s+)?INTO\s+[\w."'`?$:@-]+\s*(?:\([^)]*\)\s*)?(?:VALUES|SELECT|DEFAULT\s+VALUES)\b/i;
|
|
10115
10250
|
var CONFLICT_HANDLED = /\bON\s+CONFLICT\b|\bON\s+DUPLICATE\s+KEY\b|\bINSERT\s+OR\s+(?:IGNORE|REPLACE)\b/i;
|
|
10116
10251
|
var INSERT_GATE = /insert/i;
|
|
@@ -10141,7 +10276,7 @@ var store_insert_requires_on_conflict_default = createRule({
|
|
|
10141
10276
|
});
|
|
10142
10277
|
|
|
10143
10278
|
// src/rules/zod-naming-convention.ts
|
|
10144
|
-
var
|
|
10279
|
+
var import_utils67 = require("@typescript-eslint/utils");
|
|
10145
10280
|
var CONVENTIONS = {
|
|
10146
10281
|
prefix: { test: ZOD_PREFIX_RE, messageId: "zPrefix" },
|
|
10147
10282
|
suffix: { test: ZOD_SUFFIX_RE, messageId: "schemaSuffix" },
|
|
@@ -10166,15 +10301,15 @@ var NON_SCHEMA_TERMINALS = /* @__PURE__ */ new Set([
|
|
|
10166
10301
|
"registry",
|
|
10167
10302
|
"implement"
|
|
10168
10303
|
]);
|
|
10169
|
-
var terminalMethodName = (callee) => !callee.computed && callee.property.type ===
|
|
10304
|
+
var terminalMethodName = (callee) => !callee.computed && callee.property.type === import_utils67.AST_NODE_TYPES.Identifier ? callee.property.name : null;
|
|
10170
10305
|
var calleeChainStartsWithZ = (node) => {
|
|
10171
10306
|
let current = node;
|
|
10172
|
-
while (current.type ===
|
|
10307
|
+
while (current.type === import_utils67.AST_NODE_TYPES.MemberExpression) {
|
|
10173
10308
|
const receiver = current.object;
|
|
10174
|
-
if (receiver.type ===
|
|
10309
|
+
if (receiver.type === import_utils67.AST_NODE_TYPES.Identifier && receiver.name === "z") {
|
|
10175
10310
|
return true;
|
|
10176
10311
|
}
|
|
10177
|
-
if (receiver.type ===
|
|
10312
|
+
if (receiver.type === import_utils67.AST_NODE_TYPES.CallExpression) {
|
|
10178
10313
|
current = receiver.callee;
|
|
10179
10314
|
continue;
|
|
10180
10315
|
}
|
|
@@ -10219,13 +10354,13 @@ var zod_naming_convention_default = createRule({
|
|
|
10219
10354
|
VariableDeclarator(node) {
|
|
10220
10355
|
const init = node.init;
|
|
10221
10356
|
if (init === null || init === void 0) return;
|
|
10222
|
-
if (init.type !==
|
|
10357
|
+
if (init.type !== import_utils67.AST_NODE_TYPES.CallExpression) return;
|
|
10223
10358
|
const callee = init.callee;
|
|
10224
|
-
if (callee.type !==
|
|
10359
|
+
if (callee.type !== import_utils67.AST_NODE_TYPES.MemberExpression) return;
|
|
10225
10360
|
if (!calleeChainStartsWithZ(callee)) return;
|
|
10226
10361
|
const terminal = terminalMethodName(callee);
|
|
10227
10362
|
if (terminal !== null && NON_SCHEMA_TERMINALS.has(terminal)) return;
|
|
10228
|
-
if (node.id.type !==
|
|
10363
|
+
if (node.id.type !== import_utils67.AST_NODE_TYPES.Identifier) return;
|
|
10229
10364
|
if (test.test(node.id.name)) return;
|
|
10230
10365
|
if (acceptsSchemaWord && CONTAINS_SCHEMA_RE.test(node.id.name)) return;
|
|
10231
10366
|
context.report({
|
|
@@ -10273,7 +10408,7 @@ var retiredRules = {
|
|
|
10273
10408
|
},
|
|
10274
10409
|
"prefer-shadcn": {
|
|
10275
10410
|
removedIn: "3.0.0",
|
|
10276
|
-
reason: "Delete the entry;
|
|
10411
|
+
reason: "Delete the retired entry; application-profile consumers can separately adopt `@sarj/prefer-shadcn-primitives`."
|
|
10277
10412
|
},
|
|
10278
10413
|
"primary-export-file-name": {
|
|
10279
10414
|
removedIn: "4.0.0",
|
|
@@ -10337,6 +10472,7 @@ var rules = {
|
|
|
10337
10472
|
"prefer-constant-time-secret-compare": prefer_constant_time_secret_compare_default,
|
|
10338
10473
|
"prefer-discriminated-union": prefer_discriminated_union_default,
|
|
10339
10474
|
"prefer-input-group-search": prefer_input_group_search_default,
|
|
10475
|
+
"prefer-shadcn-primitives": prefer_shadcn_primitives_default,
|
|
10340
10476
|
"prefer-module-level-constant": prefer_module_level_constant_default,
|
|
10341
10477
|
"prefer-module-level-schema": prefer_module_level_schema_default,
|
|
10342
10478
|
"prefer-native-random-uuid": prefer_native_random_uuid_default,
|
|
@@ -10359,11 +10495,12 @@ var rules = {
|
|
|
10359
10495
|
};
|
|
10360
10496
|
var meta = {
|
|
10361
10497
|
name: "@sarj/eslint-plugin",
|
|
10362
|
-
version: "9.
|
|
10498
|
+
version: "9.12.1"
|
|
10363
10499
|
};
|
|
10364
10500
|
var applicationOnlyRules = [
|
|
10365
10501
|
"no-restricted-library-load",
|
|
10366
|
-
"prefer-native-random-uuid"
|
|
10502
|
+
"prefer-native-random-uuid",
|
|
10503
|
+
"prefer-shadcn-primitives"
|
|
10367
10504
|
];
|
|
10368
10505
|
var recommendedRules = {
|
|
10369
10506
|
"@sarj/enforce-file-structure": "warn",
|