Skip to content
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

Scripts: wp-scripts lint-js Breaks After v16.1.4 #34297

Closed
2 tasks done
porada opened this issue Aug 25, 2021 · 4 comments · Fixed by #34338
Closed
2 tasks done

Scripts: wp-scripts lint-js Breaks After v16.1.4 #34297

porada opened this issue Aug 25, 2021 · 4 comments · Fixed by #34338
Assignees
Labels
[Package] ESLint plugin /packages/eslint-plugin [Package] Scripts /packages/scripts [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@porada
Copy link

porada commented Aug 25, 2021

Description

After updating @wordpress/scripts from 16.1.4 to 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

No response

Environment info

$ 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.

Pre-checks

  • I have searched the existing issues.
  • I have tested with all plugins deactivated except Gutenberg.
@porada
Copy link
Author

porada commented Aug 25, 2021

@renatho — I can see you worked on #25300, which could be related to this issue. Any chance you could take a look?

@porada
Copy link
Author

porada commented Aug 25, 2021

Referencing eslint-plugin-jsdoc directly in the project’s package.json seems to be resolving the issue. It’s not ideal, though.

@ramonjd ramonjd added [Package] ESLint plugin /packages/eslint-plugin [Package] Scripts /packages/scripts [Type] Bug An existing feature does not function as intended labels Aug 26, 2021
@renatho
Copy link
Contributor

renatho commented Aug 26, 2021

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.

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Aug 26, 2021
@porada
Copy link
Author

porada commented Aug 30, 2021

Thanks for handling this, @renatho!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] ESLint plugin /packages/eslint-plugin [Package] Scripts /packages/scripts [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants