@sarj/eslint-plugin 15.26.0 → 15.26.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/dist/index.cjs +21 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +21 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -96,6 +96,7 @@ ${missing.join("\n")}`);
|
|
|
96
96
|
rationale: spec.rationale,
|
|
97
97
|
remediation: spec.remediation,
|
|
98
98
|
category: spec.category,
|
|
99
|
+
defaultLevel: spec.defaultLevel,
|
|
99
100
|
languages: spec.languages,
|
|
100
101
|
autofix: spec.autofix,
|
|
101
102
|
aliases: spec.aliases,
|
|
@@ -177,6 +178,7 @@ function nativeSpec(config, documentation) {
|
|
|
177
178
|
rationale: documentation.rationale,
|
|
178
179
|
remediation: documentation.remediation,
|
|
179
180
|
category: documentation.category,
|
|
181
|
+
defaultLevel: documentation.defaultLevel ?? "error",
|
|
180
182
|
languages: [...documentation.languages ?? ["typescript"]],
|
|
181
183
|
autofix: documentation.autofix ?? "none",
|
|
182
184
|
aliases,
|
|
@@ -1020,6 +1022,7 @@ var require_button_accessible_name_default = createRule({
|
|
|
1020
1022
|
// src/rules/require-camelcase-properties.ts
|
|
1021
1023
|
var import_utils9 = require("@typescript-eslint/utils");
|
|
1022
1024
|
var REQUIRE_CAMELCASE_PROPERTIES_DOCUMENTATION = {
|
|
1025
|
+
defaultLevel: "warning",
|
|
1023
1026
|
summary: "Require unquoted lower snake_case TypeScript properties and dot access to use camelCase.",
|
|
1024
1027
|
rationale: "Unquoted snake_case property syntax makes external wire naming indistinguishable from application-domain naming and lets inconsistent contracts spread through typed code.",
|
|
1025
1028
|
remediation: "Rename application properties to camelCase. At an external wire boundary, make the exception explicit with a quoted key and bracket access.",
|
|
@@ -2348,6 +2351,7 @@ var FILE_SELF_REFERENCE_RE = /\bthis (?:file|module)\b/iu;
|
|
|
2348
2351
|
var CHANGE_HISTORY_RE = /\b(?:used to|previously|histor(?:y|ical)|keep moving|models? (?:move|moved|change|changed)|still under review)\b/iu;
|
|
2349
2352
|
var IMPLEMENTATION_MAP_RE = /\b(?:everything (?:above|below)|nothing else|only thing|write half|maps? between|seam between)\b/iu;
|
|
2350
2353
|
var EXCESSIVE_COMMENTARY_DOCUMENTATION = {
|
|
2354
|
+
defaultLevel: "warning",
|
|
2351
2355
|
summary: "Flag long standalone implementation commentary that should be expressed by code.",
|
|
2352
2356
|
rationale: "Narrative implementation paragraphs compete with the code and can drift independently from behavior.",
|
|
2353
2357
|
remediation: "Delete narration and clarify names, types, or structure; retain only durable constraints and external contracts.",
|
|
@@ -5950,6 +5954,7 @@ function branchTerminates(branch) {
|
|
|
5950
5954
|
var import_utils36 = require("@typescript-eslint/utils");
|
|
5951
5955
|
var import_typescript5 = __toESM(require("typescript"), 1);
|
|
5952
5956
|
var NO_JSON_STRINGIFY_OBJECT_EQUALITY_DOCUMENTATION = {
|
|
5957
|
+
defaultLevel: "warning",
|
|
5953
5958
|
summary: "Do not use JSON serialization as structural object equality.",
|
|
5954
5959
|
rationale: "JSON text equality depends on property insertion order and serialization behavior, so semantically equal objects can compare unequal and distinct values can collapse together.",
|
|
5955
5960
|
remediation: "Compare an explicit domain projection structurally, or use a reviewed canonical serializer when JSON semantics are required.",
|
|
@@ -7209,6 +7214,7 @@ var no_bare_return_from_test_catch_default = createRule({
|
|
|
7209
7214
|
// src/rules/no-bespoke-api-case-conversion.ts
|
|
7210
7215
|
var import_utils45 = require("@typescript-eslint/utils");
|
|
7211
7216
|
var NO_BESPOKE_API_CASE_CONVERSION_DOCUMENTATION = {
|
|
7217
|
+
defaultLevel: "warning",
|
|
7212
7218
|
summary: "Review direct snake_case/camelCase mirror mappings on explicitly API-typed adapter values.",
|
|
7213
7219
|
rationale: "Duplicating wire-name translation can drift from an API client contract. When the SDK owns application-facing names, centralizing conversion avoids maintaining another mirror by hand.",
|
|
7214
7220
|
remediation: "Move wire-name ownership and case conversion into the generated SDK/model layer; keep application adapters on the generated typed surface.",
|
|
@@ -8955,6 +8961,7 @@ var WALL_NARRATION_RE2 = /^(?:(?:\d+[.)]|(?:phase|step)\s+\d+\s*:?)\s*)?(?:add|b
|
|
|
8955
8961
|
var WALL_CLUSTER_MAX_LINE_GAP = 8;
|
|
8956
8962
|
var WALL_CLUSTER_MIN_COMMENTS = 3;
|
|
8957
8963
|
var NO_RESTATED_COMMENT_DOCUMENTATION = {
|
|
8964
|
+
defaultLevel: "warning",
|
|
8958
8965
|
summary: "Flag short standalone comments that repeat the adjacent statement's identifiers.",
|
|
8959
8966
|
rationale: "A comment that only repeats code adds no context and can become stale independently.",
|
|
8960
8967
|
remediation: "Remove a genuine restatement; retain conditions, constraints, rationale, and information absent from the statement.",
|
|
@@ -9104,6 +9111,7 @@ function isRestatableLabel(body2) {
|
|
|
9104
9111
|
// src/rules/no-restated-jsdoc.ts
|
|
9105
9112
|
var import_utils57 = require("@typescript-eslint/utils");
|
|
9106
9113
|
var NO_RESTATED_JSDOC_DOCUMENTATION = {
|
|
9114
|
+
defaultLevel: "warning",
|
|
9107
9115
|
summary: "Flag JSDoc prose that appears to repeat declaration names without adding behavioral information.",
|
|
9108
9116
|
rationale: "Signature-only JSDoc duplicates type information and drifts without helping callers.",
|
|
9109
9117
|
remediation: "Delete the block or document behavior, constraints, failures, or context the signature cannot express.",
|
|
@@ -13663,6 +13671,7 @@ var prefer_input_group_search_default = createRule({
|
|
|
13663
13671
|
// src/rules/prefer-millisecond-control-duration-schema.ts
|
|
13664
13672
|
var import_utils84 = require("@typescript-eslint/utils");
|
|
13665
13673
|
var PREFER_MILLISECOND_CONTROL_DURATION_SCHEMA_DOCUMENTATION = {
|
|
13674
|
+
defaultLevel: "warning",
|
|
13666
13675
|
summary: "Require application-owned Zod control-duration fields to use millisecond granularity.",
|
|
13667
13676
|
rationale: "Second-granularity timeout and scheduling controls lose precision and invite implicit unit conversion at API boundaries. Encoding milliseconds in the schema keeps the unit explicit and composes with platform timing APIs.",
|
|
13668
13677
|
remediation: "Rename the field with an `Ms`/`_ms` suffix and express its bounds and default in milliseconds; update the owning API contract rather than converting in application code.",
|
|
@@ -15282,6 +15291,7 @@ var FUNCTION_TYPES9 = /* @__PURE__ */ new Set([
|
|
|
15282
15291
|
import_utils89.AST_NODE_TYPES.FunctionExpression
|
|
15283
15292
|
]);
|
|
15284
15293
|
var PREFER_MODULE_LEVEL_REFINED_SCHEMA_DOCUMENTATION = {
|
|
15294
|
+
defaultLevel: "warning",
|
|
15285
15295
|
summary: "Declare closed Zod scalar, format, and wrapper schemas at module scope.",
|
|
15286
15296
|
rationale: "A closed validation pipeline created inside a function is rebuilt on every invocation and obscures a reusable constraint.",
|
|
15287
15297
|
remediation: "Move the validation schema to module scope, name it with a PascalCase Schema suffix, and call parse on the shared schema.",
|
|
@@ -15555,6 +15565,7 @@ var prefer_module_level_refined_schema_default = createRule({
|
|
|
15555
15565
|
// src/rules/prefer-multi-value-zod-literal.ts
|
|
15556
15566
|
var import_utils90 = require("@typescript-eslint/utils");
|
|
15557
15567
|
var PREFER_MULTI_VALUE_ZOD_LITERAL_DOCUMENTATION = {
|
|
15568
|
+
defaultLevel: "warning",
|
|
15558
15569
|
summary: "Use the Zod 4 multi-value literal API instead of a union of literal schemas.",
|
|
15559
15570
|
rationale: "One multi-value literal expresses the same closed value domain without repeated schema wrappers.",
|
|
15560
15571
|
remediation: "Replace the union with z.literal([value1, value2, ...]).",
|
|
@@ -15741,6 +15752,7 @@ var prefer_named_callback_domain_default = createRule({
|
|
|
15741
15752
|
// src/rules/prefer-named-complex-return-type.ts
|
|
15742
15753
|
var import_utils92 = require("@typescript-eslint/utils");
|
|
15743
15754
|
var PREFER_NAMED_COMPLEX_RETURN_TYPE_DOCUMENTATION = {
|
|
15755
|
+
defaultLevel: "warning",
|
|
15744
15756
|
summary: "Prefer a named contract for structurally complex function return types.",
|
|
15745
15757
|
rationale: "A large inline return annotation hides a reusable domain concept and makes signatures difficult to scan.",
|
|
15746
15758
|
remediation: "Name the complex nested shape while preserving its generic wrappers and type parameters; reference the named contract from the return annotation.",
|
|
@@ -15901,6 +15913,7 @@ var prefer_native_random_uuid_default = createRule({
|
|
|
15901
15913
|
// src/rules/prefer-node-crypto-hash.ts
|
|
15902
15914
|
var import_utils94 = require("@typescript-eslint/utils");
|
|
15903
15915
|
var PREFER_NODE_CRYPTO_HASH_DOCUMENTATION = {
|
|
15916
|
+
defaultLevel: "warning",
|
|
15904
15917
|
summary: "Prefer the modern one-shot node:crypto hash API when streaming state is unnecessary.",
|
|
15905
15918
|
rationale: "A createHash-update-digest chain allocates mutable streaming state for a single in-memory value; Node's built-in hash function expresses the one-shot operation directly and can use its optimized fast path.",
|
|
15906
15919
|
remediation: "On a supported Node runtime, consider hash(algorithm, value, encoding). Preserve the output encoding explicitly: digest() returns a Buffer, while hash defaults to hex. Keep createHash for streams or multiple updates.",
|
|
@@ -16033,6 +16046,7 @@ function isCreateHashCall(node, directBindings, namespaceBindings, resolve2) {
|
|
|
16033
16046
|
// src/rules/prefer-node-fs-promises.ts
|
|
16034
16047
|
var import_utils95 = require("@typescript-eslint/utils");
|
|
16035
16048
|
var PREFER_NODE_FS_PROMISES_DOCUMENTATION = {
|
|
16049
|
+
defaultLevel: "warning",
|
|
16036
16050
|
summary: "Prefer promise-based Node.js filesystem APIs over synchronous calls in production modules.",
|
|
16037
16051
|
rationale: "Synchronous filesystem work blocks the event loop and can stall unrelated daemon, server, and worker tasks.",
|
|
16038
16052
|
remediation: "Import the promise API from node:fs/promises and await it; use FileHandle.sync only where a documented durability boundary requires it.",
|
|
@@ -17299,6 +17313,7 @@ function ifGuardDominates(use, branch, positive) {
|
|
|
17299
17313
|
// src/rules/prefer-shared-zod-enum.ts
|
|
17300
17314
|
var import_utils100 = require("@typescript-eslint/utils");
|
|
17301
17315
|
var PREFER_SHARED_ZOD_ENUM_DOCUMENTATION = {
|
|
17316
|
+
defaultLevel: "warning",
|
|
17302
17317
|
summary: "Give repeated literal Zod enum domains one reusable module-level schema.",
|
|
17303
17318
|
rationale: "Repeated literal domains hide a shared contract and allow equivalent fields to drift independently.",
|
|
17304
17319
|
remediation: "Declare a module-level named Zod enum schema and reuse it at each field or contract site.",
|
|
@@ -17386,6 +17401,7 @@ var prefer_shared_zod_enum_default = createRule({
|
|
|
17386
17401
|
// src/rules/prefer-switch-for-repeated-equality.ts
|
|
17387
17402
|
var import_utils101 = require("@typescript-eslint/utils");
|
|
17388
17403
|
var PREFER_SWITCH_FOR_REPEATED_EQUALITY_DOCUMENTATION = {
|
|
17404
|
+
defaultLevel: "warning",
|
|
17389
17405
|
summary: "Prefer switch over long if/else-if chains that compare one value for strict equality.",
|
|
17390
17406
|
rationale: "A switch makes finite dispatch cases visually uniform and easier to extend without duplicating the discriminant.",
|
|
17391
17407
|
remediation: "Replace three or more strict-equality branches over the same discriminant with a switch; keep if statements for ranges, guards, and heterogeneous predicates.",
|
|
@@ -18244,6 +18260,7 @@ var LITERAL_KEY_HAZARDS = /* @__PURE__ */ new Set(["__proto__"]);
|
|
|
18244
18260
|
var NUMERIC_SIGNS2 = /* @__PURE__ */ new Set(["-", "+"]);
|
|
18245
18261
|
var MIN_RUN_LENGTH = 2;
|
|
18246
18262
|
var PREFER_WHOLE_OBJECT_ASSERTION_DOCUMENTATION = {
|
|
18263
|
+
defaultLevel: "warning",
|
|
18247
18264
|
summary: "Collapse consecutive assertions on one object into a whole-object assertion so related mismatches are reported together.",
|
|
18248
18265
|
rationale: "One whole-object assertion presents related expectations together and produces a complete structural diff.",
|
|
18249
18266
|
remediation: "Consider one `toMatchObject` assertion for ordinary data objects. Preserve missing-property checks, identity, and getter or proxy behavior when deciding whether to combine assertions.",
|
|
@@ -20071,6 +20088,7 @@ var require_fetch_timeout_default = createRule({
|
|
|
20071
20088
|
// src/rules/require-interface-for-exported-class.ts
|
|
20072
20089
|
var import_utils110 = require("@typescript-eslint/utils");
|
|
20073
20090
|
var REQUIRE_INTERFACE_FOR_EXPORTED_CLASS_DOCUMENTATION = {
|
|
20091
|
+
defaultLevel: "warning",
|
|
20074
20092
|
summary: "Require exported concrete classes with public behavior to declare a contract.",
|
|
20075
20093
|
rationale: "An explicit contract names the intended public capability separately from implementation details. TypeScript already supports structural compatibility; this is an architecture policy, not a prerequisite for substitution.",
|
|
20076
20094
|
remediation: "Declare a focused interface and add an implements clause, or inherit from an intentional base contract.",
|
|
@@ -20850,6 +20868,7 @@ var MODEL_EXECUTION_METHODS = /* @__PURE__ */ new Set([
|
|
|
20850
20868
|
]);
|
|
20851
20869
|
var DATABASE_NAMES = /^(?:db|database|connection|pool|prisma|query|transaction|tx)$/iu;
|
|
20852
20870
|
var REQUIRE_SQL_ACCESS_CLASS_DOCUMENTATION = {
|
|
20871
|
+
defaultLevel: "warning",
|
|
20853
20872
|
summary: "Keep SQL reads and writes inside a class that receives its database dependency.",
|
|
20854
20873
|
rationale: "An injected repository class is the preferred ownership boundary for database access under this architectural policy; free functions can also express explicit dependencies.",
|
|
20855
20874
|
remediation: "Move the query into a repository or store class and inject the pool, connection, transaction, or typed database binding through its constructor.",
|
|
@@ -22565,6 +22584,7 @@ function importedAssertionKind(specifier) {
|
|
|
22565
22584
|
// src/rules/sole-export-matches-filename.ts
|
|
22566
22585
|
var import_utils120 = require("@typescript-eslint/utils");
|
|
22567
22586
|
var SOLE_EXPORT_MATCHES_FILENAME_DOCUMENTATION = {
|
|
22587
|
+
defaultLevel: "warning",
|
|
22568
22588
|
summary: "Make a module filename reflect its sole named public runtime export.",
|
|
22569
22589
|
rationale: "When a module owns one runtime responsibility, matching names make that responsibility directly discoverable.",
|
|
22570
22590
|
remediation: "Name the module for the exported responsibility, using either the full export name or a clear leading or trailing domain phrase; otherwise colocate genuinely related exports.",
|
|
@@ -23232,7 +23252,7 @@ var RULES = {
|
|
|
23232
23252
|
};
|
|
23233
23253
|
var meta = {
|
|
23234
23254
|
name: "@sarj/eslint-plugin",
|
|
23235
|
-
version: "15.26.
|
|
23255
|
+
version: "15.26.1"
|
|
23236
23256
|
};
|
|
23237
23257
|
var APPLICATION_ONLY_RULES = [];
|
|
23238
23258
|
var LIBRARY_IMPORT_POLICY = ["error", {
|
package/dist/index.d.cts
CHANGED
|
@@ -17,6 +17,7 @@ declare const RETIRED_RULES: Readonly<Record<string, RetiredRule>>;
|
|
|
17
17
|
|
|
18
18
|
type RuleCategory = "architecture" | "correctness" | "maintainability" | "performance" | "security" | "style" | "testing";
|
|
19
19
|
type AutofixPolicy = "none" | "safe" | "suggestion";
|
|
20
|
+
type DefaultLevel = "error" | "warning";
|
|
20
21
|
type ExampleOutcome = "match" | "no-match";
|
|
21
22
|
interface ExampleFile {
|
|
22
23
|
readonly path: string;
|
|
@@ -40,6 +41,7 @@ interface RuleDocumentation {
|
|
|
40
41
|
readonly rationale: string;
|
|
41
42
|
readonly remediation: string;
|
|
42
43
|
readonly category: RuleCategory;
|
|
44
|
+
readonly defaultLevel?: DefaultLevel;
|
|
43
45
|
readonly languages?: readonly "typescript"[];
|
|
44
46
|
readonly autofix?: AutofixPolicy;
|
|
45
47
|
readonly aliases?: readonly string[];
|
|
@@ -69,6 +71,7 @@ interface PublicRuleSpec {
|
|
|
69
71
|
readonly rationale: string;
|
|
70
72
|
readonly remediation: string;
|
|
71
73
|
readonly category: RuleCategory;
|
|
74
|
+
readonly defaultLevel: DefaultLevel;
|
|
72
75
|
readonly languages: readonly "typescript"[];
|
|
73
76
|
readonly autofix: AutofixPolicy;
|
|
74
77
|
readonly aliases: readonly string[];
|
|
@@ -998,7 +1001,7 @@ type FlatPreset = {
|
|
|
998
1001
|
declare const PLUGIN: {
|
|
999
1002
|
readonly meta: {
|
|
1000
1003
|
readonly name: "@sarj/eslint-plugin";
|
|
1001
|
-
readonly version: "15.26.
|
|
1004
|
+
readonly version: "15.26.1";
|
|
1002
1005
|
};
|
|
1003
1006
|
readonly rules: {
|
|
1004
1007
|
readonly "no-conditional-empty-object-spread": DocumentedRule<[], "avoid">;
|
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ declare const RETIRED_RULES: Readonly<Record<string, RetiredRule>>;
|
|
|
17
17
|
|
|
18
18
|
type RuleCategory = "architecture" | "correctness" | "maintainability" | "performance" | "security" | "style" | "testing";
|
|
19
19
|
type AutofixPolicy = "none" | "safe" | "suggestion";
|
|
20
|
+
type DefaultLevel = "error" | "warning";
|
|
20
21
|
type ExampleOutcome = "match" | "no-match";
|
|
21
22
|
interface ExampleFile {
|
|
22
23
|
readonly path: string;
|
|
@@ -40,6 +41,7 @@ interface RuleDocumentation {
|
|
|
40
41
|
readonly rationale: string;
|
|
41
42
|
readonly remediation: string;
|
|
42
43
|
readonly category: RuleCategory;
|
|
44
|
+
readonly defaultLevel?: DefaultLevel;
|
|
43
45
|
readonly languages?: readonly "typescript"[];
|
|
44
46
|
readonly autofix?: AutofixPolicy;
|
|
45
47
|
readonly aliases?: readonly string[];
|
|
@@ -69,6 +71,7 @@ interface PublicRuleSpec {
|
|
|
69
71
|
readonly rationale: string;
|
|
70
72
|
readonly remediation: string;
|
|
71
73
|
readonly category: RuleCategory;
|
|
74
|
+
readonly defaultLevel: DefaultLevel;
|
|
72
75
|
readonly languages: readonly "typescript"[];
|
|
73
76
|
readonly autofix: AutofixPolicy;
|
|
74
77
|
readonly aliases: readonly string[];
|
|
@@ -998,7 +1001,7 @@ type FlatPreset = {
|
|
|
998
1001
|
declare const PLUGIN: {
|
|
999
1002
|
readonly meta: {
|
|
1000
1003
|
readonly name: "@sarj/eslint-plugin";
|
|
1001
|
-
readonly version: "15.26.
|
|
1004
|
+
readonly version: "15.26.1";
|
|
1002
1005
|
};
|
|
1003
1006
|
readonly rules: {
|
|
1004
1007
|
readonly "no-conditional-empty-object-spread": DocumentedRule<[], "avoid">;
|
package/dist/index.js
CHANGED
|
@@ -45,6 +45,7 @@ ${missing.join("\n")}`);
|
|
|
45
45
|
rationale: spec.rationale,
|
|
46
46
|
remediation: spec.remediation,
|
|
47
47
|
category: spec.category,
|
|
48
|
+
defaultLevel: spec.defaultLevel,
|
|
48
49
|
languages: spec.languages,
|
|
49
50
|
autofix: spec.autofix,
|
|
50
51
|
aliases: spec.aliases,
|
|
@@ -126,6 +127,7 @@ function nativeSpec(config, documentation) {
|
|
|
126
127
|
rationale: documentation.rationale,
|
|
127
128
|
remediation: documentation.remediation,
|
|
128
129
|
category: documentation.category,
|
|
130
|
+
defaultLevel: documentation.defaultLevel ?? "error",
|
|
129
131
|
languages: [...documentation.languages ?? ["typescript"]],
|
|
130
132
|
autofix: documentation.autofix ?? "none",
|
|
131
133
|
aliases,
|
|
@@ -979,6 +981,7 @@ var require_button_accessible_name_default = createRule({
|
|
|
979
981
|
// src/rules/require-camelcase-properties.ts
|
|
980
982
|
import { AST_NODE_TYPES as AST_NODE_TYPES8 } from "@typescript-eslint/utils";
|
|
981
983
|
var REQUIRE_CAMELCASE_PROPERTIES_DOCUMENTATION = {
|
|
984
|
+
defaultLevel: "warning",
|
|
982
985
|
summary: "Require unquoted lower snake_case TypeScript properties and dot access to use camelCase.",
|
|
983
986
|
rationale: "Unquoted snake_case property syntax makes external wire naming indistinguishable from application-domain naming and lets inconsistent contracts spread through typed code.",
|
|
984
987
|
remediation: "Rename application properties to camelCase. At an external wire boundary, make the exception explicit with a quoted key and bracket access.",
|
|
@@ -2309,6 +2312,7 @@ var FILE_SELF_REFERENCE_RE = /\bthis (?:file|module)\b/iu;
|
|
|
2309
2312
|
var CHANGE_HISTORY_RE = /\b(?:used to|previously|histor(?:y|ical)|keep moving|models? (?:move|moved|change|changed)|still under review)\b/iu;
|
|
2310
2313
|
var IMPLEMENTATION_MAP_RE = /\b(?:everything (?:above|below)|nothing else|only thing|write half|maps? between|seam between)\b/iu;
|
|
2311
2314
|
var EXCESSIVE_COMMENTARY_DOCUMENTATION = {
|
|
2315
|
+
defaultLevel: "warning",
|
|
2312
2316
|
summary: "Flag long standalone implementation commentary that should be expressed by code.",
|
|
2313
2317
|
rationale: "Narrative implementation paragraphs compete with the code and can drift independently from behavior.",
|
|
2314
2318
|
remediation: "Delete narration and clarify names, types, or structure; retain only durable constraints and external contracts.",
|
|
@@ -5921,6 +5925,7 @@ import {
|
|
|
5921
5925
|
} from "@typescript-eslint/utils";
|
|
5922
5926
|
import ts5 from "typescript";
|
|
5923
5927
|
var NO_JSON_STRINGIFY_OBJECT_EQUALITY_DOCUMENTATION = {
|
|
5928
|
+
defaultLevel: "warning",
|
|
5924
5929
|
summary: "Do not use JSON serialization as structural object equality.",
|
|
5925
5930
|
rationale: "JSON text equality depends on property insertion order and serialization behavior, so semantically equal objects can compare unequal and distinct values can collapse together.",
|
|
5926
5931
|
remediation: "Compare an explicit domain projection structurally, or use a reviewed canonical serializer when JSON semantics are required.",
|
|
@@ -7191,6 +7196,7 @@ var no_bare_return_from_test_catch_default = createRule({
|
|
|
7191
7196
|
// src/rules/no-bespoke-api-case-conversion.ts
|
|
7192
7197
|
import { AST_NODE_TYPES as AST_NODE_TYPES38, ASTUtils as ASTUtils15 } from "@typescript-eslint/utils";
|
|
7193
7198
|
var NO_BESPOKE_API_CASE_CONVERSION_DOCUMENTATION = {
|
|
7199
|
+
defaultLevel: "warning",
|
|
7194
7200
|
summary: "Review direct snake_case/camelCase mirror mappings on explicitly API-typed adapter values.",
|
|
7195
7201
|
rationale: "Duplicating wire-name translation can drift from an API client contract. When the SDK owns application-facing names, centralizing conversion avoids maintaining another mirror by hand.",
|
|
7196
7202
|
remediation: "Move wire-name ownership and case conversion into the generated SDK/model layer; keep application adapters on the generated typed surface.",
|
|
@@ -8937,6 +8943,7 @@ var WALL_NARRATION_RE2 = /^(?:(?:\d+[.)]|(?:phase|step)\s+\d+\s*:?)\s*)?(?:add|b
|
|
|
8937
8943
|
var WALL_CLUSTER_MAX_LINE_GAP = 8;
|
|
8938
8944
|
var WALL_CLUSTER_MIN_COMMENTS = 3;
|
|
8939
8945
|
var NO_RESTATED_COMMENT_DOCUMENTATION = {
|
|
8946
|
+
defaultLevel: "warning",
|
|
8940
8947
|
summary: "Flag short standalone comments that repeat the adjacent statement's identifiers.",
|
|
8941
8948
|
rationale: "A comment that only repeats code adds no context and can become stale independently.",
|
|
8942
8949
|
remediation: "Remove a genuine restatement; retain conditions, constraints, rationale, and information absent from the statement.",
|
|
@@ -9086,6 +9093,7 @@ function isRestatableLabel(body2) {
|
|
|
9086
9093
|
// src/rules/no-restated-jsdoc.ts
|
|
9087
9094
|
import { AST_NODE_TYPES as AST_NODE_TYPES47 } from "@typescript-eslint/utils";
|
|
9088
9095
|
var NO_RESTATED_JSDOC_DOCUMENTATION = {
|
|
9096
|
+
defaultLevel: "warning",
|
|
9089
9097
|
summary: "Flag JSDoc prose that appears to repeat declaration names without adding behavioral information.",
|
|
9090
9098
|
rationale: "Signature-only JSDoc duplicates type information and drifts without helping callers.",
|
|
9091
9099
|
remediation: "Delete the block or document behavior, constraints, failures, or context the signature cannot express.",
|
|
@@ -13658,6 +13666,7 @@ import {
|
|
|
13658
13666
|
AST_NODE_TYPES as AST_NODE_TYPES68
|
|
13659
13667
|
} from "@typescript-eslint/utils";
|
|
13660
13668
|
var PREFER_MILLISECOND_CONTROL_DURATION_SCHEMA_DOCUMENTATION = {
|
|
13669
|
+
defaultLevel: "warning",
|
|
13661
13670
|
summary: "Require application-owned Zod control-duration fields to use millisecond granularity.",
|
|
13662
13671
|
rationale: "Second-granularity timeout and scheduling controls lose precision and invite implicit unit conversion at API boundaries. Encoding milliseconds in the schema keeps the unit explicit and composes with platform timing APIs.",
|
|
13663
13672
|
remediation: "Rename the field with an `Ms`/`_ms` suffix and express its bounds and default in milliseconds; update the owning API contract rather than converting in application code.",
|
|
@@ -15280,6 +15289,7 @@ var FUNCTION_TYPES9 = /* @__PURE__ */ new Set([
|
|
|
15280
15289
|
AST_NODE_TYPES73.FunctionExpression
|
|
15281
15290
|
]);
|
|
15282
15291
|
var PREFER_MODULE_LEVEL_REFINED_SCHEMA_DOCUMENTATION = {
|
|
15292
|
+
defaultLevel: "warning",
|
|
15283
15293
|
summary: "Declare closed Zod scalar, format, and wrapper schemas at module scope.",
|
|
15284
15294
|
rationale: "A closed validation pipeline created inside a function is rebuilt on every invocation and obscures a reusable constraint.",
|
|
15285
15295
|
remediation: "Move the validation schema to module scope, name it with a PascalCase Schema suffix, and call parse on the shared schema.",
|
|
@@ -15556,6 +15566,7 @@ import {
|
|
|
15556
15566
|
ASTUtils as ASTUtils34
|
|
15557
15567
|
} from "@typescript-eslint/utils";
|
|
15558
15568
|
var PREFER_MULTI_VALUE_ZOD_LITERAL_DOCUMENTATION = {
|
|
15569
|
+
defaultLevel: "warning",
|
|
15559
15570
|
summary: "Use the Zod 4 multi-value literal API instead of a union of literal schemas.",
|
|
15560
15571
|
rationale: "One multi-value literal expresses the same closed value domain without repeated schema wrappers.",
|
|
15561
15572
|
remediation: "Replace the union with z.literal([value1, value2, ...]).",
|
|
@@ -15742,6 +15753,7 @@ var prefer_named_callback_domain_default = createRule({
|
|
|
15742
15753
|
// src/rules/prefer-named-complex-return-type.ts
|
|
15743
15754
|
import { AST_NODE_TYPES as AST_NODE_TYPES76 } from "@typescript-eslint/utils";
|
|
15744
15755
|
var PREFER_NAMED_COMPLEX_RETURN_TYPE_DOCUMENTATION = {
|
|
15756
|
+
defaultLevel: "warning",
|
|
15745
15757
|
summary: "Prefer a named contract for structurally complex function return types.",
|
|
15746
15758
|
rationale: "A large inline return annotation hides a reusable domain concept and makes signatures difficult to scan.",
|
|
15747
15759
|
remediation: "Name the complex nested shape while preserving its generic wrappers and type parameters; reference the named contract from the return annotation.",
|
|
@@ -15902,6 +15914,7 @@ var prefer_native_random_uuid_default = createRule({
|
|
|
15902
15914
|
// src/rules/prefer-node-crypto-hash.ts
|
|
15903
15915
|
import { AST_NODE_TYPES as AST_NODE_TYPES78, ASTUtils as ASTUtils36 } from "@typescript-eslint/utils";
|
|
15904
15916
|
var PREFER_NODE_CRYPTO_HASH_DOCUMENTATION = {
|
|
15917
|
+
defaultLevel: "warning",
|
|
15905
15918
|
summary: "Prefer the modern one-shot node:crypto hash API when streaming state is unnecessary.",
|
|
15906
15919
|
rationale: "A createHash-update-digest chain allocates mutable streaming state for a single in-memory value; Node's built-in hash function expresses the one-shot operation directly and can use its optimized fast path.",
|
|
15907
15920
|
remediation: "On a supported Node runtime, consider hash(algorithm, value, encoding). Preserve the output encoding explicitly: digest() returns a Buffer, while hash defaults to hex. Keep createHash for streams or multiple updates.",
|
|
@@ -16034,6 +16047,7 @@ function isCreateHashCall(node, directBindings, namespaceBindings, resolve2) {
|
|
|
16034
16047
|
// src/rules/prefer-node-fs-promises.ts
|
|
16035
16048
|
import { AST_NODE_TYPES as AST_NODE_TYPES79, ASTUtils as ASTUtils37 } from "@typescript-eslint/utils";
|
|
16036
16049
|
var PREFER_NODE_FS_PROMISES_DOCUMENTATION = {
|
|
16050
|
+
defaultLevel: "warning",
|
|
16037
16051
|
summary: "Prefer promise-based Node.js filesystem APIs over synchronous calls in production modules.",
|
|
16038
16052
|
rationale: "Synchronous filesystem work blocks the event loop and can stall unrelated daemon, server, and worker tasks.",
|
|
16039
16053
|
remediation: "Import the promise API from node:fs/promises and await it; use FileHandle.sync only where a documented durability boundary requires it.",
|
|
@@ -17308,6 +17322,7 @@ function ifGuardDominates(use, branch, positive) {
|
|
|
17308
17322
|
// src/rules/prefer-shared-zod-enum.ts
|
|
17309
17323
|
import { AST_NODE_TYPES as AST_NODE_TYPES84, ASTUtils as ASTUtils42 } from "@typescript-eslint/utils";
|
|
17310
17324
|
var PREFER_SHARED_ZOD_ENUM_DOCUMENTATION = {
|
|
17325
|
+
defaultLevel: "warning",
|
|
17311
17326
|
summary: "Give repeated literal Zod enum domains one reusable module-level schema.",
|
|
17312
17327
|
rationale: "Repeated literal domains hide a shared contract and allow equivalent fields to drift independently.",
|
|
17313
17328
|
remediation: "Declare a module-level named Zod enum schema and reuse it at each field or contract site.",
|
|
@@ -17395,6 +17410,7 @@ var prefer_shared_zod_enum_default = createRule({
|
|
|
17395
17410
|
// src/rules/prefer-switch-for-repeated-equality.ts
|
|
17396
17411
|
import { AST_NODE_TYPES as AST_NODE_TYPES85 } from "@typescript-eslint/utils";
|
|
17397
17412
|
var PREFER_SWITCH_FOR_REPEATED_EQUALITY_DOCUMENTATION = {
|
|
17413
|
+
defaultLevel: "warning",
|
|
17398
17414
|
summary: "Prefer switch over long if/else-if chains that compare one value for strict equality.",
|
|
17399
17415
|
rationale: "A switch makes finite dispatch cases visually uniform and easier to extend without duplicating the discriminant.",
|
|
17400
17416
|
remediation: "Replace three or more strict-equality branches over the same discriminant with a switch; keep if statements for ranges, guards, and heterogeneous predicates.",
|
|
@@ -18253,6 +18269,7 @@ var LITERAL_KEY_HAZARDS = /* @__PURE__ */ new Set(["__proto__"]);
|
|
|
18253
18269
|
var NUMERIC_SIGNS2 = /* @__PURE__ */ new Set(["-", "+"]);
|
|
18254
18270
|
var MIN_RUN_LENGTH = 2;
|
|
18255
18271
|
var PREFER_WHOLE_OBJECT_ASSERTION_DOCUMENTATION = {
|
|
18272
|
+
defaultLevel: "warning",
|
|
18256
18273
|
summary: "Collapse consecutive assertions on one object into a whole-object assertion so related mismatches are reported together.",
|
|
18257
18274
|
rationale: "One whole-object assertion presents related expectations together and produces a complete structural diff.",
|
|
18258
18275
|
remediation: "Consider one `toMatchObject` assertion for ordinary data objects. Preserve missing-property checks, identity, and getter or proxy behavior when deciding whether to combine assertions.",
|
|
@@ -20086,6 +20103,7 @@ var require_fetch_timeout_default = createRule({
|
|
|
20086
20103
|
// src/rules/require-interface-for-exported-class.ts
|
|
20087
20104
|
import { AST_NODE_TYPES as AST_NODE_TYPES93 } from "@typescript-eslint/utils";
|
|
20088
20105
|
var REQUIRE_INTERFACE_FOR_EXPORTED_CLASS_DOCUMENTATION = {
|
|
20106
|
+
defaultLevel: "warning",
|
|
20089
20107
|
summary: "Require exported concrete classes with public behavior to declare a contract.",
|
|
20090
20108
|
rationale: "An explicit contract names the intended public capability separately from implementation details. TypeScript already supports structural compatibility; this is an architecture policy, not a prerequisite for substitution.",
|
|
20091
20109
|
remediation: "Declare a focused interface and add an implements clause, or inherit from an intentional base contract.",
|
|
@@ -20865,6 +20883,7 @@ var MODEL_EXECUTION_METHODS = /* @__PURE__ */ new Set([
|
|
|
20865
20883
|
]);
|
|
20866
20884
|
var DATABASE_NAMES = /^(?:db|database|connection|pool|prisma|query|transaction|tx)$/iu;
|
|
20867
20885
|
var REQUIRE_SQL_ACCESS_CLASS_DOCUMENTATION = {
|
|
20886
|
+
defaultLevel: "warning",
|
|
20868
20887
|
summary: "Keep SQL reads and writes inside a class that receives its database dependency.",
|
|
20869
20888
|
rationale: "An injected repository class is the preferred ownership boundary for database access under this architectural policy; free functions can also express explicit dependencies.",
|
|
20870
20889
|
remediation: "Move the query into a repository or store class and inject the pool, connection, transaction, or typed database binding through its constructor.",
|
|
@@ -22583,6 +22602,7 @@ function importedAssertionKind(specifier) {
|
|
|
22583
22602
|
// src/rules/sole-export-matches-filename.ts
|
|
22584
22603
|
import { AST_NODE_TYPES as AST_NODE_TYPES101 } from "@typescript-eslint/utils";
|
|
22585
22604
|
var SOLE_EXPORT_MATCHES_FILENAME_DOCUMENTATION = {
|
|
22605
|
+
defaultLevel: "warning",
|
|
22586
22606
|
summary: "Make a module filename reflect its sole named public runtime export.",
|
|
22587
22607
|
rationale: "When a module owns one runtime responsibility, matching names make that responsibility directly discoverable.",
|
|
22588
22608
|
remediation: "Name the module for the exported responsibility, using either the full export name or a clear leading or trailing domain phrase; otherwise colocate genuinely related exports.",
|
|
@@ -23253,7 +23273,7 @@ var RULES = {
|
|
|
23253
23273
|
};
|
|
23254
23274
|
var meta = {
|
|
23255
23275
|
name: "@sarj/eslint-plugin",
|
|
23256
|
-
version: "15.26.
|
|
23276
|
+
version: "15.26.1"
|
|
23257
23277
|
};
|
|
23258
23278
|
var APPLICATION_ONLY_RULES = [];
|
|
23259
23279
|
var LIBRARY_IMPORT_POLICY = ["error", {
|