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

Fix import with wrong extension #15952

Merged
merged 5 commits into from Sep 12, 2023
Merged

Conversation

nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Sep 11, 2023

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

This is a .js file. It's unfortunate that neither ESLint's import plugin neither TS complain.

@babel-bot
Copy link
Collaborator

babel-bot commented Sep 11, 2023

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

Copy link
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import/no-unresolved rule is disabled by default, since it requires a custom import resolver, so the eslint-plugin-import can't do much here. We can create own own rule just to disable vendor/**/*.ts imports. I think tsc should have warned though, at least for non-type imports.

@nicolo-ribaudo
Copy link
Member Author

nicolo-ribaudo commented Sep 12, 2023

@JLHwung Now that we use paths with the full extension, import/no-unresolved works without a custom resolver :) It properly complain if I use the .ts extension here, while accepting .js.

@JLHwung
Copy link
Contributor

JLHwung commented Sep 12, 2023

Well it seems that it can't resolve relative path without further config.

@nicolo-ribaudo
Copy link
Member Author

The problem is that file is auto-generated by make build, but CI artifacts do not contain auto-generated files from the src folder. It's just a special case, and the rule is working everywhere else 😬

@JLHwung
Copy link
Contributor

JLHwung commented Sep 12, 2023

The problem is that file is auto-generated by make build, but CI artifacts do not contain auto-generated files from the src folder. It's just a special case, and the rule is working everywhere else 😬

👍 In that case we should add it to the artifacts:

https://github.com/babel/babel/blob/56713333bea8eae3ed022aba93a6b0541dab4c0c/scripts/get-artifact-files.sh

@nicolo-ribaudo nicolo-ribaudo changed the title Fix import Fix import with wrong extension Sep 12, 2023
@nicolo-ribaudo nicolo-ribaudo merged commit 04a4ee3 into babel:main Sep 12, 2023
48 checks passed
@nicolo-ribaudo nicolo-ribaudo deleted the fix-import branch September 12, 2023 14:13
@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 Dec 13, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants