eslint-plugin-tsdoc-require-2
July 3, 2026 ยท View on GitHub
Require TSDoc and JSDoc-style comments and documentation tags on exported TypeScript declarations and default exports, with optional enforcement for non-exported top-level declarations.
Table of contents
- Installation
- Usage (Flat Config)
- Opt into non-exported declarations
- Presets
- Preset matrix
- Preset usage examples
- Rules
- Rule docs
- License
- Contributors โจ
Installation
npm i -D eslint-plugin-tsdoc-require-2
Usage (Flat Config)
This plugin supports both TSDoc-first and JSDoc-style documentation workflows.
Use tsdocRequire.configs.tsdoc for stricter TSDoc conventions, or
tsdocRequire.configs.jsdoc for JSDoc-style function tag requirements such as
@param, @returns, and @throws.
import tsdocRequire from "eslint-plugin-tsdoc-require-2";
export default [
tsdocRequire.configs.recommended,
{
plugins: {
"tsdoc-require-2": tsdocRequire,
},
rules: {
"tsdoc-require-2/require": "error",
"tsdoc-require-2/require-remarks": "error",
},
},
];
Opt into non-exported declarations
By default, rules in this plugin focus on exported declarations. To also enforce
top-level non-exported declarations, set includeNonExported: true on the rules
you want.
import tsdocRequire from "eslint-plugin-tsdoc-require-2";
export default [
{
plugins: {
"tsdoc-require-2": tsdocRequire,
},
rules: {
"tsdoc-require-2/require": [
"error",
{
includeNonExported: true,
},
],
"tsdoc-require-2/require-remarks": [
"error",
{
includeNonExported: true,
},
],
},
},
];
Presets
The matrix below is generated by scripts/sync-presets-rules-matrix.mjs.
Preset matrix
Fixlegend:๐ง= autofixable๐ก= suggestions availableโ= report only
Preset keylegend:- ๐ข โ
tsdocRequire.configs.recommendedโ Minimal baseline TSDoc enforcement. - ๐ก โ
tsdocRequire.configs.detailedโ Require comments plus @remarks. - ๐ โ
tsdocRequire.configs.packagesโ Package docs baseline with @packageDocumentation. - ๐ต โ
tsdocRequire.configs.typedocโ Conservative TypeDoc declaration-kind tags. - ๐ด โ
tsdocRequire.configs["typedoc-strict"]โ Strict TypeDoc with module/remarks and tag restrictions. - ๐ฃ โ
tsdocRequire.configs.tsdocโ TSDoc-focused baseline with function/type tags plus tag restrictions. - ๐ฆ โ
tsdocRequire.configs.jsdocโ JSDoc-style function-tag baseline. - โซ โ
tsdocRequire.configs.allโ All plugin rules. Use for audits and deliberate strictness.
- ๐ข โ
Preset usage examples
import tsdocRequire from "eslint-plugin-tsdoc-require-2";
export default [
tsdocRequire.configs.detailed,
// or:
// tsdocRequire.configs.packages,
// tsdocRequire.configs.tsdoc,
// tsdocRequire.configs.jsdoc,
// tsdocRequire.configs.typedoc,
// tsdocRequire.configs["typedoc-strict"],
// tsdocRequire.configs.all,
];
configs.typedoc is intentionally conservative. It only enables TypeDoc-oriented
tag rules whose applicability can be inferred safely from declaration kind:
classes, enums, functions, and interfaces.
configs["typedoc-strict"] adds stricter constraints, including
tsdoc-require-2/restrict-tags to disallow TypeDoc compatibility-only block tags.
Rules
The table below is generated by scripts/sync-readme-rules-table.mjs.
- Rule coverage by preset is documented in the Preset matrix above.
- For full rule documentation links, see Rule docs.
Rule docs
- Core rule: docs/rules/require.md
- Required-tag index: docs/rules/required-tags.md
License
MIT ยฉ Nick2bad4u
Contributors โจ
Thanks goes to these wonderful people (emoji key):
Nick2bad4u ๐ ๐ป ๐ ๐ค ๐ ๐ง ๐ โ ๏ธ ๐ง |
Snyk bot ๐ก๏ธ ๐ ๐ง ๐ |
StepSecurity Bot ๐ก๏ธ ๐ ๐ง |
dependabot[bot] ๐ ๐ก๏ธ |
github-actions[bot] ๐ป ๐ ๐ฆ |