@sarj/eslint-plugin 16.31.0 → 16.32.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/{_docs-DU-K223M.d.cts → _docs-Bq5OCcWF.d.cts} +4 -4
- package/dist/{_docs-DU-K223M.d.ts → _docs-Bq5OCcWF.d.ts} +4 -4
- package/dist/index.cjs +22 -22
- package/dist/index.d.cts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +22 -22
- package/package.json +1 -1
|
@@ -14,8 +14,8 @@ interface ExampleFile {
|
|
|
14
14
|
readonly source: string;
|
|
15
15
|
}
|
|
16
16
|
/** A reviewed example. It remains private unless `public: true` is explicit. */
|
|
17
|
-
interface RuleExample {
|
|
18
|
-
readonly ruleOptions?:
|
|
17
|
+
interface RuleExample<Options extends readonly unknown[] = readonly unknown[]> {
|
|
18
|
+
readonly ruleOptions?: Readonly<Options>;
|
|
19
19
|
readonly installedDependencies?: readonly {
|
|
20
20
|
readonly module: string;
|
|
21
21
|
readonly version: string;
|
|
@@ -31,7 +31,7 @@ interface RuleExample {
|
|
|
31
31
|
readonly fixedFiles?: readonly ExampleFile[];
|
|
32
32
|
}
|
|
33
33
|
/** Human-authored fields that cannot be derived from the ESLint rule module. */
|
|
34
|
-
interface RuleDocumentation {
|
|
34
|
+
interface RuleDocumentation<Options extends readonly unknown[] = readonly unknown[]> {
|
|
35
35
|
readonly summary: string;
|
|
36
36
|
readonly rationale: string;
|
|
37
37
|
readonly remediation: string;
|
|
@@ -44,7 +44,7 @@ interface RuleDocumentation {
|
|
|
44
44
|
readonly filePatterns?: readonly string[];
|
|
45
45
|
readonly references?: readonly string[];
|
|
46
46
|
readonly since?: string;
|
|
47
|
-
readonly examples?: readonly RuleExample[];
|
|
47
|
+
readonly examples?: readonly RuleExample<Options>[];
|
|
48
48
|
}
|
|
49
49
|
/** Complete native record exposed to catalog generation without changing ESLint metadata. */
|
|
50
50
|
interface NativeRuleSpec extends Required<Omit<RuleDocumentation, "since">> {
|
|
@@ -14,8 +14,8 @@ interface ExampleFile {
|
|
|
14
14
|
readonly source: string;
|
|
15
15
|
}
|
|
16
16
|
/** A reviewed example. It remains private unless `public: true` is explicit. */
|
|
17
|
-
interface RuleExample {
|
|
18
|
-
readonly ruleOptions?:
|
|
17
|
+
interface RuleExample<Options extends readonly unknown[] = readonly unknown[]> {
|
|
18
|
+
readonly ruleOptions?: Readonly<Options>;
|
|
19
19
|
readonly installedDependencies?: readonly {
|
|
20
20
|
readonly module: string;
|
|
21
21
|
readonly version: string;
|
|
@@ -31,7 +31,7 @@ interface RuleExample {
|
|
|
31
31
|
readonly fixedFiles?: readonly ExampleFile[];
|
|
32
32
|
}
|
|
33
33
|
/** Human-authored fields that cannot be derived from the ESLint rule module. */
|
|
34
|
-
interface RuleDocumentation {
|
|
34
|
+
interface RuleDocumentation<Options extends readonly unknown[] = readonly unknown[]> {
|
|
35
35
|
readonly summary: string;
|
|
36
36
|
readonly rationale: string;
|
|
37
37
|
readonly remediation: string;
|
|
@@ -44,7 +44,7 @@ interface RuleDocumentation {
|
|
|
44
44
|
readonly filePatterns?: readonly string[];
|
|
45
45
|
readonly references?: readonly string[];
|
|
46
46
|
readonly since?: string;
|
|
47
|
-
readonly examples?: readonly RuleExample[];
|
|
47
|
+
readonly examples?: readonly RuleExample<Options>[];
|
|
48
48
|
}
|
|
49
49
|
/** Complete native record exposed to catalog generation without changing ESLint metadata. */
|
|
50
50
|
interface NativeRuleSpec extends Required<Omit<RuleDocumentation, "since">> {
|
package/dist/index.cjs
CHANGED
|
@@ -1580,7 +1580,7 @@ function isSearchParamReceiver(call, services) {
|
|
|
1580
1580
|
// package.json
|
|
1581
1581
|
var package_default = {
|
|
1582
1582
|
name: "@sarj/eslint-plugin",
|
|
1583
|
-
version: "16.
|
|
1583
|
+
version: "16.32.1",
|
|
1584
1584
|
packageManager: "npm@12.2.1",
|
|
1585
1585
|
description: "Custom ESLint rules for hypermodern TypeScript / React / Next.js projects",
|
|
1586
1586
|
type: "module",
|
|
@@ -1791,6 +1791,7 @@ function exactConstruction(node, consumer, implementation) {
|
|
|
1791
1791
|
|
|
1792
1792
|
// src/rules/require-explicit-contract-implementation.ts
|
|
1793
1793
|
var ESCAPED_CLASSES = /* @__PURE__ */ new WeakMap();
|
|
1794
|
+
var PROTOTYPE_MUTATIONS = /* @__PURE__ */ new WeakMap();
|
|
1794
1795
|
var REQUIRE_EXPLICIT_CONTRACT_IMPLEMENTATION_DOCUMENTATION = {
|
|
1795
1796
|
defaultLevel: "error",
|
|
1796
1797
|
summary: "Require nominal inheritance when an injected abstract class is rejected by an instanceof guard.",
|
|
@@ -1855,6 +1856,8 @@ var REQUIRE_EXPLICIT_CONTRACT_IMPLEMENTATION_DOCUMENTATION = {
|
|
|
1855
1856
|
]
|
|
1856
1857
|
};
|
|
1857
1858
|
function hasPrototypeMutation(source) {
|
|
1859
|
+
const cached = PROTOTYPE_MUTATIONS.get(source);
|
|
1860
|
+
if (cached !== void 0) return cached;
|
|
1858
1861
|
function visit(node) {
|
|
1859
1862
|
const member3 = memberName(node);
|
|
1860
1863
|
if (member3 === "setPrototypeOf" || member3 === "__proto__" || member3 === "hasInstance")
|
|
@@ -1863,7 +1866,9 @@ function hasPrototypeMutation(source) {
|
|
|
1863
1866
|
return true;
|
|
1864
1867
|
return ts9.forEachChild(node, visit);
|
|
1865
1868
|
}
|
|
1866
|
-
|
|
1869
|
+
const mutated = visit(source) === true;
|
|
1870
|
+
PROTOTYPE_MUTATIONS.set(source, mutated);
|
|
1871
|
+
return mutated;
|
|
1867
1872
|
}
|
|
1868
1873
|
function memberName(node) {
|
|
1869
1874
|
if (ts9.isPropertyAccessExpression(node)) return node.name.text;
|
|
@@ -4088,7 +4093,7 @@ var NO_INVALID_TYPED_MUTATION_DOCUMENTATION = {
|
|
|
4088
4093
|
rationale: "Object.assign, Reflect.set and property descriptors accept values that a normal typed property assignment rejects. They can invalidate a domain object's contract while subsequent reads retain its original type.",
|
|
4089
4094
|
remediation: "Use an assignment that satisfies the declared property type, or construct and validate a complete replacement. Preserve any deliberate construction or external compatibility contract; do not cast away the incompatibility.",
|
|
4090
4095
|
category: "correctness",
|
|
4091
|
-
defaultLevel: "
|
|
4096
|
+
defaultLevel: "error",
|
|
4092
4097
|
autofix: "none",
|
|
4093
4098
|
limitations: [
|
|
4094
4099
|
"Requires type information and an explicitly annotated local const initialized with a plain own-data object literal. Only non-exported, stable bindings without escapes or nested captures qualify. Deletes and descriptors that can lock writability or configurability invalidate storage provenance. The closed non-union contract must declare the initialized data property; parameters, opaque constructors/factories, accessor, method, indexed, callable and unresolved generic targets are excluded.",
|
|
@@ -4482,7 +4487,7 @@ var NO_CONTRADICTORY_TYPE_PREDICATE_DOCUMENTATION = {
|
|
|
4482
4487
|
rationale: "TypeScript trusts an explicit type predicate without verifying its implementation. A contradictory check can admit the wrong primitive, overclaim a closed literal or empty domain, accept null as a non-null object, or remove valid alternatives from the false branch.",
|
|
4483
4488
|
remediation: "Match the predicate to every value the check accepts and rejects. Check literal membership for a closed domain and exclude null when promising a non-null object. Use a boolean return for an intentional value filter; preserve required public and callback contracts.",
|
|
4484
4489
|
category: "correctness",
|
|
4485
|
-
defaultLevel: "
|
|
4490
|
+
defaultLevel: "error",
|
|
4486
4491
|
autofix: "safe",
|
|
4487
4492
|
limitations: [
|
|
4488
4493
|
"Automatic fixes replace the unsound predicate with boolean only for an unused private function declaration without overloads, exports, eval, comments in the predicate, or declaration-file ownership. Runtime checks are preserved; observed callable contracts remain manual.",
|
|
@@ -4804,7 +4809,7 @@ var NO_PARTIAL_TYPE_PREDICATE_DOCUMENTATION = {
|
|
|
4804
4809
|
rationale: "Type predicates narrow both branches, and TypeScript trusts their implementation. A positive-number or non-empty-string predicate can return false for a value belonging to its promised type, causing callers to treat that value as a different type.",
|
|
4805
4810
|
remediation: "Use a boolean return for an intentional value filter, or recognize every member of the promised type. Preserve required callback and public contracts; a refined domain may need a distinct validated type. Recheck false-branch callers when changing a predicate.",
|
|
4806
4811
|
category: "correctness",
|
|
4807
|
-
defaultLevel: "
|
|
4812
|
+
defaultLevel: "error",
|
|
4808
4813
|
autofix: "safe",
|
|
4809
4814
|
limitations: [
|
|
4810
4815
|
"Automatic fixes replace the unsound predicate with boolean only for an unused private function declaration without overloads, exports, eval, comments in the predicate, or declaration-file ownership. Runtime checks are preserved; observed callable contracts remain manual.",
|
|
@@ -5490,7 +5495,7 @@ var NO_INVALID_ZOD_CUSTOM_PARSE_DOCUMENTATION = {
|
|
|
5490
5495
|
rationale: "Without a validator, z.custom<T>() returns its input unchanged while promising T. A parsed primitive outside that value domain fabricates a contract the caller may trust.",
|
|
5491
5496
|
remediation: "Provide actual validation, use the appropriate primitive schema, or retain an honest unknown result until validation. Preserve composed validators and independently owned domain contracts.",
|
|
5492
5497
|
category: "correctness",
|
|
5493
|
-
defaultLevel: "
|
|
5498
|
+
defaultLevel: "error",
|
|
5494
5499
|
autofix: "none",
|
|
5495
5500
|
limitations: [
|
|
5496
5501
|
"Requires type information and a direct inline z.custom<T>().parse(primitiveLiteral) call with no custom validator or parse options. Recognizes runtime imports from zod or zod/v4 and native installed Zod v4 declarations; schema bindings, compositions, safeParse, dynamic inputs and indirect calls are excluded.",
|
|
@@ -5606,7 +5611,7 @@ var NO_CONTRADICTORY_OVERLOAD_RETURN_DOCUMENTATION = {
|
|
|
5606
5611
|
rationale: "TypeScript checks an overload implementation against an overall envelope, without proving each input/result relationship. A function can compile while returning the opposite domain variant for every advertised literal input.",
|
|
5607
5612
|
remediation: "Return the variant promised for each input. Prefer a checked case map or separate variant-specific operations when that makes the relationship explicit; retain overloads required by public APIs.",
|
|
5608
5613
|
category: "correctness",
|
|
5609
|
-
defaultLevel: "
|
|
5614
|
+
defaultLevel: "error",
|
|
5610
5615
|
autofix: "safe",
|
|
5611
5616
|
limitations: [
|
|
5612
5617
|
"Automatic fixes align only an unused private complete same-file overload group with its existing literal implementation results. Binding aliases, exports, merges, eval, declaration files, comments, nonliteral result syntax and observed callers preserve manual ownership; runtime checks and returned values never change.",
|
|
@@ -33886,16 +33891,11 @@ var ADVISORY_RULES = [
|
|
|
33886
33891
|
"@sarj/excessive-commentary",
|
|
33887
33892
|
"@sarj/no-bespoke-api-case-conversion",
|
|
33888
33893
|
"@sarj/no-boolean-selector-parameter",
|
|
33889
|
-
"@sarj/no-contradictory-overload-return",
|
|
33890
|
-
"@sarj/no-contradictory-type-predicate",
|
|
33891
33894
|
"@sarj/no-cors-wildcard-with-credentials",
|
|
33892
33895
|
"@sarj/no-credential-in-browser-storage",
|
|
33893
33896
|
"@sarj/no-exception-text-in-5xx-response",
|
|
33894
33897
|
"@sarj/no-excess-jsx-props",
|
|
33895
|
-
"@sarj/no-invalid-typed-mutation",
|
|
33896
|
-
"@sarj/no-invalid-zod-custom-parse",
|
|
33897
33898
|
"@sarj/no-numeric-search-param-coercion",
|
|
33898
|
-
"@sarj/no-partial-type-predicate",
|
|
33899
33899
|
"@sarj/no-redundant-consumer-union",
|
|
33900
33900
|
"@sarj/no-restated-comment",
|
|
33901
33901
|
"@sarj/no-restated-jsdoc",
|
|
@@ -33921,12 +33921,12 @@ var RECOMMENDED_RULES = {
|
|
|
33921
33921
|
"@sarj/no-broad-return-type": "error",
|
|
33922
33922
|
"@sarj/no-reduce-accumulator-copy": "error",
|
|
33923
33923
|
"@sarj/no-known-value-widening": "error",
|
|
33924
|
-
"@sarj/no-invalid-typed-mutation": "
|
|
33925
|
-
"@sarj/no-contradictory-type-predicate": "
|
|
33926
|
-
"@sarj/no-partial-type-predicate": "
|
|
33924
|
+
"@sarj/no-invalid-typed-mutation": "error",
|
|
33925
|
+
"@sarj/no-contradictory-type-predicate": "error",
|
|
33926
|
+
"@sarj/no-partial-type-predicate": "error",
|
|
33927
33927
|
"@sarj/no-boolean-selector-parameter": "warn",
|
|
33928
|
-
"@sarj/no-invalid-zod-custom-parse": "
|
|
33929
|
-
"@sarj/no-contradictory-overload-return": "
|
|
33928
|
+
"@sarj/no-invalid-zod-custom-parse": "error",
|
|
33929
|
+
"@sarj/no-contradictory-overload-return": "error",
|
|
33930
33930
|
"@sarj/require-button-accessible-name": "error",
|
|
33931
33931
|
"@sarj/require-camelcase-properties": "error",
|
|
33932
33932
|
"@sarj/require-svg-accessible-name": "error",
|
|
@@ -34052,12 +34052,12 @@ var STRICT_RULES = {
|
|
|
34052
34052
|
"@sarj/no-broad-return-type": "error",
|
|
34053
34053
|
"@sarj/no-reduce-accumulator-copy": "error",
|
|
34054
34054
|
"@sarj/no-known-value-widening": "error",
|
|
34055
|
-
"@sarj/no-invalid-typed-mutation": "
|
|
34056
|
-
"@sarj/no-contradictory-type-predicate": "
|
|
34057
|
-
"@sarj/no-partial-type-predicate": "
|
|
34055
|
+
"@sarj/no-invalid-typed-mutation": "error",
|
|
34056
|
+
"@sarj/no-contradictory-type-predicate": "error",
|
|
34057
|
+
"@sarj/no-partial-type-predicate": "error",
|
|
34058
34058
|
"@sarj/no-boolean-selector-parameter": "warn",
|
|
34059
|
-
"@sarj/no-invalid-zod-custom-parse": "
|
|
34060
|
-
"@sarj/no-contradictory-overload-return": "
|
|
34059
|
+
"@sarj/no-invalid-zod-custom-parse": "error",
|
|
34060
|
+
"@sarj/no-contradictory-overload-return": "error",
|
|
34061
34061
|
"@sarj/require-button-accessible-name": "error",
|
|
34062
34062
|
"@sarj/require-camelcase-properties": "error",
|
|
34063
34063
|
"@sarj/require-svg-accessible-name": "error",
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DocumentedRule } from './_docs-
|
|
2
|
-
export { p as publicDocumentation } from './_docs-
|
|
1
|
+
import { D as DocumentedRule } from './_docs-Bq5OCcWF.cjs';
|
|
2
|
+
export { p as publicDocumentation } from './_docs-Bq5OCcWF.cjs';
|
|
3
3
|
import '@typescript-eslint/utils';
|
|
4
4
|
|
|
5
5
|
/** @fileoverview _retired-rules — burned rule names and their migration action. */
|
|
@@ -308,7 +308,7 @@ declare const RULES: {
|
|
|
308
308
|
/** @deprecated All repositories use one policy; retained for import compatibility. */
|
|
309
309
|
declare const APPLICATION_ONLY_RULES: readonly [];
|
|
310
310
|
/** Rules staged as non-blocking warnings while corpus adoption evidence accumulates. */
|
|
311
|
-
declare const ADVISORY_RULES: readonly ["@sarj/excessive-commentary", "@sarj/no-bespoke-api-case-conversion", "@sarj/no-boolean-selector-parameter", "@sarj/no-
|
|
311
|
+
declare const ADVISORY_RULES: readonly ["@sarj/excessive-commentary", "@sarj/no-bespoke-api-case-conversion", "@sarj/no-boolean-selector-parameter", "@sarj/no-cors-wildcard-with-credentials", "@sarj/no-credential-in-browser-storage", "@sarj/no-exception-text-in-5xx-response", "@sarj/no-excess-jsx-props", "@sarj/no-numeric-search-param-coercion", "@sarj/no-redundant-consumer-union", "@sarj/no-restated-comment", "@sarj/no-restated-jsdoc", "@sarj/prefer-discriminated-union", "@sarj/prefer-millisecond-control-duration-schema", "@sarj/prefer-minimal-parameter-contract", "@sarj/prefer-module-level-refined-schema", "@sarj/prefer-native-fetch-in-server-actions", "@sarj/prefer-node-crypto-hash", "@sarj/prefer-node-fs-promises", "@sarj/prefer-shared-zod-enum", "@sarj/prefer-whole-object-assertion", "@sarj/prefer-zod-parse-output-type", "@sarj/require-sql-access-class"];
|
|
312
312
|
declare const RECOMMENDED_RULES: {
|
|
313
313
|
readonly "@sarj/no-excess-jsx-props": "warn";
|
|
314
314
|
readonly "@sarj/no-redundant-consumer-union": "warn";
|
|
@@ -319,12 +319,12 @@ declare const RECOMMENDED_RULES: {
|
|
|
319
319
|
readonly "@sarj/no-broad-return-type": "error";
|
|
320
320
|
readonly "@sarj/no-reduce-accumulator-copy": "error";
|
|
321
321
|
readonly "@sarj/no-known-value-widening": "error";
|
|
322
|
-
readonly "@sarj/no-invalid-typed-mutation": "
|
|
323
|
-
readonly "@sarj/no-contradictory-type-predicate": "
|
|
324
|
-
readonly "@sarj/no-partial-type-predicate": "
|
|
322
|
+
readonly "@sarj/no-invalid-typed-mutation": "error";
|
|
323
|
+
readonly "@sarj/no-contradictory-type-predicate": "error";
|
|
324
|
+
readonly "@sarj/no-partial-type-predicate": "error";
|
|
325
325
|
readonly "@sarj/no-boolean-selector-parameter": "warn";
|
|
326
|
-
readonly "@sarj/no-invalid-zod-custom-parse": "
|
|
327
|
-
readonly "@sarj/no-contradictory-overload-return": "
|
|
326
|
+
readonly "@sarj/no-invalid-zod-custom-parse": "error";
|
|
327
|
+
readonly "@sarj/no-contradictory-overload-return": "error";
|
|
328
328
|
readonly "@sarj/require-button-accessible-name": "error";
|
|
329
329
|
readonly "@sarj/require-camelcase-properties": "error";
|
|
330
330
|
readonly "@sarj/require-svg-accessible-name": "error";
|
|
@@ -645,12 +645,12 @@ declare const STRICT_RULES: {
|
|
|
645
645
|
readonly "@sarj/no-broad-return-type": "error";
|
|
646
646
|
readonly "@sarj/no-reduce-accumulator-copy": "error";
|
|
647
647
|
readonly "@sarj/no-known-value-widening": "error";
|
|
648
|
-
readonly "@sarj/no-invalid-typed-mutation": "
|
|
649
|
-
readonly "@sarj/no-contradictory-type-predicate": "
|
|
650
|
-
readonly "@sarj/no-partial-type-predicate": "
|
|
648
|
+
readonly "@sarj/no-invalid-typed-mutation": "error";
|
|
649
|
+
readonly "@sarj/no-contradictory-type-predicate": "error";
|
|
650
|
+
readonly "@sarj/no-partial-type-predicate": "error";
|
|
651
651
|
readonly "@sarj/no-boolean-selector-parameter": "warn";
|
|
652
|
-
readonly "@sarj/no-invalid-zod-custom-parse": "
|
|
653
|
-
readonly "@sarj/no-contradictory-overload-return": "
|
|
652
|
+
readonly "@sarj/no-invalid-zod-custom-parse": "error";
|
|
653
|
+
readonly "@sarj/no-contradictory-overload-return": "error";
|
|
654
654
|
readonly "@sarj/require-button-accessible-name": "error";
|
|
655
655
|
readonly "@sarj/require-camelcase-properties": "error";
|
|
656
656
|
readonly "@sarj/require-svg-accessible-name": "error";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DocumentedRule } from './_docs-
|
|
2
|
-
export { p as publicDocumentation } from './_docs-
|
|
1
|
+
import { D as DocumentedRule } from './_docs-Bq5OCcWF.js';
|
|
2
|
+
export { p as publicDocumentation } from './_docs-Bq5OCcWF.js';
|
|
3
3
|
import '@typescript-eslint/utils';
|
|
4
4
|
|
|
5
5
|
/** @fileoverview _retired-rules — burned rule names and their migration action. */
|
|
@@ -308,7 +308,7 @@ declare const RULES: {
|
|
|
308
308
|
/** @deprecated All repositories use one policy; retained for import compatibility. */
|
|
309
309
|
declare const APPLICATION_ONLY_RULES: readonly [];
|
|
310
310
|
/** Rules staged as non-blocking warnings while corpus adoption evidence accumulates. */
|
|
311
|
-
declare const ADVISORY_RULES: readonly ["@sarj/excessive-commentary", "@sarj/no-bespoke-api-case-conversion", "@sarj/no-boolean-selector-parameter", "@sarj/no-
|
|
311
|
+
declare const ADVISORY_RULES: readonly ["@sarj/excessive-commentary", "@sarj/no-bespoke-api-case-conversion", "@sarj/no-boolean-selector-parameter", "@sarj/no-cors-wildcard-with-credentials", "@sarj/no-credential-in-browser-storage", "@sarj/no-exception-text-in-5xx-response", "@sarj/no-excess-jsx-props", "@sarj/no-numeric-search-param-coercion", "@sarj/no-redundant-consumer-union", "@sarj/no-restated-comment", "@sarj/no-restated-jsdoc", "@sarj/prefer-discriminated-union", "@sarj/prefer-millisecond-control-duration-schema", "@sarj/prefer-minimal-parameter-contract", "@sarj/prefer-module-level-refined-schema", "@sarj/prefer-native-fetch-in-server-actions", "@sarj/prefer-node-crypto-hash", "@sarj/prefer-node-fs-promises", "@sarj/prefer-shared-zod-enum", "@sarj/prefer-whole-object-assertion", "@sarj/prefer-zod-parse-output-type", "@sarj/require-sql-access-class"];
|
|
312
312
|
declare const RECOMMENDED_RULES: {
|
|
313
313
|
readonly "@sarj/no-excess-jsx-props": "warn";
|
|
314
314
|
readonly "@sarj/no-redundant-consumer-union": "warn";
|
|
@@ -319,12 +319,12 @@ declare const RECOMMENDED_RULES: {
|
|
|
319
319
|
readonly "@sarj/no-broad-return-type": "error";
|
|
320
320
|
readonly "@sarj/no-reduce-accumulator-copy": "error";
|
|
321
321
|
readonly "@sarj/no-known-value-widening": "error";
|
|
322
|
-
readonly "@sarj/no-invalid-typed-mutation": "
|
|
323
|
-
readonly "@sarj/no-contradictory-type-predicate": "
|
|
324
|
-
readonly "@sarj/no-partial-type-predicate": "
|
|
322
|
+
readonly "@sarj/no-invalid-typed-mutation": "error";
|
|
323
|
+
readonly "@sarj/no-contradictory-type-predicate": "error";
|
|
324
|
+
readonly "@sarj/no-partial-type-predicate": "error";
|
|
325
325
|
readonly "@sarj/no-boolean-selector-parameter": "warn";
|
|
326
|
-
readonly "@sarj/no-invalid-zod-custom-parse": "
|
|
327
|
-
readonly "@sarj/no-contradictory-overload-return": "
|
|
326
|
+
readonly "@sarj/no-invalid-zod-custom-parse": "error";
|
|
327
|
+
readonly "@sarj/no-contradictory-overload-return": "error";
|
|
328
328
|
readonly "@sarj/require-button-accessible-name": "error";
|
|
329
329
|
readonly "@sarj/require-camelcase-properties": "error";
|
|
330
330
|
readonly "@sarj/require-svg-accessible-name": "error";
|
|
@@ -645,12 +645,12 @@ declare const STRICT_RULES: {
|
|
|
645
645
|
readonly "@sarj/no-broad-return-type": "error";
|
|
646
646
|
readonly "@sarj/no-reduce-accumulator-copy": "error";
|
|
647
647
|
readonly "@sarj/no-known-value-widening": "error";
|
|
648
|
-
readonly "@sarj/no-invalid-typed-mutation": "
|
|
649
|
-
readonly "@sarj/no-contradictory-type-predicate": "
|
|
650
|
-
readonly "@sarj/no-partial-type-predicate": "
|
|
648
|
+
readonly "@sarj/no-invalid-typed-mutation": "error";
|
|
649
|
+
readonly "@sarj/no-contradictory-type-predicate": "error";
|
|
650
|
+
readonly "@sarj/no-partial-type-predicate": "error";
|
|
651
651
|
readonly "@sarj/no-boolean-selector-parameter": "warn";
|
|
652
|
-
readonly "@sarj/no-invalid-zod-custom-parse": "
|
|
653
|
-
readonly "@sarj/no-contradictory-overload-return": "
|
|
652
|
+
readonly "@sarj/no-invalid-zod-custom-parse": "error";
|
|
653
|
+
readonly "@sarj/no-contradictory-overload-return": "error";
|
|
654
654
|
readonly "@sarj/require-button-accessible-name": "error";
|
|
655
655
|
readonly "@sarj/require-camelcase-properties": "error";
|
|
656
656
|
readonly "@sarj/require-svg-accessible-name": "error";
|
package/dist/index.js
CHANGED
|
@@ -1533,7 +1533,7 @@ function isSearchParamReceiver(call, services) {
|
|
|
1533
1533
|
// package.json
|
|
1534
1534
|
var package_default = {
|
|
1535
1535
|
name: "@sarj/eslint-plugin",
|
|
1536
|
-
version: "16.
|
|
1536
|
+
version: "16.32.1",
|
|
1537
1537
|
packageManager: "npm@12.2.1",
|
|
1538
1538
|
description: "Custom ESLint rules for hypermodern TypeScript / React / Next.js projects",
|
|
1539
1539
|
type: "module",
|
|
@@ -1750,6 +1750,7 @@ function exactConstruction(node, consumer, implementation) {
|
|
|
1750
1750
|
|
|
1751
1751
|
// src/rules/require-explicit-contract-implementation.ts
|
|
1752
1752
|
var ESCAPED_CLASSES = /* @__PURE__ */ new WeakMap();
|
|
1753
|
+
var PROTOTYPE_MUTATIONS = /* @__PURE__ */ new WeakMap();
|
|
1753
1754
|
var REQUIRE_EXPLICIT_CONTRACT_IMPLEMENTATION_DOCUMENTATION = {
|
|
1754
1755
|
defaultLevel: "error",
|
|
1755
1756
|
summary: "Require nominal inheritance when an injected abstract class is rejected by an instanceof guard.",
|
|
@@ -1814,6 +1815,8 @@ var REQUIRE_EXPLICIT_CONTRACT_IMPLEMENTATION_DOCUMENTATION = {
|
|
|
1814
1815
|
]
|
|
1815
1816
|
};
|
|
1816
1817
|
function hasPrototypeMutation(source) {
|
|
1818
|
+
const cached = PROTOTYPE_MUTATIONS.get(source);
|
|
1819
|
+
if (cached !== void 0) return cached;
|
|
1817
1820
|
function visit(node) {
|
|
1818
1821
|
const member3 = memberName(node);
|
|
1819
1822
|
if (member3 === "setPrototypeOf" || member3 === "__proto__" || member3 === "hasInstance")
|
|
@@ -1822,7 +1825,9 @@ function hasPrototypeMutation(source) {
|
|
|
1822
1825
|
return true;
|
|
1823
1826
|
return ts9.forEachChild(node, visit);
|
|
1824
1827
|
}
|
|
1825
|
-
|
|
1828
|
+
const mutated = visit(source) === true;
|
|
1829
|
+
PROTOTYPE_MUTATIONS.set(source, mutated);
|
|
1830
|
+
return mutated;
|
|
1826
1831
|
}
|
|
1827
1832
|
function memberName(node) {
|
|
1828
1833
|
if (ts9.isPropertyAccessExpression(node)) return node.name.text;
|
|
@@ -4067,7 +4072,7 @@ var NO_INVALID_TYPED_MUTATION_DOCUMENTATION = {
|
|
|
4067
4072
|
rationale: "Object.assign, Reflect.set and property descriptors accept values that a normal typed property assignment rejects. They can invalidate a domain object's contract while subsequent reads retain its original type.",
|
|
4068
4073
|
remediation: "Use an assignment that satisfies the declared property type, or construct and validate a complete replacement. Preserve any deliberate construction or external compatibility contract; do not cast away the incompatibility.",
|
|
4069
4074
|
category: "correctness",
|
|
4070
|
-
defaultLevel: "
|
|
4075
|
+
defaultLevel: "error",
|
|
4071
4076
|
autofix: "none",
|
|
4072
4077
|
limitations: [
|
|
4073
4078
|
"Requires type information and an explicitly annotated local const initialized with a plain own-data object literal. Only non-exported, stable bindings without escapes or nested captures qualify. Deletes and descriptors that can lock writability or configurability invalidate storage provenance. The closed non-union contract must declare the initialized data property; parameters, opaque constructors/factories, accessor, method, indexed, callable and unresolved generic targets are excluded.",
|
|
@@ -4461,7 +4466,7 @@ var NO_CONTRADICTORY_TYPE_PREDICATE_DOCUMENTATION = {
|
|
|
4461
4466
|
rationale: "TypeScript trusts an explicit type predicate without verifying its implementation. A contradictory check can admit the wrong primitive, overclaim a closed literal or empty domain, accept null as a non-null object, or remove valid alternatives from the false branch.",
|
|
4462
4467
|
remediation: "Match the predicate to every value the check accepts and rejects. Check literal membership for a closed domain and exclude null when promising a non-null object. Use a boolean return for an intentional value filter; preserve required public and callback contracts.",
|
|
4463
4468
|
category: "correctness",
|
|
4464
|
-
defaultLevel: "
|
|
4469
|
+
defaultLevel: "error",
|
|
4465
4470
|
autofix: "safe",
|
|
4466
4471
|
limitations: [
|
|
4467
4472
|
"Automatic fixes replace the unsound predicate with boolean only for an unused private function declaration without overloads, exports, eval, comments in the predicate, or declaration-file ownership. Runtime checks are preserved; observed callable contracts remain manual.",
|
|
@@ -4783,7 +4788,7 @@ var NO_PARTIAL_TYPE_PREDICATE_DOCUMENTATION = {
|
|
|
4783
4788
|
rationale: "Type predicates narrow both branches, and TypeScript trusts their implementation. A positive-number or non-empty-string predicate can return false for a value belonging to its promised type, causing callers to treat that value as a different type.",
|
|
4784
4789
|
remediation: "Use a boolean return for an intentional value filter, or recognize every member of the promised type. Preserve required callback and public contracts; a refined domain may need a distinct validated type. Recheck false-branch callers when changing a predicate.",
|
|
4785
4790
|
category: "correctness",
|
|
4786
|
-
defaultLevel: "
|
|
4791
|
+
defaultLevel: "error",
|
|
4787
4792
|
autofix: "safe",
|
|
4788
4793
|
limitations: [
|
|
4789
4794
|
"Automatic fixes replace the unsound predicate with boolean only for an unused private function declaration without overloads, exports, eval, comments in the predicate, or declaration-file ownership. Runtime checks are preserved; observed callable contracts remain manual.",
|
|
@@ -5472,7 +5477,7 @@ var NO_INVALID_ZOD_CUSTOM_PARSE_DOCUMENTATION = {
|
|
|
5472
5477
|
rationale: "Without a validator, z.custom<T>() returns its input unchanged while promising T. A parsed primitive outside that value domain fabricates a contract the caller may trust.",
|
|
5473
5478
|
remediation: "Provide actual validation, use the appropriate primitive schema, or retain an honest unknown result until validation. Preserve composed validators and independently owned domain contracts.",
|
|
5474
5479
|
category: "correctness",
|
|
5475
|
-
defaultLevel: "
|
|
5480
|
+
defaultLevel: "error",
|
|
5476
5481
|
autofix: "none",
|
|
5477
5482
|
limitations: [
|
|
5478
5483
|
"Requires type information and a direct inline z.custom<T>().parse(primitiveLiteral) call with no custom validator or parse options. Recognizes runtime imports from zod or zod/v4 and native installed Zod v4 declarations; schema bindings, compositions, safeParse, dynamic inputs and indirect calls are excluded.",
|
|
@@ -5588,7 +5593,7 @@ var NO_CONTRADICTORY_OVERLOAD_RETURN_DOCUMENTATION = {
|
|
|
5588
5593
|
rationale: "TypeScript checks an overload implementation against an overall envelope, without proving each input/result relationship. A function can compile while returning the opposite domain variant for every advertised literal input.",
|
|
5589
5594
|
remediation: "Return the variant promised for each input. Prefer a checked case map or separate variant-specific operations when that makes the relationship explicit; retain overloads required by public APIs.",
|
|
5590
5595
|
category: "correctness",
|
|
5591
|
-
defaultLevel: "
|
|
5596
|
+
defaultLevel: "error",
|
|
5592
5597
|
autofix: "safe",
|
|
5593
5598
|
limitations: [
|
|
5594
5599
|
"Automatic fixes align only an unused private complete same-file overload group with its existing literal implementation results. Binding aliases, exports, merges, eval, declaration files, comments, nonliteral result syntax and observed callers preserve manual ownership; runtime checks and returned values never change.",
|
|
@@ -33994,16 +33999,11 @@ var ADVISORY_RULES = [
|
|
|
33994
33999
|
"@sarj/excessive-commentary",
|
|
33995
34000
|
"@sarj/no-bespoke-api-case-conversion",
|
|
33996
34001
|
"@sarj/no-boolean-selector-parameter",
|
|
33997
|
-
"@sarj/no-contradictory-overload-return",
|
|
33998
|
-
"@sarj/no-contradictory-type-predicate",
|
|
33999
34002
|
"@sarj/no-cors-wildcard-with-credentials",
|
|
34000
34003
|
"@sarj/no-credential-in-browser-storage",
|
|
34001
34004
|
"@sarj/no-exception-text-in-5xx-response",
|
|
34002
34005
|
"@sarj/no-excess-jsx-props",
|
|
34003
|
-
"@sarj/no-invalid-typed-mutation",
|
|
34004
|
-
"@sarj/no-invalid-zod-custom-parse",
|
|
34005
34006
|
"@sarj/no-numeric-search-param-coercion",
|
|
34006
|
-
"@sarj/no-partial-type-predicate",
|
|
34007
34007
|
"@sarj/no-redundant-consumer-union",
|
|
34008
34008
|
"@sarj/no-restated-comment",
|
|
34009
34009
|
"@sarj/no-restated-jsdoc",
|
|
@@ -34029,12 +34029,12 @@ var RECOMMENDED_RULES = {
|
|
|
34029
34029
|
"@sarj/no-broad-return-type": "error",
|
|
34030
34030
|
"@sarj/no-reduce-accumulator-copy": "error",
|
|
34031
34031
|
"@sarj/no-known-value-widening": "error",
|
|
34032
|
-
"@sarj/no-invalid-typed-mutation": "
|
|
34033
|
-
"@sarj/no-contradictory-type-predicate": "
|
|
34034
|
-
"@sarj/no-partial-type-predicate": "
|
|
34032
|
+
"@sarj/no-invalid-typed-mutation": "error",
|
|
34033
|
+
"@sarj/no-contradictory-type-predicate": "error",
|
|
34034
|
+
"@sarj/no-partial-type-predicate": "error",
|
|
34035
34035
|
"@sarj/no-boolean-selector-parameter": "warn",
|
|
34036
|
-
"@sarj/no-invalid-zod-custom-parse": "
|
|
34037
|
-
"@sarj/no-contradictory-overload-return": "
|
|
34036
|
+
"@sarj/no-invalid-zod-custom-parse": "error",
|
|
34037
|
+
"@sarj/no-contradictory-overload-return": "error",
|
|
34038
34038
|
"@sarj/require-button-accessible-name": "error",
|
|
34039
34039
|
"@sarj/require-camelcase-properties": "error",
|
|
34040
34040
|
"@sarj/require-svg-accessible-name": "error",
|
|
@@ -34160,12 +34160,12 @@ var STRICT_RULES = {
|
|
|
34160
34160
|
"@sarj/no-broad-return-type": "error",
|
|
34161
34161
|
"@sarj/no-reduce-accumulator-copy": "error",
|
|
34162
34162
|
"@sarj/no-known-value-widening": "error",
|
|
34163
|
-
"@sarj/no-invalid-typed-mutation": "
|
|
34164
|
-
"@sarj/no-contradictory-type-predicate": "
|
|
34165
|
-
"@sarj/no-partial-type-predicate": "
|
|
34163
|
+
"@sarj/no-invalid-typed-mutation": "error",
|
|
34164
|
+
"@sarj/no-contradictory-type-predicate": "error",
|
|
34165
|
+
"@sarj/no-partial-type-predicate": "error",
|
|
34166
34166
|
"@sarj/no-boolean-selector-parameter": "warn",
|
|
34167
|
-
"@sarj/no-invalid-zod-custom-parse": "
|
|
34168
|
-
"@sarj/no-contradictory-overload-return": "
|
|
34167
|
+
"@sarj/no-invalid-zod-custom-parse": "error",
|
|
34168
|
+
"@sarj/no-contradictory-overload-return": "error",
|
|
34169
34169
|
"@sarj/require-button-accessible-name": "error",
|
|
34170
34170
|
"@sarj/require-camelcase-properties": "error",
|
|
34171
34171
|
"@sarj/require-svg-accessible-name": "error",
|