commit 614efc0e48f283a63cb89b9a523c7e953c703d2c
parent 2ad23597e0f83c6769b3882539b8700e3dfb12ff
Author: Mark Banner <standard8@mozilla.com>
Date: Mon, 22 Dec 2025 12:39:08 +0000
Bug 2004680 - Enable ESLint rule jsdoc/check-tag-names everywhere. r=frontend-codestyle-reviewers,Gijs
This also adds flexibility for allowing return vs returns and yield vs yields.
Differential Revision: https://phabricator.services.mozilla.com/D275759
Diffstat:
2 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/eslint-rollouts.config.mjs b/eslint-rollouts.config.mjs
@@ -308,7 +308,6 @@ export default [
"jsdoc/check-access": "off",
"jsdoc/check-param-names": "off",
"jsdoc/check-property-names": "off",
- "jsdoc/check-tag-names": "off",
"jsdoc/require-param-type": "off",
"jsdoc/require-returns-type": "off",
"jsdoc/valid-types": "off",
diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/valid-jsdoc.mjs b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/valid-jsdoc.mjs
@@ -14,7 +14,30 @@ export default {
// "jsdoc/check-alignment": "error",
"jsdoc/check-param-names": "error",
"jsdoc/check-property-names": "error",
- "jsdoc/check-tag-names": "error",
+ "jsdoc/check-tag-names": [
+ "error",
+ {
+ definedTags: [
+ // Used to record backwards compatibility handling for newtab, devtools
+ // and other code.
+ "backward-compat",
+ // jsdoc doesn't have this, but it seems reasonable to allow documentation
+ // of rejections.
+ "rejects",
+ // Tags supported by the custom elements manifest analyzer.
+ // https://custom-elements-manifest.open-wc.org/analyzer/getting-started/#supported-jsdoc
+ "attribute",
+ "default",
+ "csspart",
+ "cssproperty",
+ "cssState",
+ "property",
+ "slot",
+ "summary",
+ "tagname",
+ ],
+ },
+ ],
"jsdoc/check-types": "error",
"jsdoc/empty-tags": "error",
"jsdoc/multiline-blocks": "error",
@@ -26,4 +49,25 @@ export default {
"jsdoc/tag-lines": ["error", "any", { startLines: 1 }],
"jsdoc/valid-types": "error",
},
+
+ settings: {
+ jsdoc: {
+ /* eslint-disable sort-keys */
+ tagNamePreference: {
+ // We allow "return" or "returns" and "yield" or "yields" as they are
+ // similar variations, for other tag names we prefer the version that
+ // the JSDoc specification defines.
+ return: "return",
+ yield: "yield",
+ // For the custom elements manifest analyzer, we prefer the long forms
+ // as they are more descriptive.
+ attr: "attribute",
+ prop: "property",
+ part: "csspart",
+ cssprop: "cssproperty",
+ tag: "tagname",
+ },
+ /* eslint-enable sort-keys */
+ },
+ },
};