Skip to content

Commit b6d7b4f

Browse files
committed
- Refactoring: Switch publicOnly to option (and add docs and schema therefor)
1 parent 8daed5b commit b6d7b4f

File tree

5 files changed

+238
-378
lines changed

5 files changed

+238
-378
lines changed

.README/README.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,6 @@ Finally, enable all of the rules that you would like to use.
118118
above functions/methods with no parameters or return values (intended where
119119
variable names are sufficient for themselves as documentation).
120120

121-
### Requiring JSDoc comments for exported functions in <code>require-jsdoc</code>
122-
123-
- `settings.jsdoc.publicOnly` - Missing jsdoc blocks
124-
are only reported for function bodies / class declarations that are exported from the module.
125-
May be a boolean or object.
126-
127-
This setting object supports the following keys:
128-
129-
- `ancestorsOnly` - Only check node ancestors to check if node is exported
130-
- `exports` - ESM exports are checked for JSDoc comments
131-
- `modules` - CommonJS exports are checked for JSDoc comments
132-
- `browserEnv` - Populates window variable
133-
134121
### Alias Preference
135122

136123
Use `settings.jsdoc.tagNamePreference` to configure a preferred alias name for a JSDoc tag. The format of the configuration is: `<primary tag name>: <preferred alias name>`, e.g.

.README/rules/require-jsdoc.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,32 @@
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+
- `exports` - ESM exports are checked for JSDoc comments (Defaults to `true`)
24+
- `modules` - CommonJS exports are checked for JSDoc comments (Defaults to `true`)
25+
- `browserEnv` - Populates window variable
26+
627
|||
728
|---|---|
829
|Context|`ArrowFunctionExpression`, `ClassDeclaration`, `FunctionDeclaration`, `FunctionExpression`|
930
|Tags|N/A|
10-
|Settings|`exemptEmptyFunctions`, `publicFunctionsOnly`|
31+
|Options|`publicOnly`|
32+
|Settings|`exemptEmptyFunctions`|
1133

1234
<!-- assertions requireJsdoc -->

0 commit comments

Comments
 (0)