| Dimension | Shared | Only in A | Only in B | Overlap |
|---|---|---|---|---|
| Sections | 1 | 0 | 34 | 3% |
| Commands | 0 | 0 | 3 | 0% |
| Section tags | 2 | 0 | 5 | 29% |
What each file covers
Sections
1 shared · 0 only in A · 34 only in B- + AI Agent Rules
- + While working on `.`
- + Instructions
- + General rule
- + Code style
- + Testing
- + Fixture Test Common Guide
- + Verification
- + Compatibility rule
- + While working on `crates/jsdoc`
- + While working on `crates/swc`
- + While working on `crates/swc_bundler`
- + While working on `crates/swc_core`
- + While working on `crates/swc_css_codegen`
- + While working on `crates/swc_css_compat`
- + While working on `crates/swc_css_lints`
- + While working on `crates/swc_css_minifier`
- + While working on `crates/swc_css_modules`
- + While working on `crates/swc_css_parser`
- + While working on `crates/swc_css_prefixer`
- + While working on `crates/swc_ecma_codegen`
- + While working on `crates/swc_ecma_lints`
- + While working on `crates/swc_ecma_minifier`
- + While working on `crates/swc_ecma_parser`
- + While working on `crates/swc_ecma_preset_env`
- + While working on `crates/swc_ecma_transformer`
- + While working on `crates/swc_ecma_transforms`
- + While working on `crates/swc_ecma_transforms_base`
- + While working on `crates/swc_ecma_transforms_compat`
- + While working on `crates/swc_ecma_transforms_module`
- + While working on `crates/swc_ecma_transforms_optimization`
- + While working on `crates/swc_ecma_transforms_proposal`
- + While working on `crates/swc_ecma_transforms_react`
- + While working on `crates/swc_ecma_transforms_typescript`
- Fixture Test Addition Guide
Commands
0 shared · 0 only in A · 3 only in B- + cargo fmt --all
- + cargo clippy --all --all-targets -- -D warnings
- + cargo test -p <crate>
Section tags
2 shared · 0 only in A · 5 only in B- + lint-format
- + code-style
- + do-not
- + agent-behaviour
- + docs
- test
- testing-strategy
Line diff
swc-project/swc · crates/swc_bundler/AGENTS.md
@@ −1 @@
1### Fixture Test Addition Guide
2
3- Preferred fixture roots in this crate: tests/fixture, tests/deno-exec.
4- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_bundler.
5- Verify without UPDATE before finishing: cargo test -p swc_bundler.
6
swc-project/swc · CLAUDE.md
@@ +1 @@
1# AI Agent Rules
2
3When working in a specific directory, apply the rules from that directory and all parent directories up to the root.
4
5## While working on `.`
6
7*Source: `AGENTS.md`*
8
9# Instructions
10
11## General rule
12
13- Read the codebase - the codebase is source of truth, and you should prefer reading lots of source code over searching.
14- Do not search web unless explicitly asked to do so. Web search does not help in general for our project.
15- Write performant code. Always prefer performance over other things.
16- Use `gh` CLI tool for fetching data from `github.com`.
17
18## Code style
19
20- Write comments and documentations in English.
21- Write documentation for your code.
22- Commit your work as frequent as possible using git. Do NOT use `--no-verify` flag.
23- Prefer multiple small files over single large file.
24
25---
26
27- When creating Atom instances, it's better to use `Cow<str>` or `&str` instead of `String`. Note that `&str` is better than `Cow<str>` here.
28
29## Testing
30
31- Write unit tests for your code.
32- Prefer fixture tests over inline (`#[test]`) tests.
33- You can do `UPDATE=1 cargo test` to get test outputs updated for fixture tests.
34- When instructed to fix tests, do not remove or modify existing tests.
35
36### Fixture Test Common Guide
37
38- Add new coverage by extending existing fixture suites instead of adding ad-hoc inline tests.
39- Find the exact fixture harness before adding files with: `rg -n "#\[(testing::)?fixture\(" tests src --glob "*.rs"`.
40- Keep each suite's naming conventions (for example: input.*, output.*, exec.*, .ans).
41- For snapshot-style tests, update expected outputs with `UPDATE=1 cargo test -p ...` using the exact crate command documented in each crate's AGENTS.md.
42- Always rerun the same crate tests without `UPDATE` before finishing.
43
44## Verification
45
46- Before finishing a task, always run this baseline locally.
47 - `cargo fmt --all`
48 - `cargo clippy --all --all-targets -- -D warnings`
49- For each touched Rust crate, run crate-level verification locally.
50 - `cargo test -p <crate>`
51- If wasm binding packages are touched, run:
52 - `(cd bindings/binding_core_wasm && ./scripts/test.sh)`
53 - `(cd bindings/binding_minifier_wasm && ./scripts/test.sh)`
54 - `(cd bindings/binding_typescript_wasm && ./scripts/test.sh)`
55 - `(cd bindings/binding_es_ast_viewer && ./scripts/test.sh)`
56- If node bindings or integration paths are touched, run:
57 - `(cd packages/core && pnpm build:dev && pnpm test)`
58
59## Compatibility rule
60
61- Do not use unstable, nightly only features of rustc.
62
63
64---
65
66## While working on `crates/jsdoc`
67
68*Source: `crates/jsdoc/AGENTS.md`*
69
70### Fixture Test Addition Guide
71
72- Preferred fixture roots in this crate: tests/fixtures.
73- Update generated fixture outputs with: UPDATE=1 cargo test -p jsdoc.
74- Verify without UPDATE before finishing: cargo test -p jsdoc.
75
76
77---
78
79## While working on `crates/swc`
80
81*Source: `crates/swc/AGENTS.md`*
82
83### Fixture Test Addition Guide
84
85- Preferred fixture roots in this crate: tests/fixture, tests/errors, tests/exec, tests/minify, tests/typescript, tests/vercel, tests/stacktrace, tests/babel-exec.
86- Update generated fixture outputs with: UPDATE=1 cargo test -p swc.
87- Verify without UPDATE before finishing: cargo test -p swc.
88
89
90---
91
92## While working on `crates/swc_bundler`
93
94*Source: `crates/swc_bundler/AGENTS.md`*
95
96### Fixture Test Addition Guide
97
98- Preferred fixture roots in this crate: tests/fixture, tests/deno-exec.
99- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_bundler.
100- Verify without UPDATE before finishing: cargo test -p swc_bundler.
101
102
103---
104
105## While working on `crates/swc_core`
106
107*Source: `crates/swc_core/AGENTS.md`*
108
109### Fixture Test Addition Guide
110
111- Preferred fixture roots in this crate: tests/fixture.
112- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_core.
113- Verify without UPDATE before finishing: cargo test -p swc_core.
114
115
116---
117
118## While working on `crates/swc_css_codegen`
119
120*Source: `crates/swc_css_codegen/AGENTS.md`*
121
122### Fixture Test Addition Guide
123
124- Preferred fixture roots in this crate: tests/fixture, tests/options, ../swc_css_parser/tests/fixture.
125- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_css_codegen.
126- Verify without UPDATE before finishing: cargo test -p swc_css_codegen.
127
128
129---
130
131## While working on `crates/swc_css_compat`
132
133*Source: `crates/swc_css_compat/AGENTS.md`*
134
135### Fixture Test Addition Guide
136
137- Preferred fixture roots in this crate: tests/nesting, tests/custom-media-query, tests/media-query-ranges, tests/color-hex-alpha, tests/color-legacy, tests/selector-not, tests/color-hwb, tests/all.
138- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_css_compat.
139- Verify without UPDATE before finishing: cargo test -p swc_css_compat.
140
141
142---
143
144## While working on `crates/swc_css_lints`
145
146*Source: `crates/swc_css_lints/AGENTS.md`*
147
148### Fixture Test Addition Guide
149
150- Preferred fixture roots in this crate: tests/rules/pass, tests/rules/fail.
151- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_css_lints.
152- Verify without UPDATE before finishing: cargo test -p swc_css_lints.
153
154
155---
156
157## While working on `crates/swc_css_minifier`
158
159*Source: `crates/swc_css_minifier/AGENTS.md`*
160
161### Fixture Test Addition Guide
162
163- Preferred fixture roots in this crate: tests/fixture.
164- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_css_minifier.
165- Verify without UPDATE before finishing: cargo test -p swc_css_minifier.
166
167
168---
169
170## While working on `crates/swc_css_modules`
171
172*Source: `crates/swc_css_modules/AGENTS.md`*
173
174### Fixture Test Addition Guide
175
176- Preferred fixture roots in this crate: tests/fixture, tests/with-compat.
177- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_css_modules.
178- Verify without UPDATE before finishing: cargo test -p swc_css_modules.
179
180
181---
182
183## While working on `crates/swc_css_parser`
184
185*Source: `crates/swc_css_parser/AGENTS.md`*
186
187### Fixture Test Addition Guide
188
189- Preferred fixture roots in this crate: tests/fixture, tests/line-comment, tests/recovery, tests/recovery-cssmodules.
190- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_css_parser.
191- Verify without UPDATE before finishing: cargo test -p swc_css_parser.
192
193
194---
195
196## While working on `crates/swc_css_prefixer`
197
198*Source: `crates/swc_css_prefixer/AGENTS.md`*
199
200### Fixture Test Addition Guide
201
202- Preferred fixture roots in this crate: tests/fixture.
203- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_css_prefixer.
204- Verify without UPDATE before finishing: cargo test -p swc_css_prefixer.
205
206
207---
208
209## While working on `crates/swc_ecma_codegen`
210
211*Source: `crates/swc_ecma_codegen/AGENTS.md`*
212
213### Fixture Test Addition Guide
214
215- Preferred fixture roots in this crate: tests/fixture, tests/str-lits, ../swc_ecma_parser/tests/test262-parser/pass.
216- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_codegen.
217- Verify without UPDATE before finishing: cargo test -p swc_ecma_codegen.
218
219
220---
221
222## While working on `crates/swc_ecma_lints`
223
224*Source: `crates/swc_ecma_lints/AGENTS.md`*
225
226### Fixture Test Addition Guide
227
228- Preferred fixture roots in this crate: tests/pass.
229- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_lints.
230- Verify without UPDATE before finishing: cargo test -p swc_ecma_lints.
231
232
233---
234
235## While working on `crates/swc_ecma_minifier`
236
237*Source: `crates/swc_ecma_minifier/AGENTS.md`*
238
239### Instructions
240
241- You can run execution tests by doing ./scripts/exec.sh to see if your changes are working.
242- If an execution test fails, you are wrong.
243- Always run execution tests after making changes.
244- You can run fixture tests by doing ./scripts/test.sh, and you can do UPDATE=1 ./scripts/test.sh to update fixtures.
245
246### Fixture Test Addition Guide
247
248- Preferred fixture roots in this crate: tests/fixture, tests/terser, tests/mangle, tests/pass-1, tests/pass-default, tests/full, tests/projects, benches/full.
249- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_minifier.
250- Verify without UPDATE before finishing: cargo test -p swc_ecma_minifier.
251
252
253---
254
255## While working on `crates/swc_ecma_parser`
256
257*Source: `crates/swc_ecma_parser/AGENTS.md`*
258
259### Fixture Test Addition Guide
260
261- Preferred fixture roots in this crate: tests/js, tests/jsx, tests/typescript, tests/typescript-errors, tests/errors, tests/comments, tests/span, tests/shifted.
262- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_parser.
263- Verify without UPDATE before finishing: cargo test -p swc_ecma_parser.
264
265
266---
267
268## While working on `crates/swc_ecma_preset_env`
269
270*Source: `crates/swc_ecma_preset_env/AGENTS.md`*
271
272### Fixture Test Addition Guide
273
274- Preferred fixture roots in this crate: tests/fixtures.
275- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_preset_env.
276- Verify without UPDATE before finishing: cargo test -p swc_ecma_preset_env.
277
278
279---
280
281## While working on `crates/swc_ecma_transformer`
282
283*Source: `crates/swc_ecma_transformer/AGENTS.md`*
284
285### Instructions
286
287- The Transformer must implement `VisitMut` and execute the `VisitMutHooks` of its subtypes.
288- Other types like ES20xx or transforms for specific syntax MUST NOT implement `VisitMut`.
289- Subtypes must implement `VisitMutHook<TraverseCtx>`.
290- Before starting work, read `$repositoryRoot/crates/swc_ecma_hooks/src/`.
291
292
293---
294
295## While working on `crates/swc_ecma_transforms`
296
297*Source: `crates/swc_ecma_transforms/AGENTS.md`*
298
299### Fixture Test Addition Guide
300
301- Preferred fixture roots in this crate: tests/fixture.
302- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_transforms.
303- Verify without UPDATE before finishing: cargo test -p swc_ecma_transforms.
304
305
306---
307
308## While working on `crates/swc_ecma_transforms_base`
309
310*Source: `crates/swc_ecma_transforms_base/AGENTS.md`*
311
312### Fixture Test Addition Guide
313
314- Preferred fixture roots in this crate: tests/resolver, tests/ts-resolver, ../swc_ecma_parser/tests.
315- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_transforms_base.
316- Verify without UPDATE before finishing: cargo test -p swc_ecma_transforms_base.
317
318
319---
320
321## While working on `crates/swc_ecma_transforms_compat`
322
323*Source: `crates/swc_ecma_transforms_compat/AGENTS.md`*
324
325### Fixture Test Addition Guide
326
327- Preferred fixture roots in this crate: tests/arrow, tests/async-to-generator, tests/block-scoping, tests/class-properties, tests/class_fields_use_set, tests/classes, tests/destructuring, tests/for-of, tests/new-target, tests/object-rest-spread, tests/optional-chaining, tests/optional-chaining-loose, tests/parameters, tests/private-in-object, tests/shorthand_properties, tests/static-blocks.
328- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_transforms_compat.
329- Verify without UPDATE before finishing: cargo test -p swc_ecma_transforms_compat.
330
331
332---
333
334## While working on `crates/swc_ecma_transforms_module`
335
336*Source: `crates/swc_ecma_transforms_module/AGENTS.md`*
337
338### Fixture Test Addition Guide
339
340- Preferred fixture roots in this crate: tests/fixture, tests/paths.
341- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_transforms_module.
342- Verify without UPDATE before finishing: cargo test -p swc_ecma_transforms_module.
343
344
345---
346
347## While working on `crates/swc_ecma_transforms_optimization`
348
349*Source: `crates/swc_ecma_transforms_optimization/AGENTS.md`*
350
351### Fixture Test Addition Guide
352
353- Preferred fixture roots in this crate: tests/const-modules, tests/dce, tests/dce-jsx, tests/expr-simplifier.
354- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_transforms_optimization.
355- Verify without UPDATE before finishing: cargo test -p swc_ecma_transforms_optimization.
356
357
358---
359
360## While working on `crates/swc_ecma_transforms_proposal`
361
362*Source: `crates/swc_ecma_transforms_proposal/AGENTS.md`*
363
364### Fixture Test Addition Guide
365
366- Preferred fixture roots in this crate: tests/decorators, tests/explicit-resource-management.
367- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_transforms_proposal.
368- Verify without UPDATE before finishing: cargo test -p swc_ecma_transforms_proposal.
369
370
371---
372
373## While working on `crates/swc_ecma_transforms_react`
374
375*Source: `crates/swc_ecma_transforms_react/AGENTS.md`*
376
377### Fixture Test Addition Guide
378
379- Preferred fixture roots in this crate: tests/jsx/fixture, tests/integration/fixture, tests/script/jsx/fixture.
380- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_transforms_react.
381- Verify without UPDATE before finishing: cargo test -p swc_ecma_transforms_react.
382
383
384---
385
386## While working on `crates/swc_ecma_transforms_typescript`
387
388*Source: `crates/swc_ecma_transforms_typescript/AGENTS.md`*
389
390### Fixture Test Addition Guide
391
392- Preferred fixture roots in this crate: tests/fixture, ../swc_ecma_parser/tests/tsc, ../swc_ecma_parser/tests/typescript.
393- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_transforms_typescript.
394- Verify without UPDATE before finishing: cargo test -p swc_ecma_transforms_typescript.
395
396
397---
398
399## While working on `crates/swc_error_reporters`
400
401*Source: `crates/swc_error_reporters/AGENTS.md`*
402
403### Fixture Test Addition Guide
404
405- Preferred fixture roots in this crate: tests/fixture.
406- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_error_reporters.
407- Verify without UPDATE before finishing: cargo test -p swc_error_reporters.
408
409
410---
411
412## While working on `crates/swc_estree_compat`
413
414*Source: `crates/swc_estree_compat/AGENTS.md`*
415
416### Fixture Test Addition Guide
417
418- Preferred fixture roots in this crate: tests/fixtures, tests/flavor/acorn/fixtures.
419- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_estree_compat.
420- Verify without UPDATE before finishing: cargo test -p swc_estree_compat.
421
422
423---
424
425## While working on `crates/swc_html_codegen`
426
427*Source: `crates/swc_html_codegen/AGENTS.md`*
428
429### Fixture Test Addition Guide
430
431- Preferred fixture roots in this crate: tests/fixture, tests/document_fragment, tests/options, ../swc_html_parser/tests/fixture.
432- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_html_codegen.
433- Verify without UPDATE before finishing: cargo test -p swc_html_codegen.
434
435
436---
437
438## While working on `crates/swc_html_minifier`
439
440*Source: `crates/swc_html_minifier/AGENTS.md`*
441
442### Fixture Test Addition Guide
443
444- Preferred fixture roots in this crate: tests/fixture, tests/document_fragment, tests/recovery.
445- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_html_minifier.
446- Verify without UPDATE before finishing: cargo test -p swc_html_minifier.
447
448
449---
450
451## While working on `crates/swc_html_parser`
452
453*Source: `crates/swc_html_parser/AGENTS.md`*
454
455### Fixture Test Addition Guide
456
457- Preferred fixture roots in this crate: tests/fixture, tests/recovery, tests/iframe_srcdoc, tests/html5lib-tests-fixture, tests/html5lib-tests.
458- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_html_parser.
459- Verify without UPDATE before finishing: cargo test -p swc_html_parser.
460
461
462---
463
464## While working on `crates/swc_node_bundler`
465
466*Source: `crates/swc_node_bundler/AGENTS.md`*
467
468### Fixture Test Addition Guide
469
470- Preferred fixture roots in this crate: tests/pass.
471- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_node_bundler.
472- Verify without UPDATE before finishing: cargo test -p swc_node_bundler.
473
474
475---
476
477## While working on `crates/swc_plugin_backend_tests`
478
479*Source: `crates/swc_plugin_backend_tests/AGENTS.md`*
480
481### Fixture Test Addition Guide
482
483- Preferred fixture roots in this crate: tests/fixture, ../swc_ecma_parser/tests/tsc.
484- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_plugin_backend_tests.
485- Verify without UPDATE before finishing: cargo test -p swc_plugin_backend_tests.
486
487
488---
489
490## While working on `crates/swc_ts_fast_strip`
491
492*Source: `crates/swc_ts_fast_strip/AGENTS.md`*
493
494### Fixture Test Addition Guide
495
496- Preferred fixture roots in this crate: tests/fixture, tests/errors, ../swc_ecma_parser/tests/tsc.
497- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ts_fast_strip.
498- Verify without UPDATE before finishing: cargo test -p swc_ts_fast_strip.
499
500
501---
502
503## While working on `crates/swc_typescript`
504
505*Source: `crates/swc_typescript/AGENTS.md`*
506
507### Fixture Test Addition Guide
508
509- Preferred fixture roots in this crate: tests/**/*.ts, tests/**/*.tsx.
510- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_typescript.
511- Verify without UPDATE before finishing: cargo test -p swc_typescript.
512
513
514---
515
516## While working on `crates/swc_xml_codegen`
517
518*Source: `crates/swc_xml_codegen/AGENTS.md`*
519
520### Fixture Test Addition Guide
521
522- Preferred fixture roots in this crate: tests/fixture, tests/options, ../swc_xml_parser/tests/fixture, ../swc_xml_parser/tests/recovery.
523- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_xml_codegen.
524- Verify without UPDATE before finishing: cargo test -p swc_xml_codegen.
525
526
527---
528
529## While working on `crates/swc_xml_parser`
530
531*Source: `crates/swc_xml_parser/AGENTS.md`*
532
533### Fixture Test Addition Guide
534
535- Preferred fixture roots in this crate: tests/fixture, tests/recovery.
536- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_xml_parser.
537- Verify without UPDATE before finishing: cargo test -p swc_xml_parser.
538
539
540---
541
542## While working on `crates/testing_macros`
543
544*Source: `crates/testing_macros/AGENTS.md`*
545
546### Fixture Test Addition Guide
547
548- Preferred fixture roots in this crate: tests/simple, tests/ignore.
549- Update generated fixture outputs with: UPDATE=1 cargo test -p testing_macros.
550- Verify without UPDATE before finishing: cargo test -p testing_macros.
551
@@ −1 +1 @@
1+# AI Agent Rules
2+
3+When working in a specific directory, apply the rules from that directory and all parent directories up to the root.
4+
5+## While working on `.`
6+
7+*Source: `AGENTS.md`*
8+
9+# Instructions
10+
11+## General rule
12+
13+- Read the codebase - the codebase is source of truth, and you should prefer reading lots of source code over searching.
14+- Do not search web unless explicitly asked to do so. Web search does not help in general for our project.
15+- Write performant code. Always prefer performance over other things.
16+- Use `gh` CLI tool for fetching data from `github.com`.
17+
18+## Code style
19+
20+- Write comments and documentations in English.
21+- Write documentation for your code.
22+- Commit your work as frequent as possible using git. Do NOT use `--no-verify` flag.
23+- Prefer multiple small files over single large file.
24+
25+---
26+
27+- When creating Atom instances, it's better to use `Cow<str>` or `&str` instead of `String`. Note that `&str` is better than `Cow<str>` here.
28+
29+## Testing
30+
31+- Write unit tests for your code.
32+- Prefer fixture tests over inline (`#[test]`) tests.
33+- You can do `UPDATE=1 cargo test` to get test outputs updated for fixture tests.
34+- When instructed to fix tests, do not remove or modify existing tests.
35+
36+### Fixture Test Common Guide
37+
38+- Add new coverage by extending existing fixture suites instead of adding ad-hoc inline tests.
39+- Find the exact fixture harness before adding files with: `rg -n "#\[(testing::)?fixture\(" tests src --glob "*.rs"`.
40+- Keep each suite's naming conventions (for example: input.*, output.*, exec.*, .ans).
41+- For snapshot-style tests, update expected outputs with `UPDATE=1 cargo test -p ...` using the exact crate command documented in each crate's AGENTS.md.
42+- Always rerun the same crate tests without `UPDATE` before finishing.
43+
44+## Verification
45+
46+- Before finishing a task, always run this baseline locally.
47+ - `cargo fmt --all`
48+ - `cargo clippy --all --all-targets -- -D warnings`
49+- For each touched Rust crate, run crate-level verification locally.
50+ - `cargo test -p <crate>`
51+- If wasm binding packages are touched, run:
52+ - `(cd bindings/binding_core_wasm && ./scripts/test.sh)`
53+ - `(cd bindings/binding_minifier_wasm && ./scripts/test.sh)`
54+ - `(cd bindings/binding_typescript_wasm && ./scripts/test.sh)`
55+ - `(cd bindings/binding_es_ast_viewer && ./scripts/test.sh)`
56+- If node bindings or integration paths are touched, run:
57+ - `(cd packages/core && pnpm build:dev && pnpm test)`
58+
59+## Compatibility rule
60+
61+- Do not use unstable, nightly only features of rustc.
62+
63+
64+---
65+
66+## While working on `crates/jsdoc`
67+
68+*Source: `crates/jsdoc/AGENTS.md`*
69+
170 ### Fixture Test Addition Guide
271
72+- Preferred fixture roots in this crate: tests/fixtures.
73+- Update generated fixture outputs with: UPDATE=1 cargo test -p jsdoc.
74+- Verify without UPDATE before finishing: cargo test -p jsdoc.
75+
76+
77+---
78+
79+## While working on `crates/swc`
80+
81+*Source: `crates/swc/AGENTS.md`*
82+
83+### Fixture Test Addition Guide
84+
85+- Preferred fixture roots in this crate: tests/fixture, tests/errors, tests/exec, tests/minify, tests/typescript, tests/vercel, tests/stacktrace, tests/babel-exec.
86+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc.
87+- Verify without UPDATE before finishing: cargo test -p swc.
88+
89+
90+---
91+
92+## While working on `crates/swc_bundler`
93+
94+*Source: `crates/swc_bundler/AGENTS.md`*
95+
96+### Fixture Test Addition Guide
97+
398 - Preferred fixture roots in this crate: tests/fixture, tests/deno-exec.
499 - Update generated fixture outputs with: UPDATE=1 cargo test -p swc_bundler.
5100 - Verify without UPDATE before finishing: cargo test -p swc_bundler.
101+
102+
103+---
104+
105+## While working on `crates/swc_core`
106+
107+*Source: `crates/swc_core/AGENTS.md`*
108+
109+### Fixture Test Addition Guide
110+
111+- Preferred fixture roots in this crate: tests/fixture.
112+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_core.
113+- Verify without UPDATE before finishing: cargo test -p swc_core.
114+
115+
116+---
117+
118+## While working on `crates/swc_css_codegen`
119+
120+*Source: `crates/swc_css_codegen/AGENTS.md`*
121+
122+### Fixture Test Addition Guide
123+
124+- Preferred fixture roots in this crate: tests/fixture, tests/options, ../swc_css_parser/tests/fixture.
125+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_css_codegen.
126+- Verify without UPDATE before finishing: cargo test -p swc_css_codegen.
127+
128+
129+---
130+
131+## While working on `crates/swc_css_compat`
132+
133+*Source: `crates/swc_css_compat/AGENTS.md`*
134+
135+### Fixture Test Addition Guide
136+
137+- Preferred fixture roots in this crate: tests/nesting, tests/custom-media-query, tests/media-query-ranges, tests/color-hex-alpha, tests/color-legacy, tests/selector-not, tests/color-hwb, tests/all.
138+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_css_compat.
139+- Verify without UPDATE before finishing: cargo test -p swc_css_compat.
140+
141+
142+---
143+
144+## While working on `crates/swc_css_lints`
145+
146+*Source: `crates/swc_css_lints/AGENTS.md`*
147+
148+### Fixture Test Addition Guide
149+
150+- Preferred fixture roots in this crate: tests/rules/pass, tests/rules/fail.
151+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_css_lints.
152+- Verify without UPDATE before finishing: cargo test -p swc_css_lints.
153+
154+
155+---
156+
157+## While working on `crates/swc_css_minifier`
158+
159+*Source: `crates/swc_css_minifier/AGENTS.md`*
160+
161+### Fixture Test Addition Guide
162+
163+- Preferred fixture roots in this crate: tests/fixture.
164+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_css_minifier.
165+- Verify without UPDATE before finishing: cargo test -p swc_css_minifier.
166+
167+
168+---
169+
170+## While working on `crates/swc_css_modules`
171+
172+*Source: `crates/swc_css_modules/AGENTS.md`*
173+
174+### Fixture Test Addition Guide
175+
176+- Preferred fixture roots in this crate: tests/fixture, tests/with-compat.
177+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_css_modules.
178+- Verify without UPDATE before finishing: cargo test -p swc_css_modules.
179+
180+
181+---
182+
183+## While working on `crates/swc_css_parser`
184+
185+*Source: `crates/swc_css_parser/AGENTS.md`*
186+
187+### Fixture Test Addition Guide
188+
189+- Preferred fixture roots in this crate: tests/fixture, tests/line-comment, tests/recovery, tests/recovery-cssmodules.
190+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_css_parser.
191+- Verify without UPDATE before finishing: cargo test -p swc_css_parser.
192+
193+
194+---
195+
196+## While working on `crates/swc_css_prefixer`
197+
198+*Source: `crates/swc_css_prefixer/AGENTS.md`*
199+
200+### Fixture Test Addition Guide
201+
202+- Preferred fixture roots in this crate: tests/fixture.
203+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_css_prefixer.
204+- Verify without UPDATE before finishing: cargo test -p swc_css_prefixer.
205+
206+
207+---
208+
209+## While working on `crates/swc_ecma_codegen`
210+
211+*Source: `crates/swc_ecma_codegen/AGENTS.md`*
212+
213+### Fixture Test Addition Guide
214+
215+- Preferred fixture roots in this crate: tests/fixture, tests/str-lits, ../swc_ecma_parser/tests/test262-parser/pass.
216+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_codegen.
217+- Verify without UPDATE before finishing: cargo test -p swc_ecma_codegen.
218+
219+
220+---
221+
222+## While working on `crates/swc_ecma_lints`
223+
224+*Source: `crates/swc_ecma_lints/AGENTS.md`*
225+
226+### Fixture Test Addition Guide
227+
228+- Preferred fixture roots in this crate: tests/pass.
229+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_lints.
230+- Verify without UPDATE before finishing: cargo test -p swc_ecma_lints.
231+
232+
233+---
234+
235+## While working on `crates/swc_ecma_minifier`
236+
237+*Source: `crates/swc_ecma_minifier/AGENTS.md`*
238+
239+### Instructions
240+
241+- You can run execution tests by doing ./scripts/exec.sh to see if your changes are working.
242+- If an execution test fails, you are wrong.
243+- Always run execution tests after making changes.
244+- You can run fixture tests by doing ./scripts/test.sh, and you can do UPDATE=1 ./scripts/test.sh to update fixtures.
245+
246+### Fixture Test Addition Guide
247+
248+- Preferred fixture roots in this crate: tests/fixture, tests/terser, tests/mangle, tests/pass-1, tests/pass-default, tests/full, tests/projects, benches/full.
249+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_minifier.
250+- Verify without UPDATE before finishing: cargo test -p swc_ecma_minifier.
251+
252+
253+---
254+
255+## While working on `crates/swc_ecma_parser`
256+
257+*Source: `crates/swc_ecma_parser/AGENTS.md`*
258+
259+### Fixture Test Addition Guide
260+
261+- Preferred fixture roots in this crate: tests/js, tests/jsx, tests/typescript, tests/typescript-errors, tests/errors, tests/comments, tests/span, tests/shifted.
262+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_parser.
263+- Verify without UPDATE before finishing: cargo test -p swc_ecma_parser.
264+
265+
266+---
267+
268+## While working on `crates/swc_ecma_preset_env`
269+
270+*Source: `crates/swc_ecma_preset_env/AGENTS.md`*
271+
272+### Fixture Test Addition Guide
273+
274+- Preferred fixture roots in this crate: tests/fixtures.
275+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_preset_env.
276+- Verify without UPDATE before finishing: cargo test -p swc_ecma_preset_env.
277+
278+
279+---
280+
281+## While working on `crates/swc_ecma_transformer`
282+
283+*Source: `crates/swc_ecma_transformer/AGENTS.md`*
284+
285+### Instructions
286+
287+- The Transformer must implement `VisitMut` and execute the `VisitMutHooks` of its subtypes.
288+- Other types like ES20xx or transforms for specific syntax MUST NOT implement `VisitMut`.
289+- Subtypes must implement `VisitMutHook<TraverseCtx>`.
290+- Before starting work, read `$repositoryRoot/crates/swc_ecma_hooks/src/`.
291+
292+
293+---
294+
295+## While working on `crates/swc_ecma_transforms`
296+
297+*Source: `crates/swc_ecma_transforms/AGENTS.md`*
298+
299+### Fixture Test Addition Guide
300+
301+- Preferred fixture roots in this crate: tests/fixture.
302+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_transforms.
303+- Verify without UPDATE before finishing: cargo test -p swc_ecma_transforms.
304+
305+
306+---
307+
308+## While working on `crates/swc_ecma_transforms_base`
309+
310+*Source: `crates/swc_ecma_transforms_base/AGENTS.md`*
311+
312+### Fixture Test Addition Guide
313+
314+- Preferred fixture roots in this crate: tests/resolver, tests/ts-resolver, ../swc_ecma_parser/tests.
315+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_transforms_base.
316+- Verify without UPDATE before finishing: cargo test -p swc_ecma_transforms_base.
317+
318+
319+---
320+
321+## While working on `crates/swc_ecma_transforms_compat`
322+
323+*Source: `crates/swc_ecma_transforms_compat/AGENTS.md`*
324+
325+### Fixture Test Addition Guide
326+
327+- Preferred fixture roots in this crate: tests/arrow, tests/async-to-generator, tests/block-scoping, tests/class-properties, tests/class_fields_use_set, tests/classes, tests/destructuring, tests/for-of, tests/new-target, tests/object-rest-spread, tests/optional-chaining, tests/optional-chaining-loose, tests/parameters, tests/private-in-object, tests/shorthand_properties, tests/static-blocks.
328+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_transforms_compat.
329+- Verify without UPDATE before finishing: cargo test -p swc_ecma_transforms_compat.
330+
331+
332+---
333+
334+## While working on `crates/swc_ecma_transforms_module`
335+
336+*Source: `crates/swc_ecma_transforms_module/AGENTS.md`*
337+
338+### Fixture Test Addition Guide
339+
340+- Preferred fixture roots in this crate: tests/fixture, tests/paths.
341+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_transforms_module.
342+- Verify without UPDATE before finishing: cargo test -p swc_ecma_transforms_module.
343+
344+
345+---
346+
347+## While working on `crates/swc_ecma_transforms_optimization`
348+
349+*Source: `crates/swc_ecma_transforms_optimization/AGENTS.md`*
350+
351+### Fixture Test Addition Guide
352+
353+- Preferred fixture roots in this crate: tests/const-modules, tests/dce, tests/dce-jsx, tests/expr-simplifier.
354+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_transforms_optimization.
355+- Verify without UPDATE before finishing: cargo test -p swc_ecma_transforms_optimization.
356+
357+
358+---
359+
360+## While working on `crates/swc_ecma_transforms_proposal`
361+
362+*Source: `crates/swc_ecma_transforms_proposal/AGENTS.md`*
363+
364+### Fixture Test Addition Guide
365+
366+- Preferred fixture roots in this crate: tests/decorators, tests/explicit-resource-management.
367+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_transforms_proposal.
368+- Verify without UPDATE before finishing: cargo test -p swc_ecma_transforms_proposal.
369+
370+
371+---
372+
373+## While working on `crates/swc_ecma_transforms_react`
374+
375+*Source: `crates/swc_ecma_transforms_react/AGENTS.md`*
376+
377+### Fixture Test Addition Guide
378+
379+- Preferred fixture roots in this crate: tests/jsx/fixture, tests/integration/fixture, tests/script/jsx/fixture.
380+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_transforms_react.
381+- Verify without UPDATE before finishing: cargo test -p swc_ecma_transforms_react.
382+
383+
384+---
385+
386+## While working on `crates/swc_ecma_transforms_typescript`
387+
388+*Source: `crates/swc_ecma_transforms_typescript/AGENTS.md`*
389+
390+### Fixture Test Addition Guide
391+
392+- Preferred fixture roots in this crate: tests/fixture, ../swc_ecma_parser/tests/tsc, ../swc_ecma_parser/tests/typescript.
393+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ecma_transforms_typescript.
394+- Verify without UPDATE before finishing: cargo test -p swc_ecma_transforms_typescript.
395+
396+
397+---
398+
399+## While working on `crates/swc_error_reporters`
400+
401+*Source: `crates/swc_error_reporters/AGENTS.md`*
402+
403+### Fixture Test Addition Guide
404+
405+- Preferred fixture roots in this crate: tests/fixture.
406+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_error_reporters.
407+- Verify without UPDATE before finishing: cargo test -p swc_error_reporters.
408+
409+
410+---
411+
412+## While working on `crates/swc_estree_compat`
413+
414+*Source: `crates/swc_estree_compat/AGENTS.md`*
415+
416+### Fixture Test Addition Guide
417+
418+- Preferred fixture roots in this crate: tests/fixtures, tests/flavor/acorn/fixtures.
419+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_estree_compat.
420+- Verify without UPDATE before finishing: cargo test -p swc_estree_compat.
421+
422+
423+---
424+
425+## While working on `crates/swc_html_codegen`
426+
427+*Source: `crates/swc_html_codegen/AGENTS.md`*
428+
429+### Fixture Test Addition Guide
430+
431+- Preferred fixture roots in this crate: tests/fixture, tests/document_fragment, tests/options, ../swc_html_parser/tests/fixture.
432+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_html_codegen.
433+- Verify without UPDATE before finishing: cargo test -p swc_html_codegen.
434+
435+
436+---
437+
438+## While working on `crates/swc_html_minifier`
439+
440+*Source: `crates/swc_html_minifier/AGENTS.md`*
441+
442+### Fixture Test Addition Guide
443+
444+- Preferred fixture roots in this crate: tests/fixture, tests/document_fragment, tests/recovery.
445+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_html_minifier.
446+- Verify without UPDATE before finishing: cargo test -p swc_html_minifier.
447+
448+
449+---
450+
451+## While working on `crates/swc_html_parser`
452+
453+*Source: `crates/swc_html_parser/AGENTS.md`*
454+
455+### Fixture Test Addition Guide
456+
457+- Preferred fixture roots in this crate: tests/fixture, tests/recovery, tests/iframe_srcdoc, tests/html5lib-tests-fixture, tests/html5lib-tests.
458+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_html_parser.
459+- Verify without UPDATE before finishing: cargo test -p swc_html_parser.
460+
461+
462+---
463+
464+## While working on `crates/swc_node_bundler`
465+
466+*Source: `crates/swc_node_bundler/AGENTS.md`*
467+
468+### Fixture Test Addition Guide
469+
470+- Preferred fixture roots in this crate: tests/pass.
471+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_node_bundler.
472+- Verify without UPDATE before finishing: cargo test -p swc_node_bundler.
473+
474+
475+---
476+
477+## While working on `crates/swc_plugin_backend_tests`
478+
479+*Source: `crates/swc_plugin_backend_tests/AGENTS.md`*
480+
481+### Fixture Test Addition Guide
482+
483+- Preferred fixture roots in this crate: tests/fixture, ../swc_ecma_parser/tests/tsc.
484+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_plugin_backend_tests.
485+- Verify without UPDATE before finishing: cargo test -p swc_plugin_backend_tests.
486+
487+
488+---
489+
490+## While working on `crates/swc_ts_fast_strip`
491+
492+*Source: `crates/swc_ts_fast_strip/AGENTS.md`*
493+
494+### Fixture Test Addition Guide
495+
496+- Preferred fixture roots in this crate: tests/fixture, tests/errors, ../swc_ecma_parser/tests/tsc.
497+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_ts_fast_strip.
498+- Verify without UPDATE before finishing: cargo test -p swc_ts_fast_strip.
499+
500+
501+---
502+
503+## While working on `crates/swc_typescript`
504+
505+*Source: `crates/swc_typescript/AGENTS.md`*
506+
507+### Fixture Test Addition Guide
508+
509+- Preferred fixture roots in this crate: tests/**/*.ts, tests/**/*.tsx.
510+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_typescript.
511+- Verify without UPDATE before finishing: cargo test -p swc_typescript.
512+
513+
514+---
515+
516+## While working on `crates/swc_xml_codegen`
517+
518+*Source: `crates/swc_xml_codegen/AGENTS.md`*
519+
520+### Fixture Test Addition Guide
521+
522+- Preferred fixture roots in this crate: tests/fixture, tests/options, ../swc_xml_parser/tests/fixture, ../swc_xml_parser/tests/recovery.
523+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_xml_codegen.
524+- Verify without UPDATE before finishing: cargo test -p swc_xml_codegen.
525+
526+
527+---
528+
529+## While working on `crates/swc_xml_parser`
530+
531+*Source: `crates/swc_xml_parser/AGENTS.md`*
532+
533+### Fixture Test Addition Guide
534+
535+- Preferred fixture roots in this crate: tests/fixture, tests/recovery.
536+- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_xml_parser.
537+- Verify without UPDATE before finishing: cargo test -p swc_xml_parser.
538+
539+
540+---
541+
542+## While working on `crates/testing_macros`
543+
544+*Source: `crates/testing_macros/AGENTS.md`*
545+
546+### Fixture Test Addition Guide
547+
548+- Preferred fixture roots in this crate: tests/simple, tests/ignore.
549+- Update generated fixture outputs with: UPDATE=1 cargo test -p testing_macros.
550+- Verify without UPDATE before finishing: cargo test -p testing_macros.
6551
