- After changing AST declarations or their generators, regenerate the Rust AST APIs
and JavaScript types/codecs with
ast_tools, and review the generated diff. Edit the declarations or generators rather than generated files. - After adding, removing, or renaming a helper in
packages/helpers/esm, manually runpnpm build:helpersto regenerate the ESM entry stub and review the generated diff. The stub must explicitly export each helper by name; do not useexport *or edit generated files directly.
- Add tests to the existing module; group related cases by broad feature and use a coarse feature name for the test function.
- Keep each input small; do not combine independently testable JavaScript/TypeScript statements.
- Move repeated setup and parsing boilerplate into local helper functions so the test body only shows the input, result, and assertions.
- Reuse named options, contexts, and language configurations across related cases.
- Keep independent input cases and their assertions explicit rather than in a cases table. Loops are appropriate for running the same cases across configurations; reuse named options to keep the matrix clear.
- Keep each input and result acquisition on one source line, separate cases with a blank line,
and encode input line breaks as
\n. - Assert observable behavior and structure; avoid exact diagnostic messages and verbose custom failure output unless the text itself is part of the contract.
- Do not add unit tests for behavior already covered by conformance tests or for highly specific cases.
- Test only JS API and FFI boundaries (encoding/decoding, strings/offsets, option forwarding). Keep parser/codegen correctness tests in Rust.
- JavaScript API tests belong to
@swc-next/core, except formatter tests The browser package should only have a simple smoke test.
- Follow the root README: briefly describe purpose, capabilities, basic usage, essential limitations, and crate testing where relevant.
- Write necessary document API, options, and attributes in Rust doc rather than README.
- Document commands in the relevant component README
- Omit development history, step-by-step contributor workflows, implementation walkthroughs, and exhaustive command lists.
- File issues found in bulk by static analysis of source code, or by similar methods, in swc-project/swc-next-issues. Do not file them in this repository.
- Set the
PriorityandEffortGitHub issue fields on each issue in swc-next-issues. Do not use labels for them. Set them with thesetIssueFieldValueGraphQL mutation; get the field and option IDs from theissueFieldsof theswc-projectorganization. - Choose
Priorityby how much the bug is likely to affect real users:Urgent: common code crashes, is rejected, or produces output with broken runtime behavior.High: incorrect output or diagnostics for code that users commonly write.Medium: incorrect behavior for less common but realistic code.Low: rare or contrived input, or a problem that users are unlikely to notice.
- Choose
Effortby the estimated size of the fix:Lowfor a local change,Mediumfor a change across several functions or modules, andHighfor a design change or a large rewrite.
For code reviews, use the code-review skill.