Skip to content

Commit

Permalink
Upgrade eslint-plugin-jsdoc to latest version (#24586)
Browse files Browse the repository at this point in the history
* Upgrade eslint-plugin-jsdoc to latest version

* Add CHANGELOG entry

* Configure is-shallow-equal JSDoc mode as TypeScript

Since the ESLint configuration is set as root, it must reconfigure its own JSDoc settings to inform parser that it should treat JSDoc as supporting TypeScript syntax
  • Loading branch information
aduth authored Aug 16, 2020
1 parent 068064a commit 375eaa0
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 34 deletions.
34 changes: 14 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions packages/block-editor/src/components/link-control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,12 @@ import { ViewerFill } from './viewer-slot';
* @property {string} title Human-readable label to show in user interface.
*/

/* eslint-disable jsdoc/valid-types */
/**
* Properties associated with a link control value, composed as a union of the
* default properties and any custom settings values.
*
* @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue
*/
/* eslint-enable */

/** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */

Expand Down
2 changes: 0 additions & 2 deletions packages/element/src/raw-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
import { createElement } from './react';

// Disable reason: JSDoc linter doesn't seem to parse the union (`&`) correctly.
/* eslint-disable jsdoc/valid-types */
/** @typedef {{children: string} & import('react').ComponentPropsWithoutRef<'div'>} RawHTMLProps */
/* eslint-enable jsdoc/valid-types */

/**
* Component used as equivalent of Fragment with unescaped HTML, in cases where
Expand Down
4 changes: 4 additions & 0 deletions packages/eslint-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Enhancements

- The bundled `eslint-plugin-jsdoc` dependency has been updated from requiring `^26.0.0` to requiring `^30.2.2`.

## 7.1.0-rc.0 (2020-06-24)

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"babel-eslint": "^10.1.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-jest": "^23.8.2",
"eslint-plugin-jsdoc": "^26.0.0",
"eslint-plugin-jsdoc": "^30.2.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.20.0",
Expand Down
2 changes: 0 additions & 2 deletions packages/icons/src/icon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
import { cloneElement } from '@wordpress/element';

// Disable reason: JSDoc linter doesn't seem to parse the union (`&`) correctly.
/* eslint-disable jsdoc/valid-types */
/** @typedef {{icon: JSX.Element, size?: number} & import('react').ComponentPropsWithoutRef<'SVG'>} IconProps */
/* eslint-enable jsdoc/valid-types */

/**
* Return an SVG icon.
Expand Down
5 changes: 5 additions & 0 deletions packages/is-shallow-equal/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
"env": {
"node": true
},
"settings": {
"jsdoc": {
"mode": "typescript"
}
},
"overrides": [
{
"files": [ "@(test|benchmark)/*.js" ],
Expand Down
2 changes: 0 additions & 2 deletions packages/prettier-config/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
// Disable reason: The current JSDoc tooling does not yet understand TypeScript
// union types.

/* eslint-disable jsdoc/valid-types */
/** @type {PrettierOptions & WPPrettierOptions} */
/* eslint-enable jsdoc/valid-types */
const config = {
useTabs: true,
tabWidth: 4,
Expand Down
3 changes: 0 additions & 3 deletions packages/primitives/src/svg/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import classnames from 'classnames';
*/
import { createElement } from '@wordpress/element';

// Disable reason: JSDoc linter doesn't seem to parse the union (`&`) correctly.
/* eslint-disable jsdoc/valid-types */
/** @typedef {{isPressed?: boolean} & import('react').ComponentPropsWithoutRef<'svg'>} SVGProps */
/* eslint-enable jsdoc/valid-types */

/**
* @param {import('react').ComponentPropsWithoutRef<'circle'>} props
Expand Down
2 changes: 0 additions & 2 deletions packages/priority-queue/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,12 @@ export const createQueue = () => {

let isRunning = false;

/* eslint-disable jsdoc/valid-types */
/**
* Callback to process as much queue as time permits.
*
* @param {IdleDeadline|number} deadline Idle callback deadline object, or
* animation frame timestamp.
*/
/* eslint-enable */
const runWaitingList = ( deadline ) => {
const hasTimeRemaining =
typeof deadline === 'number'
Expand Down

0 comments on commit 375eaa0

Please sign in to comment.