Add ESLint rule blocking Node built-in imports in core/#2229
Open
rafal-hawrylak wants to merge 1 commit into
Open
Add ESLint rule blocking Node built-in imports in core/#2229rafal-hawrylak wants to merge 1 commit into
rafal-hawrylak wants to merge 1 commit into
Conversation
Files under core/ run inside a V8 compilation sandbox on GCP that does
not provide Node.js built-in modules. Nothing at PR time currently
enforces this - a top-level `import * as nodePath from "path"` added to
core/session.ts in 3.0.53 broke every cloud compilation for ~7 days.
Adds a custom ESLint rule `no-node-builtins` that fails on any import
of a Node built-in under core/**/*.ts. The blocklist is derived at rule
load time from `require('module').builtinModules`, covering both bare
(`path`) and prefixed (`node:path`) forms, so future Node built-ins
are caught automatically. Files matching core/**/*_test.ts are excluded
via ESLint `overrides` since tests run on the host Node runtime.
Wires eslint into scripts/run_tests alongside the existing tslint
check, so PR CI blocks the regression class at merge time. tslint
remains authoritative for the rest of the repo.
rafal-hawrylak
force-pushed
the
add-eslint-no-node-builtins
branch
from
July 22, 2026 11:46
147f596 to
2cd7ce9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Files under core/ run inside a V8 compilation sandbox on GCP that does not provide Node.js built-in modules. Nothing at PR time currently enforces this - a top-level
import * as nodePath from "path"added to core/session.ts in 3.0.53 broke every cloud compilation for ~7 days.Adds a custom ESLint rule
no-node-builtinsthat fails on any import of a Node built-in under core//*.ts. The blocklist is derived at rule load time fromrequire('module').builtinModules, covering both bare (path) and prefixed (node:path) forms, so future Node built-ins are caught automatically. Files matching core//*_test.ts are excluded via ESLintoverridessince tests run on the host Node runtime.Wires eslint into scripts/run_tests alongside the existing tslint check, so PR CI blocks the regression class at merge time. tslint remains authoritative for the rest of the repo.