Skip to content

fix(linter/plugins): fix types for walkProgram and walkProgramWithCfg#20081

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/03-06-fix_linter_plugins_fix_types_for_walkprogram_and_walkprogramwithcfg_
Mar 6, 2026
Merged

fix(linter/plugins): fix types for walkProgram and walkProgramWithCfg#20081
graphite-app[bot] merged 1 commit intomainfrom
om/03-06-fix_linter_plugins_fix_types_for_walkprogram_and_walkprogramwithcfg_

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Mar 6, 2026

Fix a mistake in our (internal) types: walkProgramWithCfg was missing that elements can be CfgVisitFn.

Also refactor the types for walkProgram, importing the original VisitFn and EnterExit types from where they're defined.

Copy link
Member Author

overlookmotel commented Mar 6, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@overlookmotel overlookmotel marked this pull request as ready for review March 6, 2026 17:17
Copilot AI review requested due to automatic review settings March 6, 2026 17:17
@overlookmotel overlookmotel requested a review from camc314 as a code owner March 6, 2026 17:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates internal TypeScript declaration surfaces so compiled visitor arrays better reflect how the AST walker and CFG walker are actually called within oxlint/parser integrations.

Changes:

  • Adjust CompiledVisitors in generated walk.d.ts templates/outputs to include null in the union.
  • Update walkProgramWithCfg typing to accept CfgVisitFn and null entries (and stop relying on a non-exported generated type).
  • Regenerate/align corresponding walk.d.ts outputs for parser and oxlint.

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 3 comments.

File Description
tasks/ast_tools/src/generators/estree_visit.rs Updates the generator template for walk.d.ts types (and affects future regenerated outputs).
napi/parser/src-js/generated/visit/walk.d.ts Updates generated parser-side walkProgram declaration types.
apps/oxlint/src-js/plugins/cfg.ts Widens walkProgramWithCfg visitors parameter type to include CFG event handlers and null.
apps/oxlint/src-js/generated/walk.d.ts Updates generated oxlint-side walkProgram declaration types.

@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Mar 6, 2026
Copy link
Contributor

camc314 commented Mar 6, 2026

Merge activity

  • Mar 6, 5:29 PM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Mar 6, 5:31 PM UTC: camc314 added this pull request to the Graphite merge queue.
  • Mar 6, 5:47 PM UTC: The Graphite merge queue couldn't merge this PR because it was not satisfying all requirements (Failed CI: 'Lint').
  • Mar 6, 6:03 PM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Mar 6, 6:03 PM UTC: overlookmotel added this pull request to the Graphite merge queue.
  • Mar 6, 6:11 PM UTC: Merged by the Graphite merge queue.

@overlookmotel overlookmotel force-pushed the om/03-06-refactor_linter_plugins_debug_assert_that_values_passed_via_napi_are_not_undefined_ branch from 2951baf to 9a6c4b9 Compare March 6, 2026 17:37
@overlookmotel overlookmotel force-pushed the om/03-06-fix_linter_plugins_fix_types_for_walkprogram_and_walkprogramwithcfg_ branch from 3a2b46c to 07be1dd Compare March 6, 2026 17:37
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 6, 2026
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Mar 6, 2026
@graphite-app graphite-app bot force-pushed the om/03-06-refactor_linter_plugins_debug_assert_that_values_passed_via_napi_are_not_undefined_ branch from 9a6c4b9 to cfaa754 Compare March 6, 2026 17:39
graphite-app bot pushed a commit that referenced this pull request Mar 6, 2026
…Cfg` (#20081)

Fix 2 mistakes in our (internal) types:

1. `walkProgram` was missing that elements of the `visitors` array can be `null`.
2. `walkProgramWithCfg` was missing that elements can be `null` and also `CfgVisitFn`.
@graphite-app graphite-app bot force-pushed the om/03-06-fix_linter_plugins_fix_types_for_walkprogram_and_walkprogramwithcfg_ branch from 07be1dd to 57eaf77 Compare March 6, 2026 17:40
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 6, 2026
Base automatically changed from om/03-06-refactor_linter_plugins_debug_assert_that_values_passed_via_napi_are_not_undefined_ to main March 6, 2026 17:46
@overlookmotel overlookmotel force-pushed the om/03-06-fix_linter_plugins_fix_types_for_walkprogram_and_walkprogramwithcfg_ branch from 57eaf77 to 4a48042 Compare March 6, 2026 17:56
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Mar 6, 2026
…Cfg` (#20081)

Fix a mistake in our (internal) types: `walkProgramWithCfg` was missing that elements can be `CfgVisitFn`.

Also refactor the types for `walkProgram`, importing the original `VisitFn` and `EnterExit` types from where they're defined.
@graphite-app graphite-app bot force-pushed the om/03-06-fix_linter_plugins_fix_types_for_walkprogram_and_walkprogramwithcfg_ branch from 4a48042 to 92cfb14 Compare March 6, 2026 18:04
@graphite-app graphite-app bot merged commit 92cfb14 into main Mar 6, 2026
19 checks passed
@graphite-app graphite-app bot deleted the om/03-06-fix_linter_plugins_fix_types_for_walkprogram_and_walkprogramwithcfg_ branch March 6, 2026 18:11
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 6, 2026
camc314 pushed a commit that referenced this pull request Mar 9, 2026
### 🚀 Features

- e8547cc parser: Report error for using declarations in ambient
contexts (#19934) (camc314)
- 8345318 allocator: Add methods for boxed slices `ArenaBox<[T]>`
(#19968) (overlookmotel)
- f83be30 allocator: Add `Vec::push_fast` method (#19959)
(overlookmotel)

### 🐛 Bug Fixes

- 291d867 transformer_plugins: Unwrap ChainExpression after define
replacement removes optional markers (#20058) (IWANABETHATGUY)
- 36b2e56 codegen: Print type for TSImportEqualsDeclaration (#20128)
(camc314)
- 5a246ec codegen: Print type arguments for JSXOpeningElement (#20127)
(camc314)
- a40870e codegen: Preserve parens for TSNonNullExpression (#20125)
(camc314)
- ae830b2 codegen: Print `declare` for `TSInterfaceDeclaration` (#20124)
(camc314)
- 92cfb14 linter/plugins: Fix types for `walkProgram` and
`walkProgramWithCfg` (#20081) (overlookmotel)
- ee0491e apps,napi: Explicitly specify libs in tsconfigs (#20071)
(camc314)
- 588009e codegen: Print `static` keyword for TSIndexSignature (#19755)
(Dunqing)
- 5a8799c codegen: Print `with_clause` for `ExportNamedDeclaration`
(#20002) (Dunqing)
- 7502afe parser: Correct capacity for tokens `Vec` (#19967)
(overlookmotel)

### ⚡ Performance

- 4ea8f9a napi: Remove `napi_build::setup()` from `oxc_napi` to avoid
redundant rebuilds (#20094) (Boshen)
- 2baa5fb napi: Unify build-test profile to coverage for cache sharing
(#20090) (Boshen)
- 8ba61dd parser: Make pushing tokens faster (#19960) (overlookmotel)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
camc314 pushed a commit that referenced this pull request Mar 9, 2026
# Oxlint
### 🚀 Features

- e6b604f oxlint: Auto-enable gitlab formatter on GitLab (#20076)
(camc314)
- 2488a68 linter: Add .oxlintrc.jsonc config file support (#19870)
(Scott S.)
- 61bf388 linter: Add `options.reportUnusedDisableDirectives` to config
file (#19799) (Peter Wagenet)
- c92422b oxlint: Auto-enable github formatter on GitHub Actions
(#19944) (Boshen)
- 0337c6d linter: Implement typescript/no-unecessary-type-conversion
(#19955) (camc314)
- 2919313 linter: Introduce denyWarnings config options (#19926)
(camc314)
- a607119 linter: Introduce maxWarnings config option (#19777) (camc314)

### 🐛 Bug Fixes

- 0861d9a linter/plugins: Remove getters from `Context` (#20115)
(overlookmotel)
- 92cfb14 linter/plugins: Fix types for `walkProgram` and
`walkProgramWithCfg` (#20081) (overlookmotel)
- 10e211f oxlint/lsp: Send other code actions besides `source.fixAll` if
requested (#20042) (Sysix)
- 602daaa linter/plugins: Fix type definition for `VisitorObject`
(#20065) (overlookmotel)
- ee0491e apps,napi: Explicitly specify libs in tsconfigs (#20071)
(camc314)
- b6e9499 linter: Fix the logic for `unicorn/prefer-dom-node-remove` to
handle literal callees as well as arguments. (#20059) (connorshea)
- 3874ae1 linter: Update `unicorn/prefer-query-selector` to also catch
`getElementsByName()`. (#20060) (connorshea)
- 77c93fb linter: Handle array-type shorthand inside union members
(#20034) (camc314)
- 50eb160 linter/no-unused-vars: Allow unused type params in ambient
module blocks (#19615) (Don Isaac)
- 1dd0d21 linter/no-restricted-imports: Apply regex pattern checks to
side-effect imports (#20028) (camc314)
- 7f3d735 linter: Error when --type-check is used without --type-aware
(#20025) (camc314)
- eea201c unicorn/prefer-string-slice: Avoid unsafe autofix for
substr-to-slice (#20010) (camc314)
- 50359dc oxlint/lsp: Detect `reportUnusedDisableDirectives` from oxlint
config, change lsp `unusedDisableDirectives` default value to `None`
(#20011) (Sysix)
- 4bc84b1 linter/plugins: Allow `null` and `undefined` for
`rule.meta.fixable` (#20008) (overlookmotel)
- 753e27e linter/role-supports-aria-props: Add `aria-posinset` to
supported `option` ARIA properties (#20003) (JongKyung Lee)
- f57b2c9 linter/plugins: Fix return types of tokens methods (#19985)
(overlookmotel)
- 27ee4fc linter/no-loss-of-precision: Avoid double rounding for
negative exponents (#19999) (camc314)
- 77a94bb linter: Avoid no-loss-of-precision false positive for 3e-308
(#19992) (camc314)
- 6245c56 linter/no-unused-private-class-members: Treat logical lhs
access as usage (#19991) (camc314)
- 65891e3 linter: Avoid prefer-const false positive for mixed-scope
destructuring (#19982) (camc314)
- 89991fe linter: Avoid prefer-const false positive for operator
reassignments (#19975) (camc314)
- 87318e7 oxlint/lsp: Load js config with reforcing fs read (#19551)
(Sysix)
- d40a942 linter/no-useless-constructor: Mark fixer as suggestion
(#19961) (camc314)
- ccbd959 linter/prefer-code-point: Report String.fromCharCode member
references (#19931) (camc314)
- 14fbbfc linter: Add help text to oxc/no-rest-spread-properties rule
(#19900) (Subin Kim)

### ⚡ Performance

- 2baa5fb napi: Unify build-test profile to coverage for cache sharing
(#20090) (Boshen)
- 77f1c71 linter/plugins: Make tokens class instances (#19980)
(overlookmotel)
- 758b424 linter/plugins: Reduce memory copies for tokens (#19979)
(overlookmotel)
- 236847f linter/plugins: Cache token objects (#19978) (overlookmotel)
- 94b597a linter/plugins: Store tokens as a `Box<[Token]>` (#19969)
(overlookmotel)

### 📚 Documentation

- 2c0010a linter/plugins: Move comment about "bivariance hack" into
generated code (#20082) (overlookmotel)
- 7538f09 linter: Improve `import/extensions` and
`import/no-named-as-default` rule docs. (#20053) (connorshea)
- 1f909cf linter: Improve docs for
`unicorn/require-post-message-target-origin` rule. (#20061) (connorshea)
- 12ae35c oxlint/lsp: Remove outdated ToDo for `LintOptions.run`
(#20012) (Sysix)
- 3be73e6 linter/plugins: Fix JSDoc comments for tokens methods (#20004)
(overlookmotel)
- 48ef285 linter: Update `--config` docs (#19965) (camc314)
- 6ea49a0 linter: Fix some identation issues for the generated types
used in `oxlint.config.ts`. (#19942) (connorshea)
- 6c0e0b5 linter: Add oxlint.config.ts to the config docs. (#19941)
(connorshea)
- 160e423 linter: Add a note that the typeAware and typeCheck options
require oxlint-tsgolint (#19940) (connorshea)
- d54c275 linter: Improve rule docs for 27 unicorn rules (#19903)
(connorshea)
# Oxfmt
### 🚀 Features

- ee26215 oxfmt: Support css-in-js substitution (#20019) (leaysgur)
- 0f0ff51 oxfmt: Display default settings was used message in cli stats
(#19939) (leaysgur)
- 88815b8 oxfmt: Reintroduce stats line for write mode (#19938)
(leaysgur)

### 🐛 Bug Fixes

- ee0491e apps,napi: Explicitly specify libs in tsconfigs (#20071)
(camc314)
- 92f4490 oxfmt: Apply `is_ignored_dir` for glob paths too (#20056)
(leaysgur)
- 114f974 oxfmt/lsp: Prefer language_id over file extension when
formatting (#19977) (copilot-swe-agent)

### ⚡ Performance

- 2baa5fb napi: Unify build-test profile to coverage for cache sharing
(#20090) (Boshen)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast-tools Area - AST tools A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins A-parser Area - Parser C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants