-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add eslint-plugin-jsdoc for better JSDoc linting (#16869)
* feat(eslint-plugin): add eslint-plugin-jsdoc for improved jsdoc linting * chore: fix all JSDoc eslint errors/warnings across the entire repository
- Loading branch information
Showing
6 changed files
with
121 additions
and
24 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,29 @@ | ||
const globals = require( 'globals' ); | ||
|
||
module.exports = { | ||
extends: [ | ||
'plugin:jsdoc/recommended', | ||
], | ||
settings: { | ||
jsdoc: { | ||
preferredTypes: { | ||
object: 'Object', | ||
}, | ||
tagNamePreference: { | ||
returns: 'return', | ||
yields: 'yield', | ||
}, | ||
}, | ||
}, | ||
rules: { | ||
'jsdoc/no-undefined-types': [ 'warning', { | ||
// Required to reference browser types because we don't have the `browser` environment enabled for the project. | ||
// Here we filter out all browser globals that don't begin with an uppercase letter because those | ||
// generally refer to window-level event listeners and are not a valid type to reference (e.g. `onclick`). | ||
definedTypes: Object.keys( globals.browser ).filter( ( k ) => /^[A-Z]/.test( k ) ), | ||
} ], | ||
'jsdoc/require-jsdoc': 'off', | ||
'jsdoc/require-param-description': 'off', | ||
'jsdoc/require-returns': 'off', | ||
}, | ||
}; |
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