#65939 closed defect (bug) (fixed)
JSDoc ESLint script fails after ESLint upgrade to version 10
| Reported by: | afercia | Owned by: | afercia |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2 |
| Component: | Build/Test Tools | Version: | 7.1 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | javascript |
Description
The JSDoc ESLint script was added 6 years ago in [48650], see #43828, to check the JSDocs conformity with the WordPress JavaScript Docs Coding Standards.
For clarity, it's a tool that only checks the docblocks of the JS files.
It relies on @wordpress/scripts, which is maintained in the Gutenberg repository.
On April 2026, the ESLint version used in @wordpress/scripts was upgraded to version 10, see https://github.com/WordPress/gutenberg/pull/76654.
ESLint v10 requires a different configuration format. The related scripts in Gutenberg were updated accordingly. The Core lint:jsdoc wasn't.
It's interesting that no one noticed this breakage in Core in 5 months, which makes me think lint:jsdoc isn't widely used. The lack of process and coordination between Gutenberg and Core concerns me as well.
Regardless, the config for lint:jsdoc should be updated and use the minimal rules that were used in Core, which are very different from the ones used in Gutenberg.
I already started a PR, will submit soon.
To reproduce:
- On a
wordpress-developinstall: - From the terminal, run
npm installto make sure you have everything you need to run the script. - Then run
npm run lint:jsdoc - Observe the script triggers the following warning and then hangs indefinitely:
ESLintIgnoreWarning: The ".eslintignore" file is no longer supported. Switch to using the "ignores" property in "eslint.config.js": https://eslint.org/docs/latest/use/configure/migration-guide#ignore-files (Use `node --trace-warnings ...` to show where the warning was created)
Change History (31)
This ticket was mentioned in PR #13237 on WordPress/wordpress-develop by @afercia.
3 months ago
#1
- Keywords has-patch added
@afercia commented on PR #13237:
3 months ago
#2
Note, for history: the lint:jsdoc script in Core broke when the ESLint version used in @wordpress/scripts was upgraded to version 10. in the Gutenberg repository.
@afercia commented on PR #13237:
2 months ago
#3
The current green checks do not exercise the behavior changed here. The JavaScript coding-standards workflow runs npm run grunt jshint, not npm run lint:jsdoc so CI can stay green if the command hangs, loads the wrong config, accepts legacy-invalid JSDoc, or fixes unrelated directives.
Could we add a small fixture-based check ...
The scope of this PR is not to add new things.
It's to restore the original beheavior, although limited. Please let's keep things separated.
Re: the other considerations, I'm not sure what you are comparing to. Comapring against the Gutenberg current config is not in the scope of this PR. As I mentioned in the description, the existing Core ruleset is minimal. Can you please expand on the reasoning you used in your comparison?
reports five eslint-env errors and three unused-disable warnings outside JSDoc.
Yes, because in ESLint 10 they are invalid. No matter whether this config is meant for JSDocs, they will be considered errors.
@afercia commented on PR #13237:
2 months ago
#4
The following is the current, minimal, configuration for JSDoc in Core. We only need to restore an equivalent behavior and not add anything else. Further improvements are welcome but they should not be part of this PR.
As you did, yesterday I did trigger an AI-assisted code review to confirm the new ruleset is equivalent to the new one. Results:
# ESLint JSDoc Configuration Migration - Validation Summary
## Question
Do the number and type of problems reported with the old ruleset (ESLint 9 + valid-jsdoc) match exactly the ones with the new ruleset (ESLint 10 + eslint-plugin-jsdoc)?
## Answer
✅ YES - The core JSDoc violations match exactly (32 parameter validation errors)
---
## Detailed Comparison
### Violation Breakdown
| Category | Count | Rule | Status |
|---|---|---|---|
| Parameter validation | 32 errors | jsdoc/check-param-names | ✅ EXACT MATCH |
| Deprecated syntax | 5 errors | eslint-env | 🆕 NEW (ESLint 10) |
| Unused directives | 3 warnings | unused-directive | 🆕 NEW (ESLint 10) |
| TOTAL | 40 problems | — | — |
### Core JSDoc Violations (32 errors) - EXACT MATCH
Old config (ESLint 9):
'valid-jsdoc': [ 'error', { requireParamDescription: false, requireReturn: false, // ... other settings } ]
New config (ESLint 10):
'jsdoc/check-param-names': 'error'
Violations caught (identical in both):
- ✓ Parameter name mismatches:
@param "x"when function parameter is"y" - ✓ Duplicate parameters:
@param "foo"appears twice - ✓ Missing parameters:
@param "el"but no such function parameter - ✓ Parameter order issues: Documentation appears before actual parameters
Examples:
Expected @param names to be "event". Got "e"
Duplicate @param "object"
@param "el" does not match an existing function parameter
@param path declaration ("date.") appears before any real parameter
---
## Type & Tag Preference Handling
### Original Config Differences
The original config had type and tag preference settings:
prefer: { returns: 'return', // @returns → @return // ... other tag mappings }, preferType: { object: 'Object', // object → Object bool: 'boolean', // bool → boolean // ... other type mappings }
### Why These Are NOT Enforced in New Config
- Inverted Plugin Logic: eslint-plugin-jsdoc's
check-typesrule has opposite preference behavior- Original: prefers
Objectoverobject - Plugin: would prefer
objectoverObject(backward)
- Original: prefers
- Prevented False Positives:
- Enabling strict type checking: ~8,000 additional problems
- Enabling strict tag checking: ~1,600 additional problems
- Original Intent Preserved:
- Original config had
requireParamDescription: false(minimal enforcement) - New config: exempts type checking via
exemptTagContexts - Result: Matches original intent without false positives
- Original config had
---
## Validation Results
### ✅ PARAMETERS (100% Equivalent)
- Parameter validation: Identical behavior
- Same violations detected
- No regression
### ⚠️ TYPES (Intentionally Different)
- Original: Would enforce
object→Object - New: Exempts type preferences (to avoid ~8,000 false positives)
- Impact: ZERO false positives instead of thousands
### ⚠️ TAGS (Intentionally Different)
- Original: Would enforce
@returns→@return - New:
check-tag-namesdisabled (plugin enforces opposite) - Impact: ZERO false positives instead of ~1,600
### 🆕 NEW ISSUES (Modern ESLint)
- 5
eslint-envcomments flagged as deprecated - 3
unused-directivecomments flagged as not needed - These are ESLint v10 features, not JSDoc validation
---
## Conclusion
Core Verdict: ✅ SUCCESSFULLY MIGRATED
The new ESLint 10 configuration successfully replicates the core parameter validation behavior of the original ESLint 9 valid-jsdoc rule, reporting the exact same 32 JSDoc violations.
The type and tag preference differences are intentional optimizations that:
- Avoid thousands of false positives
- Preserve the spirit of the original minimal enforcement
- Improve code quality without strict enforcement that contradicts the plugin's design
Status: PRODUCTION READY ✅
---
Generated: 2026-08-22
@mciampini commented on PR #13237:
2 months ago
#5
We only need to restore an equivalent behavior and not add anything else.
Agreed. However, the validation summary itself says that types and tags are “intentionally different.” Matching the 32 parameter errors currently present in Core only proves parity for parameter names; it does not prove that the rulesets are equivalent.
My comparison used a small fixture against the previous Core config and this PR's config. It exercised the existing prefer and preferType options and produced six errors before and none after.
eslint-plugin-jsdoc's
check-typesrule has opposite preference behavior
The plugin supports custom preferences through settings.jsdoc.preferredTypes and tagNamePreference. I referenced Gutenberg only as an example of that supported ESLint 10 configuration, not as the ruleset Core should adopt.
These are ESLint v10 features, not JSDoc validation.
Right, which is why the dedicated JSDoc command should not process them. More importantly, lint:jsdoc:fix removes unrelated complexity suppression comments. That behavior still needs to be prevented.
@afercia commented on PR #13237:
2 months ago
#6
More importantly, lint:jsdoc:fix removes unrelated complexity suppression comments. That behavior still needs to be prevented.
In https://github.com/WordPress/wordpress-develop/pull/13251 which is the PR where I'm actually fixing the JSDoc errors after the lint script is fixed, I'm manually removing those complexity disable comments. They should not be preserved simply because there is no ESLint config in core that checks for that.
Same goes for eslint-disable and eslint-enable comments outside of JS docblocks. They are useless.
It exercised the existing prefer and preferType options and produced six errors before and none after.
Yes we may need to double check that.
@mciampini commented on PR #13237:
2 months ago
#7
Thanks, that makes sense regarding the unused inline directives and PR #13251.
My remaining concern is the prefer/preferType parity. Happy to recheck once that is updated.
@afercia commented on PR #13237:
2 months ago
#8
OK, I switched back to 7.0.0, reinstalled all the packages so to use eslint@8.57.1, enabled env to es6 and run:
npx eslint "src/**/*.js" --config .eslintrc-jsdoc.js --ignore-path .eslintignore
It reports more than 300 valid-jsdoc errors. Bummer.
@afercia commented on PR #13237:
2 months ago
#9
With latest commit, it's a little better but there's still work to do.
@afercia commented on PR #13237:
2 months ago
#10
To my understanding:
The JSDoc script configuration was a work in progress, just a minimal configuration in the context of the JavaScript Inline Docs Initiative that ran on 2018-2019. Some contributors dedicated a significant amount of time to document as much as possible of the Core JS.
It appears the initiative stalled at some point. The progress was tracked on Make splitting the files in 3 groups:
Many things have changed in the meantime including new files and locations. Regardless, there are still many files that need to be worked on. That is out of the scope of this PR. Basically, the old JSDoc script configuration wasn't built to cover the entirety of the JavaScript Documentation Standards. It was only a first, minimal configuration.
Personally, I would be OK with having the new configuration replicate the old one _as much as possible_. It was already incomplete anyways.
The most important thing is that running the autofixer npm run lint:jsdoc:fix doesn't introduce weird, unwanted changes. With the last commits in place, it seems to me the fixes are pretty clean.
@mciampini commented on PR #13237:
2 months ago
#11
Definitely getting closer! The explicit tag and type preferences are now restored, and I agree not to revisit the unrelated inline directives.
I still do not think this is ready, because the old behavior is not yet preserved. Here are some major points that we should still address, IMO:
require-param-typeis enabled and then disabled later in the same config.require-returnsandrequire-returns-typealso remain off. A fixture that the old config rejects for a missing parameter type, return type, and@returnpasses with this head.require-returns-checkchecks the opposite direction, so it does not replace those rules.FunctionExpression:not(:has(Identifier[name='$']))skips any function expression that uses$anywhere, not only a wrapper whose parameter is$. The old config still checks those functions.lint:jsdoc:fixturns@arg {int} valueinto two@paramentries and leaves a duplicate-parameter error. The old fixer produces one valid@param {number} value.check-tag-namesalso applies plugin-default migrations such as@var→@memberand@constructor→@class, which were not part of Core’s old configuration.
Could we remove the redundant list of disabled rules, keep the required type/return rules enabled, narrow the $ exception and tag preferences, and add one old/new fixture covering both linting and fixing?
@afercia commented on PR #13237:
2 months ago
#12
require-param-type is enabled and then disabled later in the same config.
This was a typo and it's now fixed.
FunctionExpression:not(:has(Identifier[name='$'])) skips any function expression that uses $ anywhere, not only a wrapper whose parameter is $. The old config still checks those functions.
The problem in Core is that it extensively uses IIFEs that pass the jQuery object e.g.:
`( function( $ ) {
...
`
That will trigger an error. Maybe we can fix it by just documenting the param before any IIFE e.g.
/**
* @param {jQuery} $ jQuery object.
*/
If you think that's acceptable, I can try it.
lint:jsdoc:fix turns @arg {int} value into two @param entries and leaves a duplicate-parameter error. The old fixer produces one valid @param {number} value.
I can't reproduce it.
check-tag-names also applies plugin-default migrations such as @var → @member and @constructor → @class, which were not part of Core’s old configuration.
@var is explicitly mentioned in the WordPress JD Docs coding standards as unsupported tag:
https://developer.wordpress.org/coding-standards/inline-documentation-standards/javascript/#unsupported-jsdoc-tags
Same for: @constructor | An unsupported synonym. Use @class instead.
I suggest to look not only into the old configuration but also check carefully the JavaScript Documentation Standards
there is a version on GitHub that is more readable than the one on .org.
@afercia commented on PR #13237:
2 months ago
#13
add one old/new fixture covering both linting and fixing?
Out of the scope of this PR. Further improvements are very welcome, in separate Trac tickets and PRs, please.
@mciampini commented on PR #13237:
2 months ago
#14
Thanks again. I took a new look
This was a typo and it's now fixed.
Confirmed. The duplicate require-param-type setting is fixed 👌
Maybe we can fix it by just documenting the param before any IIFE
That is acceptable, but the selector still needs to change. :has(Identifier[name='$']) matches $ anywhere inside a function—not only as its parameter. The old config checks function( value ) { $( value ); }; the new config skips it.
I can't reproduce it.
I can reproduce it with ESLint 10.7.0 and eslint-plugin-jsdoc 50.8.0:
/** * @arg {int} value Value. */ function example( value ) {}
The old fixer produces one valid @param {number} value. The new fixer adds a bare @param value and converts the original tag, leaving duplicate parameters and a missing-type error. This also happens in Core’s quicktags.js.
Setting enableFixer: false on require-param appears to preserve the old behavior while letting the tag and type fixers work correctly.
@varis explicitly mentioned in the WordPress JS Docs coding standards as unsupported
Good point, and the same applies to @constructor and the other standard tag aliases. Feel free to ignore that review comment.
Two legacy checks are still missing:
require-returnsandrequire-returns-typeremain disabled. The old config rejects a returning function without@return, or an@returnwithout a type; this head accepts both.@param {Object.<} valueproduces a syntax error under the old config but passes here becausevalid-typesis disabled.
Out of the scope of this PR.
I agree that fixing the existing JSDoc violations belongs in a separate PR. However, a small parity fixture only verifies this PR’s stated goal of restoring the old behavior. Especially since current CI cannot provide that evidence because it runs JSHint, not lint:jsdoc or lint:jsdoc:fix.
@afercia commented on PR #13237:
2 months ago
#15
Especially since current CI cannot provide that evidence because it runs JSHint, not
lint:jsdocor lint:jsdoc:fix.
The plan is to add a grunt task for the precommit:js so that lint:jsdoc runs on CI.
Feel free to add a commit to add the fixture if you like. However, please consider that re-enabling rules will add many many new violations that will need to be fixed in https://github.com/WordPress/wordpress-develop/pull/13251. The ongoing effort there is becoming unsustainable and it's already a large PR.
As I said when rebuilding the history of the previous valid-jsdoc, that was added in the context of the JavaScript Inline Docs Initiative that ran on 2018-2019. The initiative then stalled. It was by no means a 'complete' configuration to cover _all_ the JS DOcs coding standards. It was just a minimal, initial, configuration. I suggest that the new configuration does not need to 100% replicate the old one. Even if it does, it wouldn't cover all the coding standards.
For now, I would suggest to focus on the main goal:
- get to a config that is reasonable
- fix all the reported violations
- merge the fixed violations
- merge the config + a grunt task to make it run on CI
@afercia commented on PR #13237:
2 months ago
#16
I can reproduce it with ESLint 10.7.0 and
eslint-plugin-jsdoc50.8.0:
/** * @arg {int} value Value. */ function example( value ) {}
To clarify: is your example purely theoretical and only included in your fixture? I can't find any occurrence of @arg {int} in Core.
@afercia commented on PR #13237:
2 months ago
#17
Disabled the autofixer for jsdoc/require-param in https://github.com/WordPress/wordpress-develop/pull/13237/changes/5372965144a37a9644df7a3ff4e622a1cea6941a
@mciampini commented on PR #13237:
2 months ago
#18
Agreed, this sounds like a reasonable path.
The new configuration does not need to 100% replicate the old one.
Agreed. Given the history and the size of #13251, I would not re-enable the omitted return/type rules here. I would only reword “match” or “replicate” in the PR and config comments to describe this as a reduced ruleset based on the old configuration. The fixture can also be follow-up work.
Is your example purely theoretical?
Yes, the exact @arg {int} example was synthetic, and there are no current occurrences. It isolated the interaction between the fixers. I confirmed that disabling the require-param fixer resolves it, so that concern is addressed.
The plan is to add a grunt task for
precommit:js
Agreed with the proposed sequence: settle the config, fix the reported violations, then run lint:jsdoc in CI. That CI task is the only remaining functional item I see.
@afercia commented on PR #13237:
2 months ago
#19
@param {Object.<} value produces a syntax error under the old config but passes here because valid-types is disabled.
I'm not sure it's related to valid-types. Rather, I think it's check-syntax ?
@afercia commented on PR #13237:
2 months ago
#20
Latest commit enables the following rules:
'jsdoc/require-returns': 'error', 'jsdoc/require-returns-type': 'error', 'jsdoc/check-syntax': 'error',
all the defaults are removed.
This will add 78 new errors to https://github.com/WordPress/wordpress-develop/pull/13251 that need to be fixed manually.
@mciampini commented on PR #13237:
2 months ago
#21
greed with the proposed sequence: settle the config, fix the reported violations, then run
lint:jsdocin CI. That CI task is the only remaining functional item I see.
I double-checked with the versions used in this PR (eslint@10.7.0 and eslint-plugin-jsdoc@50.8.0). This case is handled by valid-types, not check-syntax.
Whether to enable valid-types in this PR is a separate scope decision
@mciampini commented on PR #13237:
2 months ago
#22
Latest commit enables the following rules:
This addresses the earlier missing return rules and helps settle the configuration.
One last remaining CI item: the current head still does not add lint:jsdoc to precommit:js, and the JavaScript workflow still runs only npm run grunt jshint.
Once #13251 fixes the resulting violations, the planned CI wiring remains the last functional step I see.
@afercia commented on PR #13237:
2 months ago
#23
One last remaining CI item: the current head still does not add lint:jsdoc to precommit:js, and the JavaScript workflow still runs only npm run grunt jshint.
Yes, correct. That will need to be done separately.
@afercia commented on PR #13237:
2 months ago
#24
Thanks for all your feedback and suggestions @ciampo. I'm going to merge this as agreed.
@afercia commented on PR #13237:
2 months ago
#25
Just a final note about all those eslint-env comments.
One of was added to solve a problem with the IDE used by the PR contributors. More ones were added for example here, here, and here to allow the usage of modern JS features like the optional chaining operator or things like startsWith. That is: to not make the IDE complain about them. Again, to my knowledge, there is no script in Core that uses ESLint outside of JSDoc.
Later on April 2026, the ESLint version in the @wordpress/scripts package (and across all Gutenberg) was upgraded from ^8.57.1 to ^10.0.0 so any IDE should not complain any longer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Trac ticket: https://core.trac.wordpress.org/ticket/65939
## Use of AI Tools
npm install && npm run lint:jsdocImportant: compare the new ruleset with the previous one. The Core ruleset is minimal and only checks a very few rules while the one in Gutenberg checks for way more ones. For now, I tried to replicate the 'minimal' configuration that was used in Core.
AI assistance: Yes
Tool(s): GitHub Copilot
Model(s): Claude Haiku 4.5
Used for: Configuration of the rules to match the previous ones. Final implementation was reviewed by me.