Skip to content

fix: import built helper instead of src/ in tsRewriteRelativeImportExtensions test - #18211

Merged
JLHwung merged 3 commits into
babel:mainfrom
joellemd:fix-lint-src-import
Aug 30, 2026
Merged

JLHwung merged 3 commits into
babel:mainfrom
joellemd:fix-lint-src-import

Conversation

@joellemd

@joellemd joellemd commented Aug 28, 2026 •

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

packages/babel-helpers/test/unittests/tsRewriteRelativeImportExtensions.js imports its subject directly from ../../src/helpers/..., which trips the no-restricted-imports ESLint rule (patterns: ["**/src/**"]) for test files. This is currently breaking the Lint and Lint (Babel 9) CI jobs on main.

This import is actually necessary: packages/babel-helpers/src/helpers/tsconfig.json sets noEmit: true, so these helper sources are only type-checked, never compiled to lib/, and there's no built equivalent for the test to import instead. Scoped an ESLint exception to packages/babel-helpers/test/unittests/ rather than changing the import (an earlier version of this PR tried switching to a lib/ import, which fails in CI with import/no-unresolved for the same reason).

Verified eslint passes on the whole babel-helpers package and the existing 68 test cases still pass.

@github-actions

Copy link
Copy Markdown

⚠️ Mixed activity

Activity patterns show a mix of organic and automated signals.

View full analysis →

This is an automated analysis by AgentScan

@babel-bot

babel-bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Collaborator

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

Test files must not import from src/ per the no-restricted-imports
rule, but this one legitimately needs to: the helpers/ tsconfig only
type-checks (noEmit), so there's no compiled lib/helpers/*.js to
import instead. Scope an exception to packages/babel-helpers/test/
unittests/ rather than testing against src directly.
@joellemd
joellemd force-pushed the fix-lint-src-import branch from 75a0319 to 8f16fb8 Compare August 28, 2026 20:37
@pkg-pr-new

pkg-pr-new Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

commit: cfa405a

@liuxingbaoyu liuxingbaoyu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! I think it's sufficient to simply disable this rule in the target line.

@joellemd

Copy link
Copy Markdown
Contributor Author

Alright @liuxingbaoyu! Thanks for the suggestion. It looks like all checks are passed, feel free to merge!

@JLHwung
JLHwung merged commit 2b42cac into babel:main Aug 30, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants