@sarj/eslint-plugin 15.17.6 → 15.17.7
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 +19 -12
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +19 -12
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6869,22 +6869,23 @@ var no_restated_comment_default = createRule({
|
|
|
6869
6869
|
// src/rules/no-restated-jsdoc.ts
|
|
6870
6870
|
var import_utils39 = require("@typescript-eslint/utils");
|
|
6871
6871
|
var NO_RESTATED_JSDOC_DOCUMENTATION = {
|
|
6872
|
-
summary: "Flag
|
|
6872
|
+
summary: "Flag JSDoc prose that appears to repeat declaration names without adding behavioral information.",
|
|
6873
6873
|
rationale: "Signature-only JSDoc duplicates type information and drifts without helping callers.",
|
|
6874
6874
|
remediation: "Delete the block or document behavior, constraints, failures, or context the signature cannot express.",
|
|
6875
6875
|
category: "maintainability",
|
|
6876
6876
|
aliases: ["jsdoc-restates-signature"],
|
|
6877
6877
|
autofix: "suggestion",
|
|
6878
|
-
limitations: ["Generated files, detached blocks, unknown tags, empty blocks, and JSDoc with information absent from the signature are excluded."],
|
|
6878
|
+
limitations: ["Generated files, detached blocks, intervening comments, unknown tags, explicit JSDoc type payloads, empty blocks, and JSDoc with information absent from the signature are excluded.", "Negation, conditions, constraints, sentinel values, numeric details, and quoted text conservatively preserve the block, even when a declaration name contains the same words."],
|
|
6879
6879
|
examples: [
|
|
6880
6880
|
{ id: "behavioral-jsdoc", title: "Document behavior absent from the signature", outcome: "no-match", files: [{ path: "src/users.ts", source: "/** Get the user while bypassing the read replica. */\nexport function getUser(id: string) { return id; }" }], focusPath: "src/users.ts", expectedCount: 0, public: true },
|
|
6881
|
-
{ id: "signature-jsdoc", title: "Remove JSDoc that only repeats the signature", outcome: "match", files: [{ path: "src/users.ts", source: "/** Get the user by id. */\nexport function getUserById(id: string) { return id; }" }], focusPath: "src/users.ts", expectedCount: 1, public: true }
|
|
6881
|
+
{ id: "signature-jsdoc", title: "Remove JSDoc that only repeats the signature", outcome: "match", files: [{ path: "src/users.ts", source: "/** Get the user by id. */\nexport function getUserById(id: string) { return id; }" }], focusPath: "src/users.ts", expectedCount: 1, public: true },
|
|
6882
|
+
{ id: "negated-behavior", scenarioId: "negation", title: "Keep behavior even when its words resemble the declaration", outcome: "no-match", files: [{ path: "src/users.ts", source: "/** Does not cache the user. */\nexport function cacheUser(user: unknown) { return user; }" }], focusPath: "src/users.ts", expectedCount: 0, public: true },
|
|
6883
|
+
{ id: "repeated-behavior-name", scenarioId: "negation", title: "Review prose that merely repeats the declaration name", outcome: "match", files: [{ path: "src/users.ts", source: "/** Cache the user. */\nexport function cacheUser(user: unknown) { return user; }" }], focusPath: "src/users.ts", expectedCount: 1, public: true }
|
|
6882
6884
|
]
|
|
6883
6885
|
};
|
|
6884
6886
|
var MODELLED_TAGS = /* @__PURE__ */ new Set([
|
|
6885
6887
|
"arg",
|
|
6886
6888
|
"argument",
|
|
6887
|
-
"async",
|
|
6888
6889
|
"description",
|
|
6889
6890
|
"param",
|
|
6890
6891
|
"return",
|
|
@@ -6903,7 +6904,8 @@ var STOPWORDS2 = new Set(
|
|
|
6903
6904
|
returns returning result optional required default true false null undefined
|
|
6904
6905
|
string number boolean array list promise`.split(/\s+/)
|
|
6905
6906
|
);
|
|
6906
|
-
var WORD_RE2 =
|
|
6907
|
+
var WORD_RE2 = new RegExp("\\p{L}+", "gu");
|
|
6908
|
+
var BEHAVIORAL_PROSE_RE = /\b(?:not|no|never|if|when|unless|must|should|may|can|could|would|optional|required|default|true|false|null|undefined|before|after|until|once|again|only|always)\b|\d|["'`<>=+*/%&|!~^-]/i;
|
|
6907
6909
|
function parseJsDoc(value) {
|
|
6908
6910
|
const lines = value.replace(/^\*/, "").split("\n").map((line) => line.replace(/^\s*\*?\s?/, ""));
|
|
6909
6911
|
const description = [];
|
|
@@ -6923,12 +6925,13 @@ function parseJsDoc(value) {
|
|
|
6923
6925
|
return { description: description.join("\n").trim(), tags };
|
|
6924
6926
|
}
|
|
6925
6927
|
function covered(text, known) {
|
|
6928
|
+
if (BEHAVIORAL_PROSE_RE.test(text)) return false;
|
|
6926
6929
|
const stems = /* @__PURE__ */ new Set();
|
|
6927
6930
|
for (const token of known) stems.add(stem(token));
|
|
6928
6931
|
return proseTokens(text).every((word) => known.has(word) || stems.has(stem(word)));
|
|
6929
6932
|
}
|
|
6930
6933
|
function proseTokens(text) {
|
|
6931
|
-
return (text.match(WORD_RE2) ?? []).map((word) => word.toLowerCase()).filter((word) =>
|
|
6934
|
+
return (text.match(WORD_RE2) ?? []).map((word) => word.toLowerCase()).filter((word) => !STOPWORDS2.has(word));
|
|
6932
6935
|
}
|
|
6933
6936
|
function declarationNames(node) {
|
|
6934
6937
|
switch (node.type) {
|
|
@@ -6985,11 +6988,11 @@ var no_restated_jsdoc_default = createRule({
|
|
|
6985
6988
|
type: "suggestion",
|
|
6986
6989
|
hasSuggestions: true,
|
|
6987
6990
|
docs: {
|
|
6988
|
-
description: "Flag
|
|
6991
|
+
description: "Flag JSDoc prose that appears to repeat declaration names without adding behavioral information."
|
|
6989
6992
|
},
|
|
6990
6993
|
schema: [],
|
|
6991
6994
|
messages: {
|
|
6992
|
-
restatesSignature: "JSDoc
|
|
6995
|
+
restatesSignature: "JSDoc appears to repeat declaration names \u2014 consider removing repetition. Keep type contracts, constraints, failures, and rationale.",
|
|
6993
6996
|
deleteBlock: "Delete the JSDoc block."
|
|
6994
6997
|
}
|
|
6995
6998
|
},
|
|
@@ -7012,8 +7015,9 @@ var no_restated_jsdoc_default = createRule({
|
|
|
7012
7015
|
const tagNames = new Set(tags.map((tag) => tag.name));
|
|
7013
7016
|
if ([...tagNames].some((name) => !MODELLED_TAGS.has(name))) continue;
|
|
7014
7017
|
if (isProtected(describedText)) continue;
|
|
7015
|
-
const token = sourceCode.getTokenAfter(comment, { includeComments:
|
|
7018
|
+
const token = sourceCode.getTokenAfter(comment, { includeComments: true });
|
|
7016
7019
|
if (token === null || token.loc.start.line !== comment.loc.end.line + 1) continue;
|
|
7020
|
+
if (token.type === "Line" || token.type === "Block") continue;
|
|
7017
7021
|
let node = sourceCode.getNodeByRangeIndex(token.range[0]);
|
|
7018
7022
|
let declaration = null;
|
|
7019
7023
|
while (node != null && node.type !== import_utils39.AST_NODE_TYPES.Program) {
|
|
@@ -7024,6 +7028,8 @@ var no_restated_jsdoc_default = createRule({
|
|
|
7024
7028
|
if (declaration === null) continue;
|
|
7025
7029
|
const paramTags = tags.filter((tag) => PARAM_TAGS.has(tag.name));
|
|
7026
7030
|
const returnTags = tags.filter((tag) => RETURN_TAGS.has(tag.name));
|
|
7031
|
+
if ([...paramTags, ...returnTags].some((tag) => /^\s*\{/.test(tag.text))) continue;
|
|
7032
|
+
if (paramTags.some((tag) => /^\s*(?:\[|[A-Za-z_$][\w$]*\.)/.test(tag.text))) continue;
|
|
7027
7033
|
if (describedText.length === 0 && paramTags.length === 0 && returnTags.length === 0) {
|
|
7028
7034
|
continue;
|
|
7029
7035
|
}
|
|
@@ -19752,7 +19758,7 @@ var RULES = {
|
|
|
19752
19758
|
};
|
|
19753
19759
|
var meta = {
|
|
19754
19760
|
name: "@sarj/eslint-plugin",
|
|
19755
|
-
version: "15.17.
|
|
19761
|
+
version: "15.17.7"
|
|
19756
19762
|
};
|
|
19757
19763
|
var APPLICATION_ONLY_RULES = [];
|
|
19758
19764
|
var LIBRARY_IMPORT_POLICY = ["error", {
|
|
@@ -19763,6 +19769,7 @@ var ADVISORY_RULES = [
|
|
|
19763
19769
|
"@sarj/excessive-commentary",
|
|
19764
19770
|
"@sarj/no-bespoke-api-case-conversion",
|
|
19765
19771
|
"@sarj/no-restated-comment",
|
|
19772
|
+
"@sarj/no-restated-jsdoc",
|
|
19766
19773
|
"@sarj/prefer-millisecond-control-duration-schema",
|
|
19767
19774
|
"@sarj/prefer-module-level-refined-schema",
|
|
19768
19775
|
"@sarj/prefer-multi-value-zod-literal",
|
|
@@ -19811,7 +19818,7 @@ var RECOMMENDED_RULES = {
|
|
|
19811
19818
|
"@sarj/no-repeated-string-literal": "error",
|
|
19812
19819
|
"@sarj/no-router-refresh-polling": "error",
|
|
19813
19820
|
"@sarj/no-restated-comment": "warn",
|
|
19814
|
-
"@sarj/no-restated-jsdoc": "
|
|
19821
|
+
"@sarj/no-restated-jsdoc": "warn",
|
|
19815
19822
|
"@sarj/no-secret-in-log": "error",
|
|
19816
19823
|
"@sarj/no-server-env-in-client-component": "error",
|
|
19817
19824
|
"@sarj/no-select-star": "error",
|
|
@@ -19907,7 +19914,7 @@ var STRICT_RULES = {
|
|
|
19907
19914
|
"@sarj/no-repeated-string-literal": "error",
|
|
19908
19915
|
"@sarj/no-router-refresh-polling": "error",
|
|
19909
19916
|
"@sarj/no-restated-comment": "warn",
|
|
19910
|
-
"@sarj/no-restated-jsdoc": "
|
|
19917
|
+
"@sarj/no-restated-jsdoc": "warn",
|
|
19911
19918
|
"@sarj/no-secret-in-log": "error",
|
|
19912
19919
|
"@sarj/no-server-env-in-client-component": "error",
|
|
19913
19920
|
"@sarj/no-select-star": "error",
|
package/dist/index.d.cts
CHANGED
|
@@ -320,7 +320,7 @@ declare const RULES: {
|
|
|
320
320
|
/** @deprecated All repositories use one policy; retained for import compatibility. */
|
|
321
321
|
declare const APPLICATION_ONLY_RULES: readonly [];
|
|
322
322
|
/** Rules staged as non-blocking warnings while corpus adoption evidence accumulates. */
|
|
323
|
-
declare const ADVISORY_RULES: readonly ["@sarj/excessive-commentary", "@sarj/no-bespoke-api-case-conversion", "@sarj/no-restated-comment", "@sarj/prefer-millisecond-control-duration-schema", "@sarj/prefer-module-level-refined-schema", "@sarj/prefer-multi-value-zod-literal", "@sarj/prefer-named-callback-domain", "@sarj/prefer-named-complex-return-type", "@sarj/prefer-node-crypto-hash", "@sarj/prefer-node-fs-promises", "@sarj/prefer-nullish-filter-predicate", "@sarj/prefer-shared-zod-enum", "@sarj/prefer-switch-for-repeated-equality", "@sarj/require-interface-for-exported-class", "@sarj/require-sql-access-class", "@sarj/sole-export-matches-filename"];
|
|
323
|
+
declare const ADVISORY_RULES: readonly ["@sarj/excessive-commentary", "@sarj/no-bespoke-api-case-conversion", "@sarj/no-restated-comment", "@sarj/no-restated-jsdoc", "@sarj/prefer-millisecond-control-duration-schema", "@sarj/prefer-module-level-refined-schema", "@sarj/prefer-multi-value-zod-literal", "@sarj/prefer-named-callback-domain", "@sarj/prefer-named-complex-return-type", "@sarj/prefer-node-crypto-hash", "@sarj/prefer-node-fs-promises", "@sarj/prefer-nullish-filter-predicate", "@sarj/prefer-shared-zod-enum", "@sarj/prefer-switch-for-repeated-equality", "@sarj/require-interface-for-exported-class", "@sarj/require-sql-access-class", "@sarj/sole-export-matches-filename"];
|
|
324
324
|
declare const RECOMMENDED_RULES: {
|
|
325
325
|
readonly "no-restricted-imports": readonly ["error", {
|
|
326
326
|
readonly paths: {
|
|
@@ -538,7 +538,7 @@ declare const RECOMMENDED_RULES: {
|
|
|
538
538
|
readonly "@sarj/no-repeated-string-literal": "error";
|
|
539
539
|
readonly "@sarj/no-router-refresh-polling": "error";
|
|
540
540
|
readonly "@sarj/no-restated-comment": "warn";
|
|
541
|
-
readonly "@sarj/no-restated-jsdoc": "
|
|
541
|
+
readonly "@sarj/no-restated-jsdoc": "warn";
|
|
542
542
|
readonly "@sarj/no-secret-in-log": "error";
|
|
543
543
|
readonly "@sarj/no-server-env-in-client-component": "error";
|
|
544
544
|
readonly "@sarj/no-select-star": "error";
|
|
@@ -821,7 +821,7 @@ declare const STRICT_RULES: {
|
|
|
821
821
|
readonly "@sarj/no-repeated-string-literal": "error";
|
|
822
822
|
readonly "@sarj/no-router-refresh-polling": "error";
|
|
823
823
|
readonly "@sarj/no-restated-comment": "warn";
|
|
824
|
-
readonly "@sarj/no-restated-jsdoc": "
|
|
824
|
+
readonly "@sarj/no-restated-jsdoc": "warn";
|
|
825
825
|
readonly "@sarj/no-secret-in-log": "error";
|
|
826
826
|
readonly "@sarj/no-server-env-in-client-component": "error";
|
|
827
827
|
readonly "@sarj/no-select-star": "error";
|
|
@@ -893,7 +893,7 @@ type FlatPreset = {
|
|
|
893
893
|
declare const PLUGIN: {
|
|
894
894
|
readonly meta: {
|
|
895
895
|
readonly name: "@sarj/eslint-plugin";
|
|
896
|
-
readonly version: "15.17.
|
|
896
|
+
readonly version: "15.17.7";
|
|
897
897
|
};
|
|
898
898
|
readonly rules: {
|
|
899
899
|
readonly "excessive-commentary": DocumentedRule<readonly [], "excessive">;
|
package/dist/index.d.ts
CHANGED
|
@@ -320,7 +320,7 @@ declare const RULES: {
|
|
|
320
320
|
/** @deprecated All repositories use one policy; retained for import compatibility. */
|
|
321
321
|
declare const APPLICATION_ONLY_RULES: readonly [];
|
|
322
322
|
/** Rules staged as non-blocking warnings while corpus adoption evidence accumulates. */
|
|
323
|
-
declare const ADVISORY_RULES: readonly ["@sarj/excessive-commentary", "@sarj/no-bespoke-api-case-conversion", "@sarj/no-restated-comment", "@sarj/prefer-millisecond-control-duration-schema", "@sarj/prefer-module-level-refined-schema", "@sarj/prefer-multi-value-zod-literal", "@sarj/prefer-named-callback-domain", "@sarj/prefer-named-complex-return-type", "@sarj/prefer-node-crypto-hash", "@sarj/prefer-node-fs-promises", "@sarj/prefer-nullish-filter-predicate", "@sarj/prefer-shared-zod-enum", "@sarj/prefer-switch-for-repeated-equality", "@sarj/require-interface-for-exported-class", "@sarj/require-sql-access-class", "@sarj/sole-export-matches-filename"];
|
|
323
|
+
declare const ADVISORY_RULES: readonly ["@sarj/excessive-commentary", "@sarj/no-bespoke-api-case-conversion", "@sarj/no-restated-comment", "@sarj/no-restated-jsdoc", "@sarj/prefer-millisecond-control-duration-schema", "@sarj/prefer-module-level-refined-schema", "@sarj/prefer-multi-value-zod-literal", "@sarj/prefer-named-callback-domain", "@sarj/prefer-named-complex-return-type", "@sarj/prefer-node-crypto-hash", "@sarj/prefer-node-fs-promises", "@sarj/prefer-nullish-filter-predicate", "@sarj/prefer-shared-zod-enum", "@sarj/prefer-switch-for-repeated-equality", "@sarj/require-interface-for-exported-class", "@sarj/require-sql-access-class", "@sarj/sole-export-matches-filename"];
|
|
324
324
|
declare const RECOMMENDED_RULES: {
|
|
325
325
|
readonly "no-restricted-imports": readonly ["error", {
|
|
326
326
|
readonly paths: {
|
|
@@ -538,7 +538,7 @@ declare const RECOMMENDED_RULES: {
|
|
|
538
538
|
readonly "@sarj/no-repeated-string-literal": "error";
|
|
539
539
|
readonly "@sarj/no-router-refresh-polling": "error";
|
|
540
540
|
readonly "@sarj/no-restated-comment": "warn";
|
|
541
|
-
readonly "@sarj/no-restated-jsdoc": "
|
|
541
|
+
readonly "@sarj/no-restated-jsdoc": "warn";
|
|
542
542
|
readonly "@sarj/no-secret-in-log": "error";
|
|
543
543
|
readonly "@sarj/no-server-env-in-client-component": "error";
|
|
544
544
|
readonly "@sarj/no-select-star": "error";
|
|
@@ -821,7 +821,7 @@ declare const STRICT_RULES: {
|
|
|
821
821
|
readonly "@sarj/no-repeated-string-literal": "error";
|
|
822
822
|
readonly "@sarj/no-router-refresh-polling": "error";
|
|
823
823
|
readonly "@sarj/no-restated-comment": "warn";
|
|
824
|
-
readonly "@sarj/no-restated-jsdoc": "
|
|
824
|
+
readonly "@sarj/no-restated-jsdoc": "warn";
|
|
825
825
|
readonly "@sarj/no-secret-in-log": "error";
|
|
826
826
|
readonly "@sarj/no-server-env-in-client-component": "error";
|
|
827
827
|
readonly "@sarj/no-select-star": "error";
|
|
@@ -893,7 +893,7 @@ type FlatPreset = {
|
|
|
893
893
|
declare const PLUGIN: {
|
|
894
894
|
readonly meta: {
|
|
895
895
|
readonly name: "@sarj/eslint-plugin";
|
|
896
|
-
readonly version: "15.17.
|
|
896
|
+
readonly version: "15.17.7";
|
|
897
897
|
};
|
|
898
898
|
readonly rules: {
|
|
899
899
|
readonly "excessive-commentary": DocumentedRule<readonly [], "excessive">;
|
package/dist/index.js
CHANGED
|
@@ -6828,22 +6828,23 @@ var no_restated_comment_default = createRule({
|
|
|
6828
6828
|
// src/rules/no-restated-jsdoc.ts
|
|
6829
6829
|
import { AST_NODE_TYPES as AST_NODE_TYPES29 } from "@typescript-eslint/utils";
|
|
6830
6830
|
var NO_RESTATED_JSDOC_DOCUMENTATION = {
|
|
6831
|
-
summary: "Flag
|
|
6831
|
+
summary: "Flag JSDoc prose that appears to repeat declaration names without adding behavioral information.",
|
|
6832
6832
|
rationale: "Signature-only JSDoc duplicates type information and drifts without helping callers.",
|
|
6833
6833
|
remediation: "Delete the block or document behavior, constraints, failures, or context the signature cannot express.",
|
|
6834
6834
|
category: "maintainability",
|
|
6835
6835
|
aliases: ["jsdoc-restates-signature"],
|
|
6836
6836
|
autofix: "suggestion",
|
|
6837
|
-
limitations: ["Generated files, detached blocks, unknown tags, empty blocks, and JSDoc with information absent from the signature are excluded."],
|
|
6837
|
+
limitations: ["Generated files, detached blocks, intervening comments, unknown tags, explicit JSDoc type payloads, empty blocks, and JSDoc with information absent from the signature are excluded.", "Negation, conditions, constraints, sentinel values, numeric details, and quoted text conservatively preserve the block, even when a declaration name contains the same words."],
|
|
6838
6838
|
examples: [
|
|
6839
6839
|
{ id: "behavioral-jsdoc", title: "Document behavior absent from the signature", outcome: "no-match", files: [{ path: "src/users.ts", source: "/** Get the user while bypassing the read replica. */\nexport function getUser(id: string) { return id; }" }], focusPath: "src/users.ts", expectedCount: 0, public: true },
|
|
6840
|
-
{ id: "signature-jsdoc", title: "Remove JSDoc that only repeats the signature", outcome: "match", files: [{ path: "src/users.ts", source: "/** Get the user by id. */\nexport function getUserById(id: string) { return id; }" }], focusPath: "src/users.ts", expectedCount: 1, public: true }
|
|
6840
|
+
{ id: "signature-jsdoc", title: "Remove JSDoc that only repeats the signature", outcome: "match", files: [{ path: "src/users.ts", source: "/** Get the user by id. */\nexport function getUserById(id: string) { return id; }" }], focusPath: "src/users.ts", expectedCount: 1, public: true },
|
|
6841
|
+
{ id: "negated-behavior", scenarioId: "negation", title: "Keep behavior even when its words resemble the declaration", outcome: "no-match", files: [{ path: "src/users.ts", source: "/** Does not cache the user. */\nexport function cacheUser(user: unknown) { return user; }" }], focusPath: "src/users.ts", expectedCount: 0, public: true },
|
|
6842
|
+
{ id: "repeated-behavior-name", scenarioId: "negation", title: "Review prose that merely repeats the declaration name", outcome: "match", files: [{ path: "src/users.ts", source: "/** Cache the user. */\nexport function cacheUser(user: unknown) { return user; }" }], focusPath: "src/users.ts", expectedCount: 1, public: true }
|
|
6841
6843
|
]
|
|
6842
6844
|
};
|
|
6843
6845
|
var MODELLED_TAGS = /* @__PURE__ */ new Set([
|
|
6844
6846
|
"arg",
|
|
6845
6847
|
"argument",
|
|
6846
|
-
"async",
|
|
6847
6848
|
"description",
|
|
6848
6849
|
"param",
|
|
6849
6850
|
"return",
|
|
@@ -6862,7 +6863,8 @@ var STOPWORDS2 = new Set(
|
|
|
6862
6863
|
returns returning result optional required default true false null undefined
|
|
6863
6864
|
string number boolean array list promise`.split(/\s+/)
|
|
6864
6865
|
);
|
|
6865
|
-
var WORD_RE2 =
|
|
6866
|
+
var WORD_RE2 = new RegExp("\\p{L}+", "gu");
|
|
6867
|
+
var BEHAVIORAL_PROSE_RE = /\b(?:not|no|never|if|when|unless|must|should|may|can|could|would|optional|required|default|true|false|null|undefined|before|after|until|once|again|only|always)\b|\d|["'`<>=+*/%&|!~^-]/i;
|
|
6866
6868
|
function parseJsDoc(value) {
|
|
6867
6869
|
const lines = value.replace(/^\*/, "").split("\n").map((line) => line.replace(/^\s*\*?\s?/, ""));
|
|
6868
6870
|
const description = [];
|
|
@@ -6882,12 +6884,13 @@ function parseJsDoc(value) {
|
|
|
6882
6884
|
return { description: description.join("\n").trim(), tags };
|
|
6883
6885
|
}
|
|
6884
6886
|
function covered(text, known) {
|
|
6887
|
+
if (BEHAVIORAL_PROSE_RE.test(text)) return false;
|
|
6885
6888
|
const stems = /* @__PURE__ */ new Set();
|
|
6886
6889
|
for (const token of known) stems.add(stem(token));
|
|
6887
6890
|
return proseTokens(text).every((word) => known.has(word) || stems.has(stem(word)));
|
|
6888
6891
|
}
|
|
6889
6892
|
function proseTokens(text) {
|
|
6890
|
-
return (text.match(WORD_RE2) ?? []).map((word) => word.toLowerCase()).filter((word) =>
|
|
6893
|
+
return (text.match(WORD_RE2) ?? []).map((word) => word.toLowerCase()).filter((word) => !STOPWORDS2.has(word));
|
|
6891
6894
|
}
|
|
6892
6895
|
function declarationNames(node) {
|
|
6893
6896
|
switch (node.type) {
|
|
@@ -6944,11 +6947,11 @@ var no_restated_jsdoc_default = createRule({
|
|
|
6944
6947
|
type: "suggestion",
|
|
6945
6948
|
hasSuggestions: true,
|
|
6946
6949
|
docs: {
|
|
6947
|
-
description: "Flag
|
|
6950
|
+
description: "Flag JSDoc prose that appears to repeat declaration names without adding behavioral information."
|
|
6948
6951
|
},
|
|
6949
6952
|
schema: [],
|
|
6950
6953
|
messages: {
|
|
6951
|
-
restatesSignature: "JSDoc
|
|
6954
|
+
restatesSignature: "JSDoc appears to repeat declaration names \u2014 consider removing repetition. Keep type contracts, constraints, failures, and rationale.",
|
|
6952
6955
|
deleteBlock: "Delete the JSDoc block."
|
|
6953
6956
|
}
|
|
6954
6957
|
},
|
|
@@ -6971,8 +6974,9 @@ var no_restated_jsdoc_default = createRule({
|
|
|
6971
6974
|
const tagNames = new Set(tags.map((tag) => tag.name));
|
|
6972
6975
|
if ([...tagNames].some((name) => !MODELLED_TAGS.has(name))) continue;
|
|
6973
6976
|
if (isProtected(describedText)) continue;
|
|
6974
|
-
const token = sourceCode.getTokenAfter(comment, { includeComments:
|
|
6977
|
+
const token = sourceCode.getTokenAfter(comment, { includeComments: true });
|
|
6975
6978
|
if (token === null || token.loc.start.line !== comment.loc.end.line + 1) continue;
|
|
6979
|
+
if (token.type === "Line" || token.type === "Block") continue;
|
|
6976
6980
|
let node = sourceCode.getNodeByRangeIndex(token.range[0]);
|
|
6977
6981
|
let declaration = null;
|
|
6978
6982
|
while (node != null && node.type !== AST_NODE_TYPES29.Program) {
|
|
@@ -6983,6 +6987,8 @@ var no_restated_jsdoc_default = createRule({
|
|
|
6983
6987
|
if (declaration === null) continue;
|
|
6984
6988
|
const paramTags = tags.filter((tag) => PARAM_TAGS.has(tag.name));
|
|
6985
6989
|
const returnTags = tags.filter((tag) => RETURN_TAGS.has(tag.name));
|
|
6990
|
+
if ([...paramTags, ...returnTags].some((tag) => /^\s*\{/.test(tag.text))) continue;
|
|
6991
|
+
if (paramTags.some((tag) => /^\s*(?:\[|[A-Za-z_$][\w$]*\.)/.test(tag.text))) continue;
|
|
6986
6992
|
if (describedText.length === 0 && paramTags.length === 0 && returnTags.length === 0) {
|
|
6987
6993
|
continue;
|
|
6988
6994
|
}
|
|
@@ -19747,7 +19753,7 @@ var RULES = {
|
|
|
19747
19753
|
};
|
|
19748
19754
|
var meta = {
|
|
19749
19755
|
name: "@sarj/eslint-plugin",
|
|
19750
|
-
version: "15.17.
|
|
19756
|
+
version: "15.17.7"
|
|
19751
19757
|
};
|
|
19752
19758
|
var APPLICATION_ONLY_RULES = [];
|
|
19753
19759
|
var LIBRARY_IMPORT_POLICY = ["error", {
|
|
@@ -19758,6 +19764,7 @@ var ADVISORY_RULES = [
|
|
|
19758
19764
|
"@sarj/excessive-commentary",
|
|
19759
19765
|
"@sarj/no-bespoke-api-case-conversion",
|
|
19760
19766
|
"@sarj/no-restated-comment",
|
|
19767
|
+
"@sarj/no-restated-jsdoc",
|
|
19761
19768
|
"@sarj/prefer-millisecond-control-duration-schema",
|
|
19762
19769
|
"@sarj/prefer-module-level-refined-schema",
|
|
19763
19770
|
"@sarj/prefer-multi-value-zod-literal",
|
|
@@ -19806,7 +19813,7 @@ var RECOMMENDED_RULES = {
|
|
|
19806
19813
|
"@sarj/no-repeated-string-literal": "error",
|
|
19807
19814
|
"@sarj/no-router-refresh-polling": "error",
|
|
19808
19815
|
"@sarj/no-restated-comment": "warn",
|
|
19809
|
-
"@sarj/no-restated-jsdoc": "
|
|
19816
|
+
"@sarj/no-restated-jsdoc": "warn",
|
|
19810
19817
|
"@sarj/no-secret-in-log": "error",
|
|
19811
19818
|
"@sarj/no-server-env-in-client-component": "error",
|
|
19812
19819
|
"@sarj/no-select-star": "error",
|
|
@@ -19902,7 +19909,7 @@ var STRICT_RULES = {
|
|
|
19902
19909
|
"@sarj/no-repeated-string-literal": "error",
|
|
19903
19910
|
"@sarj/no-router-refresh-polling": "error",
|
|
19904
19911
|
"@sarj/no-restated-comment": "warn",
|
|
19905
|
-
"@sarj/no-restated-jsdoc": "
|
|
19912
|
+
"@sarj/no-restated-jsdoc": "warn",
|
|
19906
19913
|
"@sarj/no-secret-in-log": "error",
|
|
19907
19914
|
"@sarj/no-server-env-in-client-component": "error",
|
|
19908
19915
|
"@sarj/no-select-star": "error",
|