Skip to content

refactor(ast): remove AstKind for AssignmentTarget#12252

Merged
camc314 merged 27 commits intooxc-project:mainfrom
taearls:refactor/remove-assignment-target-from-ast-kind
Jul 15, 2025
Merged

refactor(ast): remove AstKind for AssignmentTarget#12252
camc314 merged 27 commits intooxc-project:mainfrom
taearls:refactor/remove-assignment-target-from-ast-kind

Conversation

@taearls
Copy link
Contributor

@taearls taearls commented Jul 13, 2025

Part of #11490. Removes AssignmentTarget from AstKind.

I was able to get through everything and get the tests to all pass with minimal changes (as much as I could, anyway). Some of the rules required more work than others.

Affected files after removing AssignmentTarget from AstKind:

oxc_ast:

  • crates/oxc_ast/src/ast_kind_impl.rs

oxc_linter:

  • crates/oxc_linter/src/rules/eslint/no_extend_native.rs
  • crates/oxc_linter/src/rules/eslint/no_unused_private_class_members.rs
  • crates/oxc_linter/src/rules/eslint/no_unused_vars/allowed.rs
  • crates/oxc_linter/src/rules/eslint/no_unused_vars/usage.rs
  • crates/oxc_linter/src/rules/eslint/no_useless_rename.rs
  • crates/oxc_linter/src/rules/import/no_commonjs.rs
  • crates/oxc_linter/src/rules/oxc/no_accumulating_spread.rs
  • crates/oxc_linter/src/rules/unicorn/no_accessor_recursion.rs
    crates/oxc_linter/src/rules/unicorn/no_unreadable_array_destructuring.rs
  • crates/oxc_linter/src/rules/unicorn/prefer_dom_node_text_content.rs

oxc_semantic:

  • crates/oxc_semantic/src/checker/javascript.rs

oxc_mangler:

  • crates/oxc_mangler/src/keep_names.rs

ast_tools:

  • tasks/ast_tools/src/generators/ast_kind.rs

Snapshot updates:

  • the snapshot slightly changed for no_commonjs, but it seems to be correct from what I can tell. it looks like there might've been some duplicate reporting.
  • the snapshot for no_accessor_recursion slightly updated, but only the column numbers in two of the diagnostic messages, so I think this is fine?

Other than those two snapshots, the others I think come from removing AssignmentTarget and then regenerating the ast types.

@github-actions github-actions bot added A-linter Area - Linter A-semantic Area - Semantic A-ast Area - AST A-ast-tools Area - AST tools A-formatter Area - Formatter labels Jul 13, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Jul 13, 2025

CodSpeed Instrumentation Performance Report

Merging #12252 will not alter performance

Comparing taearls:refactor/remove-assignment-target-from-ast-kind (6a8464f) with main (c2db117)

Summary

✅ 34 untouched benchmarks

@taearls taearls changed the title Refactor/remove assignment target from ast kind refactor: remove assignment target from ast kind Jul 14, 2025
@taearls taearls changed the title refactor: remove assignment target from ast kind refactor(linter): remove assignment target from ast kind Jul 14, 2025
@github-actions github-actions bot added the C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior label Jul 14, 2025
@taearls taearls marked this pull request as ready for review July 14, 2025 01:03
@overlookmotel
Copy link
Member

Thanks very much for this. Either me or @camc314 will review as soon as we can. These AstKind changes often have quite subtle effects, so we need to do a proper review, and we're both quite tied up at the moment. I'd hope one of us can get to it before end of this week. Please excuse the delay.

@taearls
Copy link
Contributor Author

taearls commented Jul 14, 2025

Thanks very much for this. Either me or @camc314 will review as soon as we can. These AstKind changes often have quite subtle effects, so we need to do a proper review, and we're both quite tied up at the moment. I'd hope one of us can get to it before end of this week. Please excuse the delay.

No worries at all! That makes complete sense.

@camc314 camc314 self-assigned this Jul 15, 2025
@camc314 camc314 force-pushed the refactor/remove-assignment-target-from-ast-kind branch from 81f35f2 to af2c9e5 Compare July 15, 2025 12:49
@camc314 camc314 force-pushed the refactor/remove-assignment-target-from-ast-kind branch from af2c9e5 to b542951 Compare July 15, 2025 12:50
@camc314 camc314 changed the title refactor(linter): remove assignment target from ast kind refactor(ast): remove AstKind for AssignmentTarget Jul 15, 2025
Copy link
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@camc314 camc314 merged commit ee761de into oxc-project:main Jul 15, 2025
24 checks passed
This was referenced Jul 16, 2025
camc314 added a commit that referenced this pull request Jul 16, 2025
## [1.7.0] - 2025-07-16

### 🚀 Features

- 5e428a4 linter/eslint-plugin-next: No-html-link-for-pages rule
addition (#12194) (Gabriel Díaz Aguilera)
- 9b14fbc ast: Add `ThisExpression` to `TSTypeName` (#12156) (Boshen)
- c551b8f linter: Report diagnostics from custom plugins (#12219)
(camc314)
- d387729 linter: JS custom rules config (#12160) (camc314)
- 152e59d napi/oxlint: Read source text into start of allocator (#12122)
(overlookmotel)
- bde1ef1 linter: Load custom JS plugins (#11980) (camc314)
- d4ebd14 linter: Add `oxlint2`/`disable_oxlint2` feature flags (#12130)
(camc314)
- a4dae73 linter: Introduce `LintPlugins` to store builtin + custom
plugins (#12117) (camc314)

### 🐛 Bug Fixes

- 3f9a1f0 linter/no-unused-private-class-members: Fix false positive
with nullish coalescing assignments (#12317) (camc314)
- 47fad0e linter/no-empty-file: False positive with empty file with
triple slash directive (#12293) (camc314)
- 633ba30 linter: False positive with unknown plugins when unmatched
eslint rule (#12285) (camc314)
- 9720774 linter: Report implicit config parse errors (#12260) (Simon
Buchan)
- 1920c6b language_server: Respect the root `.oxlintrc.json` file for
`ignorePatterns` (#12171) (Sysix)
- 98708eb linter: Fix inconsistent behavior in `no-duplicate-imports`
rule (#12192) (yefan)
- 853d2bc linter, language_server: Correctly identify usage of `import`
plugin (#12157) (overlookmotel)

### 🚜 Refactor

- ee761de ast: Remove `AstKind` for `AssignmentTarget` (#12252) (Tyler
Earls)
- c68b607 ast: Rename `TemplateLiteral::quasi` to
`TemplateLiteral::single_quasi` (#12266) (Dunqing)
- 32c32af ast: Check whether there is a single `quasi` in
`TemplateLiteral::quasi` (#12265) (Dunqing)
- 8f6a1da linter/js-plugins: Use `u32` for IDs (#12243) (overlookmotel)
- 36cd364 linter/js-plugins: Clean up code (#12242) (overlookmotel)
- 8c02ebd linter/js-plugins: Rename `specifiers` to `paths` (#12241)
(overlookmotel)
- 3adaf98 linter: Simplify getting nodes count (#12239) (overlookmotel)
- 6e54645 language_server: Store `LintService` instead of `Linter`
(#12016) (Sysix)
- 113cf8c linter: Move `LintServiceOptions.paths` to
`LintService.with_paths` (#12015) (Sysix)
- acfac68 oxlint: Adjust ignore patterns by counting bytes instead of
chars (#12209) (Sysix)
- 729b82b linter: Rename `plugin_name` to `plugin_specifier` (#12148)
(overlookmotel)
- 532b816 linter: Use `to_string` instead of `into` (#12147)
(overlookmotel)
- 89f2a69 linter: TODO comment (#12146) (overlookmotel)
- f90d3e1 linter: Feature gate `load_external_plugin` by both `oxlint2`
and `disable_oxlint2` features (#12141) (overlookmotel)
- 12e4ec7 linter: Make `tokio` dependency optional (#12140)
(overlookmotel)
- 1d2eaca oxlint2: Introduce `force_test_reporter` feature for
consistent graphical outputs (#12133) (camc314)
- 8814c53 ast: Remove `AstKind` for `PropertyKey` (#12108) (camchenry)
- 228cff5 semantic,linter: Assert that Program is always the first node
(#12123) (Ulrich Stark)
- e8e2a25 ast: Remove `AstKind` for `AssignmentTargetPattern` (#12105)
(camchenry)
- f7c675d linter: Rename `LintPlugins` to `BuiltinLintPlugins` (#12116)
(camc314)
- a9e5ec0 linter: Access plugins through config instead of storing
directly (#12115) (camc314)
- 9736a7f linter: Simplify `unicorn/require-post-message-target-origin`
(#12110) (shulaoda)

### 📚 Documentation

- 2e3db46 linter: Add missing backtick preventing website from building
(#12113) (camc314)

### ⚡ Performance

- d0f8b88 linter/js-plugins: Do not copy `Vec` (#12248) (overlookmotel)
- 4284d19 linter/js-plugins: Use hashmap `Entry` API + remove temp `Vec`
(#12247) (overlookmotel)
- c7889c3 semantic,linter: Simplify implementation and uses of ancestors
iterators (#12164) (Ulrich Stark)
- f99959c linter: Move work out of loop (#12145) (overlookmotel)
- 514d40c linter: Do not create `Resolver` unless required (#12142)
(overlookmotel)
- 7103527 linter/no-constructor-return: Optimize loop (#12138)
(overlookmotel)

### 🧪 Testing

- d1194e8 oxlint: Ignore test on windows (#12262) (camc314)

Co-authored-by: camc314 <18101008+camc314@users.noreply.github.com>
@taearls taearls deleted the refactor/remove-assignment-target-from-ast-kind branch July 25, 2025 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST A-ast-tools Area - AST tools A-formatter Area - Formatter A-linter Area - Linter A-semantic Area - Semantic C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants