feat: internal Rust napi parser + merge eslint-plugin-runner into @rslint/core#1035
Open
fansenze wants to merge 4 commits into
Open
feat: internal Rust napi parser + merge eslint-plugin-runner into @rslint/core#1035fansenze wants to merge 4 commits into
fansenze wants to merge 4 commits into
Conversation
Add an internal Rust NAPI crate that parses JS/TS/JSX into ESTree JSON + ESLint-shape comments (UTF-16 offsets), and switch the runtime's parse path from the npm parser to it. - the crate: parse() with Rust-side lang derivation, recovering semantics, a source-size guard, and catch_unwind on the #[napi] boundary. - ecma-language-plugin: parseSync -> native parse; lang derivation moved Rust-side. - normalize-ast: rebuild RegExp/BigInt Literal.value (JSON transfer cannot carry them). - rust-toolchain pinned; generated .node/index.js are gitignored. The full runtime suite passes. The tokenizer is still the JS implementation at this point; replacing it with Rust is the next milestone.
Contributor
There was a problem hiding this comment.
Code Review
This pull request replaces the hand-written JS tokenizer and the npm oxc-parser dependency with a new native Rust napi crate, crates/rslint-estree, which leverages oxc's parser-driven token stream. The former @rslint/eslint-plugin-runner package is merged directly into @rslint/core under packages/rslint/src/eslint-plugin. On the JS side, SourceCode now lazily rebuilds the token array from the columnar data sent from Rust. The review feedback highlights a bug in the language promotion logic where TypeScript definition files (.d.ts) are incorrectly promoted to .tsx when JSX is enabled, and suggests guarding against this by checking !st.is_typescript_definition().
31f590a to
f32a009
Compare
25c1c48 to
a157695
Compare
- migrate runner (24 src + 491 tests) into src/eslint-plugin & tests/eslint-plugin - hybrid build: tsgo library surface + rslib worker sub-build into dist/eslint-plugin/ - publish the napi parser as @rslint/toolkit + per-platform subpackages; @rslint/core depends on it at runtime and loads the .node via the napi default loader - napi targets 3->8 + release CI matrix - remove @rslint/eslint-plugin-runner package
a157695 to
325088b
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.
Summary
Replaces
eslint-plugin-runner's npm parser + 2138-line hand-written JS tokenizer with an internal Rust napi parser, and merges the runner into@rslint/coreso the native.nodeships inside the existing@rslint/{platform}subpackages — no new published packages.Parser — an internal Rust NAPI crate exposing
parse()→ ESTree-JSON AST + a parser-driven columnar token stream + ESLint-shape comments (UTF-16 offsets). Tokens are parser-driven (regex/division/JSX/TS disambiguation resolved by the parser, not heuristics), so the hand-written JS tokenizer is removed.Merge into
@rslint/coresrc/eslint-plugin/; tests (491) →tests/eslint-plugin/native-loader.tsresolves the platform.nodefrom@rslint/{platform}(mirrors howbin/rslint.cjslocates the Go binary) + dev fallback + musl detectiondist/eslint-plugin/.nodedistributed inside@rslint/{platform}(napi targets 3 → 8) via a dedicated release CI matrix@rslint/eslint-plugin-runnerpackageVerification — 491 tests green, tsgo typecheck clean, hybrid build passes, native-parser dev/prod load + token differential verified locally. The multi-platform napi cross-build release CI is new and pending validation on Actions.
Related Links
N/A
Checklist