Skip to content
This repository was archived by the owner on Jul 2, 2026. It is now read-only.

Commit a41029d

Browse files
committed
feat(tsdoc-lint): rename jsdoc-lint, switch to TSDoc-aware rules; refresh root README
BREAKING: hook id renamed jsdoc-lint -> tsdoc-lint. Consumers must update .pre-commit-config.yaml entries. JSDoc was the wrong canonical for TypeScript-only projects; TSDoc is the Microsoft-blessed standard (https://tsdoc.org) consumed by tsc, VS Code, and API Extractor. The hook now trusts the consumer's eslint config to wire tsdoc/syntax (via eslint-plugin-tsdoc) and optionally jsdoc/require-jsdoc with TS-aware contexts. types_or narrows to [ts, tsx] since the hook is TypeScript-specific. Also: full rewrite of the root README to document every hook the repo ships (67 hooks across 14+ languages), with a dedicated section for the 16 doc-quality hooks added in v1.1.0. .gitignore picks up .yardoc/, node_modules/, .eslintcache so locally-run hooks don't dirty the tree.
1 parent 0862e1e commit a41029d

11 files changed

Lines changed: 499 additions & 323 deletions

File tree

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,12 @@ target/
2727

2828
# Test artifacts
2929
tests/.tmp/
30+
31+
# Ruby YARD doc database (produced by `yard doc` / `yard stats`)
32+
.yardoc/
33+
doc/
34+
35+
# Node / pnpm artifacts (from running tsdoc-lint locally)
36+
node_modules/
37+
pnpm-debug.log
38+
.eslintcache

.pre-commit-hooks.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,12 @@
402402
pass_filenames: false
403403
args: []
404404

405-
- id: jsdoc-lint
406-
name: jsdoc-lint (JavaScript/TypeScript JSDoc linter)
407-
description: Check JavaScript/TypeScript JSDoc completeness via eslint-plugin-jsdoc.
408-
entry: hooks/jsdoc-lint/run.sh
405+
- id: tsdoc-lint
406+
name: tsdoc-lint (TypeScript TSDoc linter)
407+
description: Check TypeScript TSDoc completeness via eslint with eslint-plugin-tsdoc and eslint-plugin-jsdoc.
408+
entry: hooks/tsdoc-lint/run.sh
409409
language: script
410-
types_or: [javascript, jsx, ts, tsx]
410+
types_or: [ts, tsx]
411411
pass_filenames: false
412412
args: []
413413

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.1.2] - 2026-05-16
11+
12+
### Changed
13+
14+
- `jsdoc-lint``tsdoc-lint`. The hook is now TypeScript-focused and trusts
15+
the consumer's eslint config to wire `tsdoc/syntax` (via
16+
`eslint-plugin-tsdoc`, Microsoft's [TSDoc spec](https://tsdoc.org/)) and
17+
optionally `jsdoc/require-jsdoc` (via `eslint-plugin-jsdoc`, for coverage
18+
with TS-aware contexts). `types_or` narrows to `[ts, tsx]`. JSDoc was the
19+
wrong canonical for TypeScript-only projects; TSDoc is the Microsoft-blessed
20+
standard consumed by tsc, VS Code, and API Extractor. Hook is new in
21+
v1.1.0 / fixed in v1.1.1; renaming before downstream consumers depend on
22+
the old id.
23+
24+
### Added
25+
26+
- Root `README.md` now documents every hook the repo ships (67 hooks across
27+
14+ languages), with a dedicated "Doc-quality hooks (v1.1.0+)" section
28+
covering the 16 documentation-focused hooks added in v1.1.0.
29+
30+
- `.gitignore` excludes `.yardoc/`, `doc/`, `node_modules/`, `.eslintcache`
31+
so locally-run hooks don't dirty the tree.
32+
1033
## [1.1.1] - 2026-05-16
1134

1235
### Fixed

README.md

Lines changed: 353 additions & 247 deletions
Large diffs are not rendered by default.

hooks/jsdoc-lint/README.md

Lines changed: 0 additions & 28 deletions
This file was deleted.

hooks/jsdoc-lint/run.sh

Lines changed: 0 additions & 41 deletions
This file was deleted.

hooks/tsdoc-lint/README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# tsdoc-lint
2+
3+
TypeScript TSDoc documentation linter. Invokes the consumer's `eslint` with
4+
[`eslint-plugin-tsdoc`](https://www.npmjs.com/package/eslint-plugin-tsdoc)
5+
for syntax validation per the Microsoft
6+
[TSDoc specification](https://tsdoc.org/), and optionally
7+
[`eslint-plugin-jsdoc`](https://www.npmjs.com/package/eslint-plugin-jsdoc)
8+
for coverage (`require-jsdoc` rule with TypeScript-aware contexts).
9+
10+
## Category
11+
12+
Toolchain wrapper. Trusts the consumer's eslint config to declare the relevant
13+
rules. If `package.json` is absent in the working directory the hook exits
14+
silently (no-op for non-Node projects).
15+
16+
## Default args
17+
18+
No default args. Runs `eslint` on positional targets, defaulting to `.` if none
19+
specified.
20+
21+
## Why TSDoc, not JSDoc
22+
23+
JSDoc was designed for vanilla JavaScript. TSDoc is the TypeScript-native
24+
documentation standard maintained by Microsoft and consumed by the TypeScript
25+
compiler, VS Code, and downstream tools such as API Extractor. For
26+
TypeScript-only projects, TSDoc is the canonical choice.
27+
28+
## Consumer setup
29+
30+
```bash
31+
pnpm add -D eslint eslint-plugin-tsdoc eslint-plugin-jsdoc
32+
```
33+
34+
Minimal `eslint.config.js`:
35+
36+
```js
37+
import tsdoc from "eslint-plugin-tsdoc";
38+
import jsdoc from "eslint-plugin-jsdoc";
39+
40+
export default [
41+
{
42+
files: ["**/*.ts", "**/*.tsx"],
43+
plugins: { tsdoc, jsdoc },
44+
rules: {
45+
"tsdoc/syntax": "error",
46+
"jsdoc/require-jsdoc": [
47+
"error",
48+
{
49+
publicOnly: true,
50+
contexts: [
51+
"TSInterfaceDeclaration",
52+
"TSTypeAliasDeclaration",
53+
"TSEnumDeclaration",
54+
"ExportNamedDeclaration",
55+
"TSMethodSignature",
56+
"TSPropertySignature",
57+
],
58+
},
59+
],
60+
},
61+
},
62+
];
63+
```
64+
65+
## Troubleshooting
66+
67+
- Install Node.js: <https://nodejs.org/>
68+
- Verify `pnpm exec eslint --version` resolves in the consumer project
69+
- Ensure the eslint config matches the files passed by pre-commit

hooks/tsdoc-lint/run.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
# tsdoc-lint — TypeScript TSDoc documentation linter via eslint with
3+
# eslint-plugin-tsdoc (syntax) and optionally eslint-plugin-jsdoc (coverage).
4+
#
5+
# Trusts the consumer's eslint config to wire `tsdoc/syntax` and any
6+
# `jsdoc/require-jsdoc` coverage rule. If `package.json` is absent the hook
7+
# exits silently (no-op for non-Node projects).
8+
set -euo pipefail
9+
10+
if [[ ! -f package.json ]]; then
11+
exit 0
12+
fi
13+
14+
if command -v pnpm >/dev/null 2>&1; then
15+
base_cmd=(pnpm exec eslint)
16+
elif command -v npm >/dev/null 2>&1; then
17+
base_cmd=(npx --no-install eslint)
18+
elif command -v npx >/dev/null 2>&1; then
19+
base_cmd=(npx --no-install eslint)
20+
else
21+
printf 'kreuzberg-pre-commit-hooks: skipping tsdoc-lint — no Node package manager found on PATH.\n' >&2
22+
printf ' install Node.js (https://nodejs.org/) to enable this hook.\n' >&2
23+
exit 0
24+
fi
25+
26+
declare -a targets=()
27+
for arg in "$@"; do
28+
case "${arg}" in
29+
-*) ;;
30+
*) targets+=("${arg}") ;;
31+
esac
32+
done
33+
34+
if ((${#targets[@]} == 0)); then
35+
targets=(.)
36+
fi
37+
38+
exec "${base_cmd[@]}" "${targets[@]}"

0 commit comments

Comments
 (0)