Repository navigation
Use specific JSDoc types to fix ESLint warnings - #2778
Open
mukeshpanchal27 wants to merge 2 commits into
Open
mukeshpanchal27 wants to merge 2 commits into
mukeshpanchal27 wants to merge 2 commits into
Conversation
Replace `any`, `*` and `Function` with specific types, and add the missing `@throws` type. This removes all 19 warnings that the JS Lint job reports. The specific types surfaced gaps that `any` was hiding. A `WebpackEnv` typedef now declares the `plugin`, `zip` and `force` properties, and a `ViewTransitionEntry` typedef describes each view transition entry. Fixes #2777 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mukeshpanchal27
requested review from
thelovekesh and
westonruter
as code owners
December 2, 2026 05:11
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Member
|
I'll take a look in a couple weeks, at the earliest. |
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2777
This PR removes all 19 ESLint warnings that the JS Lint job reports on trunk. It replaces
any,*andFunctionwith specific JSDoc types, and adds the missing@throwstype.Relevant technical choices
bin/plugin/cli.js:catchExceptionis now a generic function with a docblock. Each command handler keeps its own parameter types.unknown[]alone does not work here, because TypeScript checks function parameters strictly.webpack.config.js: A newWebpackEnvtypedef declares theplugin,zipandforceproperties.buildPluginalready readzipandforce, but no type declared them.buildPluginnow stores the plugin slug in apluginvariable after its check, so the type staysstringinside the webpack hook callbacks.plugins/view-transitions/js/view-transitions.js: A newViewTransitionEntrytypedef describes each entry as an element and its view transition name. It replaces "an array of anything".plugins/optimization-detective/detect.js: The logger now usesunknowninstead ofanyand*.recursiveFreeze()takes anObjectand casts it only to read a property.bin/plugin/commands/versions.js:@throws Erroris now@throws {Error}.Only JSDoc and type annotations change in the plugin files, so plugin behavior stays the same. The
webpack.config.jschange affects only the build.Testing
npx eslint .reports no problems. Before this PR, it reported 19 warnings.npm run tscpasses.npm run buildandnpm run build:plugin:view-transitionssucceed.node bin/plugin/cli.js versions --plugin=auto-sizesstill reports the version.Use of AI Tools
I used Claude Code to find the warnings, write the fix, and draft this description. I reviewed the changes and the test results.
🤖 Generated with Claude Code