swc-project
swc
Blog
Docs
Changelog
Blog
Docs
Changelog
Overview
Branches
Benchmarks
Runs
Performance History
Latest Results
fix(react-compiler): narrow lint/lintSync's syntax type to exclude Flow @swc/types's ParserConfig is a union that includes FlowParserConfig, but this crate only enables swc_ecma_parser's typescript feature, not flow -- the compiled Syntax enum has no Flow variant. Passing { syntax: 'flow', ... } type-checked fine against the wider ParserConfig but threw a confusing "unknown variant 'flow'" error at runtime. LintSyntax (TsParserConfig | EsParserConfig) makes this a compile-time error instead. Not attempting to actually support Flow syntax here -- that would require verifying swc_ecma_react_compiler's HIR lowering understands Flow-specific AST nodes, which is unverified and out of scope; React Compiler is fundamentally a React/JS/TS tool.
imjordanxd:feat/react-compiler-lint-diagnostics
10 hours ago
fix(react-compiler): convert diagnostic positions to UTF-16 code units swc_ecma_react_compiler's Position (loc.column/index) is intentionally byte-based -- it also feeds DiagnosticMessage.span, which @swc/core's existing react-compiler transform-error path turns into a real swc_common::Span/BytePos for terminal error rendering. That consumer genuinely needs byte offsets, so the shared representation must stay byte-based. lint/lintSync are a different consumer exposing these positions to JS/ESLint, whose string indexing is UTF-16-based. For source containing any non-ASCII character before a diagnostic's location, returning raw byte offsets there produces wrong positions for any JS consumer. Fixes this at this package's own boundary instead of the shared upstream representation: diagnostic_from_message (bindings/ binding_react_compiler_node/src/diagnostics.rs) now takes the original source text and re-derives column/index as UTF-16 code units, using the byte-based line/column as a starting point. For ASCII-only source this is a no-op. Verified against the real built binary: for source with an emoji before a violation, source.slice(loc.start.index, loc.end.index) (JS's own UTF-16 string slicing) now correctly extracts just the violating expression. An earlier version of this fix changed swc_ecma_react_compiler's shared position-computation function directly, which would have fixed this for lint/lintSync but broken the unrelated, already-shipped transform-error span rendering for the same class of input. Caught before landing.
imjordanxd:feat/react-compiler-lint-diagnostics
10 hours ago
test(react-compiler): add per-rule lint coverage; ci: run its JS tests Adds one test per documented React Compiler lint rule (react.dev/reference/eslint-plugin-react-hooks) that a hand-written source snippet can reliably trigger: globals, immutability, use-memo, set-state-in-render, unsupported-syntax (plus the existing refs test). Every trigger condition was verified empirically against the actual compiled binary, several by reading the upstream forked_react_compiler source directly to find the exact condition (e.g. purity's check is gated behind validate_no_impure_functions_in_render, which defaults to false upstream, so it's unreachable via this crate's current API and intentionally not covered). config/gating need explicit directives this crate doesn't expose; error-boundaries/static-components/ set-state-in-effect/incompatible-library need more investigation to find a reliable trigger -- left uncovered rather than guessed at. Also: packages/react-compiler's own JS test suite (tests/lint.test.cjs) was not wired into any CI workflow at all -- only packages/core's `pnpm test` runs in CI.yml's node-test job. Added matching build/test steps for packages/react-compiler so this doesn't regress silently. packages/minifier has the same gap (node --test but no CI step); left alone as pre-existing and out of scope for this PR.
imjordanxd:feat/react-compiler-lint-diagnostics
10 hours ago
build: Remove vergen dependency (#11976) **Description:** Remove the `vergen` build dependency and the generated build metadata that changed across builds. This keeps generated build inputs deterministic so `sccache` can reuse cached artifacts instead of being invalidated by timestamp/date metadata. Changes: - Replace `swc_core`'s `vergen` build script with deterministic std-only generation of package version and sorted Cargo features. - Remove `swc_plugin_runner`'s build script and time-varying build diagnostics. - Update workspace and fixture lockfiles to drop `vergen` and its transitive dependencies. Co-authored-by: DongYun Kang <kdy.1997.dev@gmail.com>
main
10 hours ago
chore: Add changeset for vergen removal
hardfist:codex/remove-vergen-sccache
10 hours ago
chore: remove internal planning doc from the PR This was scratch documentation for the agentic workflow used to develop this PR, not something that adds value to swc-project/swc's own history. Still recoverable from this branch's git history if needed.
imjordanxd:feat/react-compiler-lint-diagnostics
11 hours ago
style: fix rustfmt doc-comment wrapping in lint.rs cargo fmt --all was run once mid-session but not after later edits to this file's doc comments, which is what CI's cargo fmt --all -- --check caught.
imjordanxd:feat/react-compiler-lint-diagnostics
11 hours ago
fix(react-compiler): lint/lintSync take code: string, not Buffer @swc/core's transformSync(src: string | Program, options?) passes source code through as a plain string, reserving Buffer-encoding for the JSON-serialized options config. lint/lintSync had it backwards -- code was Buffer (matching a different, unrelated precedent in this same file: is_react_compiler_required(_sync)) while syntax was correctly Buffer-encoded JSON. Switching code to string matches the ecosystem convention, removes a pointless string->bytes->string round trip for callers whose source is already a JS string (e.g. ESLint's sourceCode.getText()), and removes the internal String::from_utf8_lossy conversion entirely since napi guarantees a string-typed parameter is already valid UTF-8.
imjordanxd:feat/react-compiler-lint-diagnostics
11 hours ago
Latest Branches
CodSpeed Performance Gauge
0%
feat: add `lint` / `lintSync` API to `@swc/react-compiler`
#11965
10 hours ago
4df9898
imjordanxd:feat/react-compiler-lint-diagnostics
CodSpeed Performance Gauge
0%
build: Remove vergen dependency
#11976
10 hours ago
cc0aaa5
hardfist:codex/remove-vergen-sccache
CodSpeed Performance Gauge
+2%
feat(wasm-typescript): add Node.js helpers
#11975
16 hours ago
48364c0
kdy1/nodejs-wasm-typescript-api
© 2026 CodSpeed Technology
Home
Terms
Privacy
Docs