Skip to content

fix(linter): move no-use-before-define to eslint plugin#19438

Merged
graphite-app[bot] merged 1 commit intomainfrom
c/02-16-fix_linter_move_no-use-before-define_to_eslint_plugin
Feb 19, 2026
Merged

fix(linter): move no-use-before-define to eslint plugin#19438
graphite-app[bot] merged 1 commit intomainfrom
c/02-16-fix_linter_move_no-use-before-define_to_eslint_plugin

Conversation

@camc314
Copy link
Contributor

@camc314 camc314 commented Feb 16, 2026

fixes #19437
fixes #19542

Copy link
Contributor Author

camc314 commented Feb 16, 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 hot fixes, skip the queue and merge this PR next

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.

@github-actions github-actions bot added A-linter Area - Linter C-bug Category - Bug labels Feb 16, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Feb 16, 2026

Merging this PR will not alter performance

✅ 47 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing c/02-16-fix_linter_move_no-use-before-define_to_eslint_plugin (f7d2819) with main (c832a9f)2

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (2b448bd) during the generation of this report, so c832a9f was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@camc314 camc314 force-pushed the c/02-16-fix_linter_move_no-use-before-define_to_eslint_plugin branch 2 times, most recently from e65a9ad to f7d2819 Compare February 19, 2026 11:57
@camc314 camc314 marked this pull request as ready for review February 19, 2026 12:03
Copilot AI review requested due to automatic review settings February 19, 2026 12:03
@camc314 camc314 self-assigned this Feb 19, 2026
@camc314 camc314 added 0-merge Merge with Graphite Merge Queue labels Feb 19, 2026
Copy link
Contributor Author

camc314 commented Feb 19, 2026

Merge activity

@graphite-app graphite-app bot force-pushed the c/02-16-fix_linter_move_no-use-before-define_to_eslint_plugin branch from f7d2819 to 79fc6d7 Compare February 19, 2026 12:04
@graphite-app graphite-app bot merged commit 79fc6d7 into main Feb 19, 2026
21 checks passed
@graphite-app graphite-app bot deleted the c/02-16-fix_linter_move_no-use-before-define_to_eslint_plugin branch February 19, 2026 12:10
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

Moves the no-use-before-define implementation from the typescript ruleset into the eslint ruleset to address #19437 (rule reporting under the wrong plugin / not respecting disabling as expected), and updates the linter’s generated registries and snapshots accordingly.

Changes:

  • Re-homes no_use_before_define from crates/oxc_linter/src/rules/typescript/ to crates/oxc_linter/src/rules/eslint/.
  • Updates rule registration/wiring (rules.rs, generated enums/runner impls) and adjusts snapshots to report as eslint(no-use-before-define).
  • Removes eslint/no-use-before-define from the “unsupported rules” list.

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tasks/lint_rules/src/unsupported-rules.json Removes eslint/no-use-before-define from the unsupported list.
crates/oxc_linter/src/snapshots/[email protected] Updates expected diagnostic plugin name to eslint(...).
crates/oxc_linter/src/rules/typescript/no_use_before_define.rs Removes the old TypeScript-plugin rule implementation.
crates/oxc_linter/src/rules/eslint/no_use_before_define.rs Adds the ESLint-plugin rule implementation and associated tests.
crates/oxc_linter/src/rules.rs Registers the new ESLint rule module and removes the TypeScript one.
crates/oxc_linter/src/generated/rules_enum.rs Regenerates rule enum exports/IDs/mappings to reflect the move.
crates/oxc_linter/src/generated/rule_runner_impls.rs Regenerates runner impls to wire the rule under the ESLint module.

Comment on lines +102 to +107
impl Rule for NoUseBeforeDefine {
fn from_configuration(value: serde_json::Value) -> Result<Self, serde_json::Error> {
serde_json::from_value::<DefaultRuleConfig<NoUseBeforeDefineConfig>>(value)
.map(DefaultRuleConfig::into_inner)
.map(Self)
}
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

from_configuration only deserializes into NoUseBeforeDefineConfig (object form), but the test cases in this file use ESLint’s legacy string option "nofunc" (e.g. Some(json!(["nofunc"]))). As written, that configuration will fail to deserialize and will panic in tests (and reject user configs). Add support for the string shorthand (mapping "nofunc" -> { functions: false }) via a custom from_configuration parser or an untagged config enum that accepts both string and object forms.

Copilot uses AI. Check for mistakes.
}

#[test]
#[ignore = "eslint test cases are failing"]
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The main ESLint parity test (fn test()) is currently marked #[ignore = "eslint test cases are failing"]. Shipping a newly added rule with its primary test suite ignored makes regressions likely and hides whether the JS behavior matches ESLint. Please fix the underlying failures (likely config parsing / should_run gating) and remove the #[ignore] so this runs in CI.

Suggested change
#[ignore = "eslint test cases are failing"]

Copilot uses AI. Check for mistakes.
Comment on lines +162 to +163
fn should_run(&self, ctx: &ContextHost) -> bool {
ctx.source_type().is_typescript()
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

should_run currently restricts this rule to TypeScript sources (ctx.source_type().is_typescript()), but eslint/no-use-before-define is an ESLint core rule that should also run on JavaScript/JSX. This gating likely prevents the rule from ever reporting in .js/.jsx files (and may be why the ESLint test suite below is ignored). Consider removing should_run entirely (default true) or widening it to include JS/JSX/TS/TSX as appropriate for this rule.

Suggested change
fn should_run(&self, ctx: &ContextHost) -> bool {
ctx.source_type().is_typescript()
fn should_run(&self, _ctx: &ContextHost) -> bool {
true

Copilot uses AI. Check for mistakes.
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Feb 19, 2026
camc314 added a commit that referenced this pull request Feb 19, 2026
# Oxlint
### 💥 BREAKING CHANGES

- 4315594 oxlint: [**BREAKING**] Deprecate `"always"` and `"as-needed"`
options of the radix rule (#19408) (Sysix)
- d4c7af3 linter: [**BREAKING**] Remove
`allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing` option (#19451)
(camc314)

### 🚀 Features

- 82ca5c3 linter: Add typescript/dot-notation rule (#19442) (camc314)
- 6db0811 linter: Implement
eslint-plugin-vitest/no-importing-vitest-globals (#18694) (Said
Atrahouch)
- c7fe8ae linter: Implement eslint-plugin-vitest/prefer-import-in-mock
(#17966) (Said Atrahouch)
- 0abb39a linter: Implement
eslint-vitest-jest-plugin/prefer-mock-return-shorthand (#18002) (Said
Atrahouch)
- 2b95537 linter: Implement `n/no-path-concat` rule (#19502) (Mikhail
Baev)
- 735d0e4 linter: Implement typescript/no-useless-default-assignment
(#19488) (camc314)
- 31c3a93 linter: Add typescript/no-unnecessary-type-parameters rule
(#19450) (camc314)
- c948090 linter: Add typescript/consistent-return rule (#19449)
(camc314)
- 9f87df0 linter: Add typescript/prefer-string-starts-ends-with rule
(#19448) (camc314)
- 04536be linter: Add typescript/prefer-regexp-exec rule (#19447)
(camc314)
- 56a7feb linter: Add typescript/prefer-readonly rule (#19446) (camc314)
- a1cea63 linter: Add typescript/no-unnecessary-qualifier rule (#19445)
(camc314)
- e3144d2 linter: Add typescript/prefer-find rule (#19444) (camc314)
- 13c7408 linter: Add typescript/prefer-readonly-parameter-types rule
(#19443) (camc314)
- 9b17d44 linter: Add typescript/strict-void-return rule (#19441)
(camc314)
- ed821b4 linter: Add typescript/consistent-type-exports rule (#19440)
(camc314)

### 🐛 Bug Fixes

- daad7bc linter/array-callback-return: Check `allowVoid` option
(#19506) (Said Atrahouch)
- 638cf94 linter: Add help text to eslint rule diagnostics (#19508)
(Kyle Tse)
- 79fc6d7 linter: Move no-use-before-define to eslint plugin (#19438)
(camc314)
- c832a9f linter: Add `onScrollEnd` and `onScrollEndCapture` to
`react/no-unknown-property`. (#19536) (connorshea)
- 999a0db linter: Add help text to `symbol-description` diagnostics
(#19538) (Anthony Amaro)
- f064482 linter: Add help text to eslint rule diagnostics (#19539)
(Anthony Amaro)
- fd11073 linter/react/no-unknown-property: Add missing `fetchPriority`
prop (#19525) (João Pedro Schmitz)
- a9bb604 linter/no-shadow: Align initializer shadow handling with
typescript-eslint (#19462) (camc314)
- 32e6eb9 linter: Handle typed arrays/array buffers in `prefer-spread`
rule. (#19478) (connorshea)
- e309f84 linter: Handle additional cases in
`typescript/consistent-generic-constructors` rule. (#19477) (connorshea)
- 71db91a linter/array-callback-return: Check `fromAsync`, update test
cases (#19483) (Said Atrahouch)
- 2a12d74 linter: Handle optional chaining in
`no-array-method-this-argument` rule. (#19476) (connorshea)
- f65310b linter: Handle optional chaining in
`prefer-object-from-entries` rule. (#19475) (connorshea)
- 840acf4 linter: Handle optional chain in
`no-unnecessary-array-flat-depth` rule. (#19471) (connorshea)
- 85a19e9 linter: Skip string literal imports in `consistent-assert`
rule. (#19474) (connorshea)

### ⚡ Performance

- 6155ac4 linter/constructor-super: Use node_id over nodes loop (#19489)
(camc314)
- a02496d linter/consistent-index-object-style: Resolve circular type
refs semantically (#19490) (camc314)
# Oxfmt
### 🚀 Features

- 652c346 oxfmt/lsp: Support `untitled://` schema (#19287) (Sysix)

### 🐛 Bug Fixes

- 6c61b70 oxfmt: Fix outdated `sortImports.groups` doc comments (#19513)
(leaysgur)

Co-authored-by: camc314 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linter: typescript/no-use-before-define "off" is not respected from oxlintrc typescript/no-use-before-define flags errors even when disabled

1 participant

Comments