-
-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* - feat: Add `check-examples` rule to lint JavaScript `@example` (fixes #101); with settings to: 1. require JSDoc-spec'd `<caption>` at beginning of `@example` 2. regex settings to whitelist and blacklist lintable examples 3. setting for a dummy file name to trigger specific rules defined in one's config; usable with ESLint `overrides`->`files` globs, to apply a desired subset of rules with `@example` (besides allowing for rules specific to examples, can be useful for using same rules within `@example` as with JavaScript Markdown lintable by other plugins) 4. Other settings for specifying config (base config object or an `.eslintrc` config file; checks normal `.eslintrc` by default unless `eslintrcForExamples` setting is set to `false`) 5. Provides some defaults for suppressing reporting of rules which are likely to be troublesome in example files unless `noDefaultExampleRules` setting is `true` - Report column (for checkExamples and any that report it) * docs: generate docs
- Loading branch information
Showing
8 changed files
with
937 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
### `check-examples` | ||
|
||
Ensures that (JavaScript) examples within JSDoc adhere to ESLint rules. | ||
|
||
Works in conjunction with the following settings: | ||
|
||
* `captionRequired` | ||
* `exampleCodeRegex` | ||
* `rejectExampleCodeRegex` | ||
* `noDefaultExampleRules` | ||
* `matchingFileName` | ||
* `configFile` | ||
* `eslintrcForExamples` - Defaults to `true` | ||
* `baseConfig` | ||
|
||
Inline ESLint config within `@example` JavaScript is allowed, though the | ||
disabling of ESLint directives which are not needed by the resolved rules | ||
will be reported as with the ESLint `--report-unused-disable-directives` | ||
command. | ||
|
||
||| | ||
|---|---| | ||
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`| | ||
|Tags|`param`| | ||
|
||
<!-- assertions checkExamples --> |
Oops, something went wrong.