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

Change babel/eslint-parser's inclusion of eslint-scope to be compatible with ESlint #13058

Merged
merged 1 commit into from
Mar 26, 2021

Conversation

Standard8
Copy link
Contributor

Q                       A
Fixed Issues?
Patch: Bug Fix? Y
Major: Breaking Change? N
Minor: New Feature? N
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes? Yes
License MIT

eslint-scope is included as a dependency within @babel/eslint-parser using exact matching, i.e. only 5.1.0.

However since before ESLint version 7.5.0, ESLint has specified eslint-scope as ^5.1.0, and in more recent versions it is ^5.1.1. This means multiple versions can end up in the node dependency tree for those using ESLint with Babel, potentially causing conflicts or other issues.

This PR updates the dependency to match that of ESLint, so that the dependency tree for projects will only have one version of eslint-scope.

@babel-bot
Copy link
Collaborator

babel-bot commented Mar 26, 2021

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/44778/

@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 26, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 5d6f7a5:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@nicolo-ribaudo
Copy link
Member

@arcanis Would something like require(require.resolve("eslint-scope", { paths: [require.resolve("eslint")] }) work? So that we can directly require ESLint's dependency without relying on deduplication.

@arcanis
Copy link
Contributor

arcanis commented Mar 26, 2021

I don't remember if paths should be file or folder, but that should be fine either way. Another option is:

const {createRequire} = require(`module`);

const eslintReq = createRequire(require.resolve(`eslint`));
const eslintScope = eslintReq(`eslint-scope`);

@JLHwung
Copy link
Contributor

JLHwung commented Mar 26, 2021

In babel/babel-eslint#794 (comment) the maintainer of ESLint @mysticatea recommend @babel/eslint to depend on own eslint-scope. I think we should just use ^5.1.0 and do a major bump when eslint or eslint-scope is bumped.

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Mar 26, 2021

Thanks @JLHwung for linking that comment 👍

(@arcanis sorry if I pinged you out of the blue, I was worrying about PnP and completely forgot to mention it 😅)

@nicolo-ribaudo nicolo-ribaudo merged commit e5e37b9 into babel:main Mar 26, 2021
@merceyz
Copy link
Contributor

merceyz commented Mar 27, 2021

I was worrying about PnP

PnP is perfectly fine with that snippet, it's basically what babel does already to load plugins and presets

@nicolo-ribaudo
Copy link
Member

Right, I didn't think about that!

@Standard8 Standard8 deleted the eslint-scope branch March 28, 2021 09:06
@Standard8
Copy link
Contributor Author

Thank you for the approvals & merge.

@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jun 28, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: eslint outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Dependency ⬆️
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants