-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix(eslint-plugin): misc bugfixes related to recent jsdoc changes #16975
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,32 @@ | ||
const globals = require( 'globals' ); | ||
|
||
/** | ||
* Helpful utilities that are globally defined and known to the TypeScript compiler. | ||
* | ||
* @see http://www.typescriptlang.org/docs/handbook/utility-types.html | ||
*/ | ||
const typescriptUtilityTypes = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally, this comes from the official TypeScript npm package but I guess it wouldn't be as easy to extract. I did a quick google search and I didn't find anything that would fit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, unfortunately they aren't able to be extracted in this way because they're defined as |
||
'ArrayLike', | ||
'Exclude', | ||
'Extract', | ||
'InstanceType', | ||
'Iterable', | ||
'IterableIterator', | ||
'NonNullable', | ||
'Omit', | ||
'Partial', | ||
'Pick', | ||
'PromiseLike', | ||
'Readonly', | ||
'ReadonlyArray', | ||
'ReadonlyMap', | ||
'ReadonlySet', | ||
'Record', | ||
'Required', | ||
'ReturnType', | ||
'ThisType', | ||
]; | ||
|
||
module.exports = { | ||
extends: [ | ||
'plugin:jsdoc/recommended', | ||
|
@@ -17,10 +44,14 @@ module.exports = { | |
}, | ||
rules: { | ||
'jsdoc/no-undefined-types': [ 'warn', { | ||
// 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 ) ), | ||
definedTypes: [ | ||
// 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`). | ||
...Object.keys( globals.browser ).filter( ( k ) => /^[A-Z]/.test( k ) ), | ||
...typescriptUtilityTypes, | ||
'void', | ||
], | ||
} ], | ||
'jsdoc/require-jsdoc': 'off', | ||
'jsdoc/require-param-description': 'off', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks for making closer to what we had before 💯