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