@sarj/eslint-plugin 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +23 -144
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -8
- package/dist/index.d.ts +0 -8
- package/dist/index.js +23 -144
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -280,9 +280,6 @@ declare const rules: {
|
|
|
280
280
|
"prefer-zod-enum": _typescript_eslint_utils_ts_eslint.RuleModule<"preferEnum", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
281
281
|
name: string;
|
|
282
282
|
};
|
|
283
|
-
"primary-export-file-name": _typescript_eslint_utils_ts_eslint.RuleModule<"primaryExportMismatch", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
284
|
-
name: string;
|
|
285
|
-
};
|
|
286
283
|
"no-silent-promise-catch": _typescript_eslint_utils_ts_eslint.RuleModule<"silentCatch", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
287
284
|
name: string;
|
|
288
285
|
};
|
|
@@ -452,9 +449,6 @@ declare const plugin: {
|
|
|
452
449
|
"prefer-zod-enum": _typescript_eslint_utils_ts_eslint.RuleModule<"preferEnum", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
453
450
|
name: string;
|
|
454
451
|
};
|
|
455
|
-
"primary-export-file-name": _typescript_eslint_utils_ts_eslint.RuleModule<"primaryExportMismatch", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
456
|
-
name: string;
|
|
457
|
-
};
|
|
458
452
|
"no-silent-promise-catch": _typescript_eslint_utils_ts_eslint.RuleModule<"silentCatch", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
459
453
|
name: string;
|
|
460
454
|
};
|
|
@@ -562,7 +556,6 @@ declare const plugin: {
|
|
|
562
556
|
"@sarj/no-cors-wildcard-with-credentials": string;
|
|
563
557
|
"@sarj/no-secret-in-log": string;
|
|
564
558
|
"@sarj/no-unsafe-mock-casting": string;
|
|
565
|
-
"@sarj/primary-export-file-name": string;
|
|
566
559
|
"@sarj/prefer-string-literal-union": string;
|
|
567
560
|
"@sarj/prefer-zod-enum": string;
|
|
568
561
|
"@sarj/require-fetch-timeout": string;
|
|
@@ -617,7 +610,6 @@ declare const plugin: {
|
|
|
617
610
|
"@sarj/no-cors-wildcard-with-credentials": string;
|
|
618
611
|
"@sarj/no-secret-in-log": string;
|
|
619
612
|
"@sarj/no-unsafe-mock-casting": string;
|
|
620
|
-
"@sarj/primary-export-file-name": string;
|
|
621
613
|
"@sarj/prefer-string-literal-union": string;
|
|
622
614
|
"@sarj/prefer-zod-enum": string;
|
|
623
615
|
"@sarj/require-fetch-timeout": string;
|
package/dist/index.d.ts
CHANGED
|
@@ -280,9 +280,6 @@ declare const rules: {
|
|
|
280
280
|
"prefer-zod-enum": _typescript_eslint_utils_ts_eslint.RuleModule<"preferEnum", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
281
281
|
name: string;
|
|
282
282
|
};
|
|
283
|
-
"primary-export-file-name": _typescript_eslint_utils_ts_eslint.RuleModule<"primaryExportMismatch", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
284
|
-
name: string;
|
|
285
|
-
};
|
|
286
283
|
"no-silent-promise-catch": _typescript_eslint_utils_ts_eslint.RuleModule<"silentCatch", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
287
284
|
name: string;
|
|
288
285
|
};
|
|
@@ -452,9 +449,6 @@ declare const plugin: {
|
|
|
452
449
|
"prefer-zod-enum": _typescript_eslint_utils_ts_eslint.RuleModule<"preferEnum", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
453
450
|
name: string;
|
|
454
451
|
};
|
|
455
|
-
"primary-export-file-name": _typescript_eslint_utils_ts_eslint.RuleModule<"primaryExportMismatch", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
456
|
-
name: string;
|
|
457
|
-
};
|
|
458
452
|
"no-silent-promise-catch": _typescript_eslint_utils_ts_eslint.RuleModule<"silentCatch", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
459
453
|
name: string;
|
|
460
454
|
};
|
|
@@ -562,7 +556,6 @@ declare const plugin: {
|
|
|
562
556
|
"@sarj/no-cors-wildcard-with-credentials": string;
|
|
563
557
|
"@sarj/no-secret-in-log": string;
|
|
564
558
|
"@sarj/no-unsafe-mock-casting": string;
|
|
565
|
-
"@sarj/primary-export-file-name": string;
|
|
566
559
|
"@sarj/prefer-string-literal-union": string;
|
|
567
560
|
"@sarj/prefer-zod-enum": string;
|
|
568
561
|
"@sarj/require-fetch-timeout": string;
|
|
@@ -617,7 +610,6 @@ declare const plugin: {
|
|
|
617
610
|
"@sarj/no-cors-wildcard-with-credentials": string;
|
|
618
611
|
"@sarj/no-secret-in-log": string;
|
|
619
612
|
"@sarj/no-unsafe-mock-casting": string;
|
|
620
|
-
"@sarj/primary-export-file-name": string;
|
|
621
613
|
"@sarj/prefer-string-literal-union": string;
|
|
622
614
|
"@sarj/prefer-zod-enum": string;
|
|
623
615
|
"@sarj/require-fetch-timeout": string;
|
package/dist/index.js
CHANGED
|
@@ -7174,126 +7174,8 @@ var prefer_non_nullable_collection_default = ESLintUtils46.RuleCreator(
|
|
|
7174
7174
|
}
|
|
7175
7175
|
});
|
|
7176
7176
|
|
|
7177
|
-
// src/rules/primary-export-file-name.ts
|
|
7178
|
-
import { AST_NODE_TYPES as AST_NODE_TYPES34, ESLintUtils as ESLintUtils47 } from "@typescript-eslint/utils";
|
|
7179
|
-
var CONVENTIONAL_BUCKET_EXPORTS = /* @__PURE__ */ new Set(["cn"]);
|
|
7180
|
-
var GENERIC_ENTRYPOINTS = /* @__PURE__ */ new Set(["main", "run", "cli", "setup", "teardown", "execute"]);
|
|
7181
|
-
var ACRONYM_OVERRIDES = [
|
|
7182
|
-
[/OAuth/g, "Oauth"],
|
|
7183
|
-
[/GraphQL/g, "Graphql"],
|
|
7184
|
-
[/gRPC/g, "Grpc"]
|
|
7185
|
-
];
|
|
7186
|
-
var CAMEL_BOUNDARY_RE = /(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])/g;
|
|
7187
|
-
var basename = (filename) => filename.split(/[/\\]/).pop() ?? filename;
|
|
7188
|
-
var stemOf = (base) => base.replace(/\.(test|spec|config|d|stories)\.[cm]?[jt]sx?$/i, "").replace(/\.[cm]?[jt]sx?$/i, "");
|
|
7189
|
-
var kebabCase = (name) => {
|
|
7190
|
-
let normalized = name;
|
|
7191
|
-
for (const [pattern, replacement] of ACRONYM_OVERRIDES) {
|
|
7192
|
-
normalized = normalized.replace(pattern, replacement);
|
|
7193
|
-
}
|
|
7194
|
-
return normalized.replace(CAMEL_BOUNDARY_RE, "-").toLowerCase();
|
|
7195
|
-
};
|
|
7196
|
-
var isFunctionOrClass = (node) => node.type === AST_NODE_TYPES34.ArrowFunctionExpression || node.type === AST_NODE_TYPES34.FunctionExpression;
|
|
7197
|
-
var findPrimaryExport = (body) => {
|
|
7198
|
-
let exportCount = 0;
|
|
7199
|
-
let primaryCandidate = null;
|
|
7200
|
-
for (const statement of body) {
|
|
7201
|
-
if (statement.type === AST_NODE_TYPES34.ExportAllDeclaration) {
|
|
7202
|
-
return null;
|
|
7203
|
-
}
|
|
7204
|
-
if (statement.type === AST_NODE_TYPES34.ExportDefaultDeclaration) {
|
|
7205
|
-
exportCount += 1;
|
|
7206
|
-
const decl = statement.declaration;
|
|
7207
|
-
if ((decl.type === AST_NODE_TYPES34.FunctionDeclaration || decl.type === AST_NODE_TYPES34.ClassDeclaration) && decl.id !== null) {
|
|
7208
|
-
primaryCandidate = { name: decl.id.name, node: statement, isDefault: true };
|
|
7209
|
-
} else if (decl.type === AST_NODE_TYPES34.Identifier) {
|
|
7210
|
-
primaryCandidate = { name: decl.name, node: statement, isDefault: true };
|
|
7211
|
-
}
|
|
7212
|
-
} else if (statement.type === AST_NODE_TYPES34.ExportNamedDeclaration) {
|
|
7213
|
-
if (statement.source !== null) {
|
|
7214
|
-
return null;
|
|
7215
|
-
}
|
|
7216
|
-
const decl = statement.declaration;
|
|
7217
|
-
if (decl === null) {
|
|
7218
|
-
exportCount += statement.specifiers.length;
|
|
7219
|
-
if (statement.specifiers.length === 1 && primaryCandidate === null) {
|
|
7220
|
-
const spec = statement.specifiers[0];
|
|
7221
|
-
if (spec && spec.exported.type === AST_NODE_TYPES34.Identifier) {
|
|
7222
|
-
primaryCandidate = { name: spec.exported.name, node: statement, isDefault: false };
|
|
7223
|
-
}
|
|
7224
|
-
}
|
|
7225
|
-
} else if (decl.type === AST_NODE_TYPES34.FunctionDeclaration || decl.type === AST_NODE_TYPES34.ClassDeclaration) {
|
|
7226
|
-
if (decl.id !== null) {
|
|
7227
|
-
exportCount += 1;
|
|
7228
|
-
if (primaryCandidate === null) {
|
|
7229
|
-
primaryCandidate = { name: decl.id.name, node: statement, isDefault: false };
|
|
7230
|
-
}
|
|
7231
|
-
}
|
|
7232
|
-
} else if (decl.type === AST_NODE_TYPES34.VariableDeclaration) {
|
|
7233
|
-
for (const declarator of decl.declarations) {
|
|
7234
|
-
if (declarator.id.type === AST_NODE_TYPES34.Identifier) {
|
|
7235
|
-
exportCount += 1;
|
|
7236
|
-
if (primaryCandidate === null && declarator.init && isFunctionOrClass(declarator.init)) {
|
|
7237
|
-
primaryCandidate = { name: declarator.id.name, node: statement, isDefault: false };
|
|
7238
|
-
}
|
|
7239
|
-
}
|
|
7240
|
-
}
|
|
7241
|
-
} else if (decl.type === AST_NODE_TYPES34.TSTypeAliasDeclaration || decl.type === AST_NODE_TYPES34.TSInterfaceDeclaration) {
|
|
7242
|
-
exportCount += 1;
|
|
7243
|
-
if (primaryCandidate === null) {
|
|
7244
|
-
primaryCandidate = { name: decl.id.name, node: statement, isDefault: false };
|
|
7245
|
-
}
|
|
7246
|
-
}
|
|
7247
|
-
}
|
|
7248
|
-
}
|
|
7249
|
-
if (primaryCandidate === null || exportCount > 2) {
|
|
7250
|
-
return null;
|
|
7251
|
-
}
|
|
7252
|
-
return { ...primaryCandidate, count: exportCount };
|
|
7253
|
-
};
|
|
7254
|
-
var primary_export_file_name_default = ESLintUtils47.RuleCreator(
|
|
7255
|
-
(name) => `https://github.com/sarj-ai/standards/blob/main/packages/typescript/src/rules/${name}.ts`
|
|
7256
|
-
)({
|
|
7257
|
-
name: "primary-export-file-name",
|
|
7258
|
-
meta: {
|
|
7259
|
-
type: "suggestion",
|
|
7260
|
-
docs: {
|
|
7261
|
-
description: "Enforce semantic naming alignment: a file with a single primary export must be named after that export."
|
|
7262
|
-
},
|
|
7263
|
-
schema: [],
|
|
7264
|
-
messages: {
|
|
7265
|
-
primaryExportMismatch: "Module stem '{{stem}}' does not match its primary export '{{name}}' \u2014 rename the file to '{{expected}}{{ext}}' to describe its responsibility."
|
|
7266
|
-
}
|
|
7267
|
-
},
|
|
7268
|
-
defaultOptions: [],
|
|
7269
|
-
create(context) {
|
|
7270
|
-
const base = basename(context.filename);
|
|
7271
|
-
if (base.endsWith(".d.ts") || base.startsWith("index.") || base.startsWith("_")) return {};
|
|
7272
|
-
if (isTestFile(context.filename) || isGeneratedFile(context.filename, context.sourceCode.text)) return {};
|
|
7273
|
-
const stem3 = stemOf(base);
|
|
7274
|
-
if (stem3 === "page" || stem3 === "layout" || stem3 === "loading" || stem3 === "error" || stem3 === "not-found" || stem3 === "route" || stem3 === "__root" || stem3 === "config" || stem3 === "constants" || stem3 === "types" || stem3.startsWith("$") || stem3.startsWith("[")) {
|
|
7275
|
-
return {};
|
|
7276
|
-
}
|
|
7277
|
-
return {
|
|
7278
|
-
Program(node) {
|
|
7279
|
-
const primary = findPrimaryExport(node.body);
|
|
7280
|
-
if (primary === null) return;
|
|
7281
|
-
if (CONVENTIONAL_BUCKET_EXPORTS.has(primary.name) || GENERIC_ENTRYPOINTS.has(primary.name)) return;
|
|
7282
|
-
const expectedStem = kebabCase(primary.name);
|
|
7283
|
-
if (stem3 === expectedStem) return;
|
|
7284
|
-
const ext = base.endsWith(".tsx") ? ".tsx" : ".ts";
|
|
7285
|
-
context.report({
|
|
7286
|
-
node: primary.node,
|
|
7287
|
-
messageId: "primaryExportMismatch",
|
|
7288
|
-
data: { stem: stem3, name: primary.name, expected: expectedStem, ext }
|
|
7289
|
-
});
|
|
7290
|
-
}
|
|
7291
|
-
};
|
|
7292
|
-
}
|
|
7293
|
-
});
|
|
7294
|
-
|
|
7295
7177
|
// src/rules/no-implicit-attribute-access.ts
|
|
7296
|
-
import { AST_NODE_TYPES as
|
|
7178
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES34, ESLintUtils as ESLintUtils47 } from "@typescript-eslint/utils";
|
|
7297
7179
|
var EXCLUDED_BASES = /* @__PURE__ */ new Set([
|
|
7298
7180
|
"environ",
|
|
7299
7181
|
"headers",
|
|
@@ -7309,15 +7191,15 @@ var EXCLUDED_BASES = /* @__PURE__ */ new Set([
|
|
|
7309
7191
|
"sessionStorage"
|
|
7310
7192
|
]);
|
|
7311
7193
|
function getBaseName(node) {
|
|
7312
|
-
if (node.type ===
|
|
7194
|
+
if (node.type === AST_NODE_TYPES34.Identifier) {
|
|
7313
7195
|
return node.name;
|
|
7314
7196
|
}
|
|
7315
|
-
if (node.type ===
|
|
7197
|
+
if (node.type === AST_NODE_TYPES34.MemberExpression && node.property.type === AST_NODE_TYPES34.Identifier) {
|
|
7316
7198
|
return node.property.name;
|
|
7317
7199
|
}
|
|
7318
7200
|
return null;
|
|
7319
7201
|
}
|
|
7320
|
-
var no_implicit_attribute_access_default =
|
|
7202
|
+
var no_implicit_attribute_access_default = ESLintUtils47.RuleCreator(
|
|
7321
7203
|
(name) => `https://github.com/sarj-ai/standards/blob/main/packages/typescript/src/rules/${name}.ts`
|
|
7322
7204
|
)({
|
|
7323
7205
|
name: "no-implicit-attribute-access",
|
|
@@ -7338,7 +7220,7 @@ var no_implicit_attribute_access_default = ESLintUtils48.RuleCreator(
|
|
|
7338
7220
|
if (!node.computed) {
|
|
7339
7221
|
return;
|
|
7340
7222
|
}
|
|
7341
|
-
if (node.property.type ===
|
|
7223
|
+
if (node.property.type === AST_NODE_TYPES34.Literal && typeof node.property.value === "string") {
|
|
7342
7224
|
const baseName = getBaseName(node.object);
|
|
7343
7225
|
if (!baseName || !EXCLUDED_BASES.has(baseName)) {
|
|
7344
7226
|
context.report({
|
|
@@ -7351,11 +7233,11 @@ var no_implicit_attribute_access_default = ESLintUtils48.RuleCreator(
|
|
|
7351
7233
|
},
|
|
7352
7234
|
CallExpression(node) {
|
|
7353
7235
|
const callee = node.callee;
|
|
7354
|
-
if (callee.type ===
|
|
7355
|
-
const method = callee.property.type ===
|
|
7236
|
+
if (callee.type === AST_NODE_TYPES34.MemberExpression) {
|
|
7237
|
+
const method = callee.property.type === AST_NODE_TYPES34.Identifier ? callee.property.name : null;
|
|
7356
7238
|
if (method === "get") {
|
|
7357
7239
|
const arg = node.arguments[0];
|
|
7358
|
-
if (arg && arg.type ===
|
|
7240
|
+
if (arg && arg.type === AST_NODE_TYPES34.Literal && typeof arg.value === "string") {
|
|
7359
7241
|
const baseName = getBaseName(callee.object);
|
|
7360
7242
|
if (!baseName || !EXCLUDED_BASES.has(baseName)) {
|
|
7361
7243
|
context.report({
|
|
@@ -7373,8 +7255,8 @@ var no_implicit_attribute_access_default = ESLintUtils48.RuleCreator(
|
|
|
7373
7255
|
});
|
|
7374
7256
|
|
|
7375
7257
|
// src/rules/strict-test-assertions.ts
|
|
7376
|
-
import { AST_NODE_TYPES as
|
|
7377
|
-
var strict_test_assertions_default =
|
|
7258
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES35, ESLintUtils as ESLintUtils48 } from "@typescript-eslint/utils";
|
|
7259
|
+
var strict_test_assertions_default = ESLintUtils48.RuleCreator.withoutDocs({
|
|
7378
7260
|
meta: {
|
|
7379
7261
|
type: "suggestion",
|
|
7380
7262
|
docs: {
|
|
@@ -7392,9 +7274,9 @@ var strict_test_assertions_default = ESLintUtils49.RuleCreator.withoutDocs({
|
|
|
7392
7274
|
let currentObject = null;
|
|
7393
7275
|
let sequence = [];
|
|
7394
7276
|
function getExpectObject(expr) {
|
|
7395
|
-
if (expr.type ===
|
|
7277
|
+
if (expr.type === AST_NODE_TYPES35.CallExpression && expr.callee.type === AST_NODE_TYPES35.MemberExpression && expr.callee.object.type === AST_NODE_TYPES35.CallExpression && expr.callee.object.callee.type === AST_NODE_TYPES35.Identifier && expr.callee.object.callee.name === "expect" && expr.callee.object.arguments.length === 1) {
|
|
7396
7278
|
const arg = expr.callee.object.arguments.at(0);
|
|
7397
|
-
if (arg?.type ===
|
|
7279
|
+
if (arg?.type === AST_NODE_TYPES35.MemberExpression) {
|
|
7398
7280
|
return arg.object;
|
|
7399
7281
|
}
|
|
7400
7282
|
}
|
|
@@ -7410,12 +7292,12 @@ var strict_test_assertions_default = ESLintUtils49.RuleCreator.withoutDocs({
|
|
|
7410
7292
|
if (!currentObject) return null;
|
|
7411
7293
|
const objectText = context.sourceCode.getText(currentObject);
|
|
7412
7294
|
const props = sequence.map((stmt) => {
|
|
7413
|
-
if (stmt.expression.type !==
|
|
7295
|
+
if (stmt.expression.type !== AST_NODE_TYPES35.CallExpression || stmt.expression.callee.type !== AST_NODE_TYPES35.MemberExpression || stmt.expression.callee.object.type !== AST_NODE_TYPES35.CallExpression) {
|
|
7414
7296
|
return null;
|
|
7415
7297
|
}
|
|
7416
7298
|
const actual = stmt.expression.callee.object.arguments.at(0);
|
|
7417
7299
|
const expected = stmt.expression.arguments.at(0);
|
|
7418
|
-
if (actual?.type ===
|
|
7300
|
+
if (actual?.type === AST_NODE_TYPES35.MemberExpression && actual.property.type === AST_NODE_TYPES35.Identifier && expected) {
|
|
7419
7301
|
const propName2 = actual.property.name;
|
|
7420
7302
|
const valText = context.sourceCode.getText(expected);
|
|
7421
7303
|
return `${propName2}: ${valText}`;
|
|
@@ -7433,7 +7315,7 @@ var strict_test_assertions_default = ESLintUtils49.RuleCreator.withoutDocs({
|
|
|
7433
7315
|
}
|
|
7434
7316
|
}
|
|
7435
7317
|
for (const statement of body) {
|
|
7436
|
-
if (statement.type ===
|
|
7318
|
+
if (statement.type === AST_NODE_TYPES35.ExpressionStatement) {
|
|
7437
7319
|
const obj = getExpectObject(statement.expression);
|
|
7438
7320
|
if (obj && currentObject && context.sourceCode.getText(obj) === context.sourceCode.getText(currentObject)) {
|
|
7439
7321
|
sequence.push(statement);
|
|
@@ -7467,8 +7349,8 @@ var strict_test_assertions_default = ESLintUtils49.RuleCreator.withoutDocs({
|
|
|
7467
7349
|
});
|
|
7468
7350
|
|
|
7469
7351
|
// src/rules/no-async-callback-in-waitfor.ts
|
|
7470
|
-
import { AST_NODE_TYPES as
|
|
7471
|
-
var no_async_callback_in_waitfor_default =
|
|
7352
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES36, ESLintUtils as ESLintUtils49 } from "@typescript-eslint/utils";
|
|
7353
|
+
var no_async_callback_in_waitfor_default = ESLintUtils49.RuleCreator(
|
|
7472
7354
|
(name) => `https://github.com/sarj-ai/standards/blob/main/packages/typescript/src/rules/${name}.ts`
|
|
7473
7355
|
)({
|
|
7474
7356
|
name: "no-async-callback-in-waitfor",
|
|
@@ -7489,9 +7371,9 @@ var no_async_callback_in_waitfor_default = ESLintUtils50.RuleCreator(
|
|
|
7489
7371
|
}
|
|
7490
7372
|
return {
|
|
7491
7373
|
CallExpression(node) {
|
|
7492
|
-
if (node.callee.type ===
|
|
7374
|
+
if (node.callee.type === AST_NODE_TYPES36.Identifier && node.callee.name === "waitFor") {
|
|
7493
7375
|
const callback = node.arguments[0];
|
|
7494
|
-
if (callback && (callback.type ===
|
|
7376
|
+
if (callback && (callback.type === AST_NODE_TYPES36.ArrowFunctionExpression || callback.type === AST_NODE_TYPES36.FunctionExpression) && callback.async) {
|
|
7495
7377
|
context.report({
|
|
7496
7378
|
node: callback,
|
|
7497
7379
|
messageId: "noAsyncCallbackInWaitFor"
|
|
@@ -7504,8 +7386,8 @@ var no_async_callback_in_waitfor_default = ESLintUtils50.RuleCreator(
|
|
|
7504
7386
|
});
|
|
7505
7387
|
|
|
7506
7388
|
// src/rules/prefer-setup-file-mocks.ts
|
|
7507
|
-
import { AST_NODE_TYPES as
|
|
7508
|
-
var prefer_setup_file_mocks_default =
|
|
7389
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES37, ESLintUtils as ESLintUtils50 } from "@typescript-eslint/utils";
|
|
7390
|
+
var prefer_setup_file_mocks_default = ESLintUtils50.RuleCreator(
|
|
7509
7391
|
(name) => `https://github.com/sarj-ai/standards/blob/main/packages/typescript/src/rules/${name}.ts`
|
|
7510
7392
|
)({
|
|
7511
7393
|
name: "prefer-setup-file-mocks",
|
|
@@ -7526,7 +7408,7 @@ var prefer_setup_file_mocks_default = ESLintUtils51.RuleCreator(
|
|
|
7526
7408
|
}
|
|
7527
7409
|
return {
|
|
7528
7410
|
CallExpression(node) {
|
|
7529
|
-
if (node.callee.type ===
|
|
7411
|
+
if (node.callee.type === AST_NODE_TYPES37.MemberExpression && node.callee.object.type === AST_NODE_TYPES37.Identifier && (node.callee.object.name === "vi" || node.callee.object.name === "jest") && node.callee.property.type === AST_NODE_TYPES37.Identifier && node.callee.property.name === "mock") {
|
|
7530
7412
|
context.report({
|
|
7531
7413
|
node,
|
|
7532
7414
|
messageId: "preferSetupFileMocks"
|
|
@@ -7564,7 +7446,6 @@ var rules = {
|
|
|
7564
7446
|
"no-unsafe-mock-casting": no_unsafe_mock_casting_default,
|
|
7565
7447
|
"prefer-string-literal-union": prefer_string_literal_union_default,
|
|
7566
7448
|
"prefer-zod-enum": prefer_zod_enum_default,
|
|
7567
|
-
"primary-export-file-name": primary_export_file_name_default,
|
|
7568
7449
|
"no-silent-promise-catch": no_silent_promise_catch_default,
|
|
7569
7450
|
"require-fetch-timeout": require_fetch_timeout_default,
|
|
7570
7451
|
"no-offset-pagination": no_offset_pagination_default,
|
|
@@ -7594,7 +7475,7 @@ var rules = {
|
|
|
7594
7475
|
var plugin = {
|
|
7595
7476
|
meta: {
|
|
7596
7477
|
name: "@sarj/eslint-plugin",
|
|
7597
|
-
version: "
|
|
7478
|
+
version: "4.0.0"
|
|
7598
7479
|
},
|
|
7599
7480
|
rules,
|
|
7600
7481
|
configs: {
|
|
@@ -7628,7 +7509,6 @@ var plugin = {
|
|
|
7628
7509
|
"@sarj/no-cors-wildcard-with-credentials": "warn",
|
|
7629
7510
|
"@sarj/no-secret-in-log": "warn",
|
|
7630
7511
|
"@sarj/no-unsafe-mock-casting": "warn",
|
|
7631
|
-
"@sarj/primary-export-file-name": "warn",
|
|
7632
7512
|
"@sarj/prefer-string-literal-union": "warn",
|
|
7633
7513
|
"@sarj/prefer-zod-enum": "warn",
|
|
7634
7514
|
// Mined from 2y of PR review feedback + 5-repo code-smell audit (2026-07).
|
|
@@ -7718,7 +7598,6 @@ var plugin = {
|
|
|
7718
7598
|
"@sarj/no-cors-wildcard-with-credentials": "error",
|
|
7719
7599
|
"@sarj/no-secret-in-log": "error",
|
|
7720
7600
|
"@sarj/no-unsafe-mock-casting": "error",
|
|
7721
|
-
"@sarj/primary-export-file-name": "error",
|
|
7722
7601
|
// Promoted to error 2026-07-25 — strict means strict (user directive).
|
|
7723
7602
|
"@sarj/prefer-string-literal-union": "error",
|
|
7724
7603
|
"@sarj/prefer-zod-enum": "error",
|