Skip to content

Commit ca3d885

Browse files
authored
Merge pull request #262 from Extersky/jsdocexports
feat: add `publicOnly` option to `require-jsdoc` rule to require only on esm/cjs/window exports docs: document `require` option
2 parents 45cfa8a + a111e3b commit ca3d885

File tree

6 files changed

+2238
-209
lines changed

6 files changed

+2238
-209
lines changed

.README/rules/require-jsdoc.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,41 @@
33
Checks for presence of jsdoc comments, on class declarations as well as
44
functions.
55

6+
#### Options
7+
8+
Accepts one optional options object, with two optional keys, `publicOnly`
9+
for confining JSDoc comments to be checked to exported functions (with "exported"
10+
allowing for ESM exports, CJS exports, or browser window global export)
11+
in `require-jsdoc`, and `require` for limiting the contexts which are to
12+
be checked by the rule.
13+
14+
- `publicOnly` - Missing jsdoc blocks are only reported for function
15+
bodies / class declarations that are exported from the module.
16+
May be a boolean or object. If set to `true`, the defaults below will
17+
be used.
18+
19+
This object supports the following optional boolean keys (`false` unless
20+
otherwise noted):
21+
22+
- `ancestorsOnly` - Only check node ancestors to check if node is exported
23+
- `esm` - ESM exports are checked for JSDoc comments (Defaults to `true`)
24+
- `cjs` - CommonJS exports are checked for JSDoc comments (Defaults to `true`)
25+
- `window` - Window global exports are checked for JSDoc comments
26+
27+
- `require` - An object with the following optional boolean keys which all
28+
default to `false` except as noted:
29+
30+
- `ArrowFunctionExpression`
31+
- `ClassDeclaration`
32+
- `FunctionDeclaration` (defaults to `true`)
33+
- `FunctionExpression`
34+
- `MethodDefinition`
35+
636
|||
737
|---|---|
838
|Context|`ArrowFunctionExpression`, `ClassDeclaration`, `FunctionDeclaration`, `FunctionExpression`|
939
|Tags|N/A|
40+
|Options|`publicOnly`|
1041
|Settings|`exemptEmptyFunctions`|
1142

1243
<!-- assertions requireJsdoc -->

0 commit comments

Comments
 (0)