Scripts: `wp-scripts lint-js` Breaks After v16.1.4 - gutenberg
17.0.0 or higher (currently at
18.0.0), the JS linter breaks with the following result:
$ wp-scripts lint-js Oops! Something went wrong! :( ESLint: 7.32.0 Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/parser/tokenizers/description.js' is not defined by "exports" in /Users/dom/Projects/wp-scripts-lint-js-test-repo/node_modules/@es-joy/jsdoccomment/node_modules/comment-parser/package.json at throwExportsNotFound (internal/modules/esm/resolve.js:290:9) at packageExportsResolve (internal/modules/esm/resolve.js:513:3) at resolveExports (internal/modules/cjs/loader.js:437:36) at Function.Module._findPath (internal/modules/cjs/loader.js:477:31) at Function.Module._resolveFilename (internal/modules/cjs/loader.js:872:27) at Function.Module._load (internal/modules/cjs/loader.js:730:27) at Module.require (internal/modules/cjs/loader.js:957:19) at require (/Users/dom/Projects/wp-scripts-lint-js-test-repo/node_modules/v8-compile-cache/v8-compile-cache.js:159:20) at Object.<anonymous> (/Users/dom/Projects/wp-scripts-lint-js-test-repo/node_modules/@es-joy/jsdoccomment/dist/index.cjs.cjs:7:28) at Module._compile (/Users/dom/Projects/wp-scripts-lint-js-test-repo/node_modules/v8-compile-cache/v8-compile-cache.js:192:30) error Command failed with exit code 2. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Upon initial investigation, I think the
@wordpress/eslint-plugin/jsdoc preset may be causing this issue. It’s a part of
@wordpress/eslint-plugin/recommended used by default in
@wordpress/scripts’ ESLint config.
Step-by-step reproduction instructions
Clone the test repository, then run:
yarn yarn format # works fine yarn lint:js # will break
Screenshots, screen recording, code snippet
$ node -v v14.17.0 $ cat package.json | grep @wordpress/scripts "@wordpress/scripts": "18.0.0",
Gutenberg not installed.
The test repository also includes
eslint-plugin-import, but that’s primarily to keep the project config as identical to the project config as possible.
- [X] I have searched the existing issues.
- [X] I have tested with all plugins deactivated except Gutenberg.
@renatho — I can see you worked on #25300, which could be related to this issue. Any chance you could take a look?
eslint-plugin-jsdoc directly in the project’s
package.json seems to be resolving the issue. It’s not ideal, though.
It seems there was an issue related to some version mismatch. In older versions, it was getting that tokenizer dependency like this: https://github.com/es-joy/jsdoccomment/blob/v0.6.0/src/parseComment.js#L8
Now it's getting the exported dependency from the package: https://github.com/es-joy/jsdoccomment/blob/main/src/parseComment.js#L6
I believe just updating the
eslint-plugin-jsdoc in Gutenberg should fix that.
- gocql Directly scanning into a struct pointer Go
- Access snapshot cache - turbo
- verona Syntax highlighting C++
- Oops! There was a problem during set up. Please try again. Unknown Error (code: cURL error 28: Failed to connect to sitekit.withgoogle.com port 443: Connection timed out). - site-kit-wp
- [dotnet/csharplang] await should not capture SynchronizationContext by default - Csharp
- ExoPlayer EventMessageEncoder encoding wrong duration - Java
- Add logins support for scrubbing encrypted data - Rust uniffi-rs