Skip to content

refactor(linter): share edit-distance typo matching#18544

Merged
graphite-app[bot] merged 1 commit intomainfrom
c/01-25-refactor_linter_share_edit-distance_typo_matching
Jan 25, 2026
Merged

refactor(linter): share edit-distance typo matching#18544
graphite-app[bot] merged 1 commit intomainfrom
c/01-25-refactor_linter_share_edit-distance_typo_matching

Conversation

@camc314
Copy link
Contributor

@camc314 camc314 commented Jan 25, 2026

No description provided.

@camc314 camc314 marked this pull request as ready for review January 25, 2026 19:27
Copilot AI review requested due to automatic review settings January 25, 2026 19:27
@github-actions github-actions bot added A-linter Area - Linter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Jan 25, 2026
Copy link
Contributor Author

camc314 commented Jan 25, 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.

Base automatically changed from 01-25-feat_linter_valid-typeof_add_suggestions_if_type_is_misspelled to main January 25, 2026 19:28
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

This PR refactors typo-matching logic by extracting a shared edit-distance utility that can be reused across multiple linter rules. The change improves code maintainability by eliminating duplicated logic.

Changes:

  • Introduces a new edit_distance utility module with Levenshtein distance calculation and best-match finding
  • Refactors nextjs/no_typos to use the shared utility instead of local implementation
  • Refactors eslint/valid_typeof to use edit distance matching instead of hardcoded typo patterns

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
crates/oxc_linter/src/utils/mod.rs Adds module declaration and exports for the new edit_distance utility
crates/oxc_linter/src/utils/edit_distance.rs New utility module providing min_edit_distance and best_match functions for typo detection
crates/oxc_linter/src/rules/nextjs/no_typos.rs Replaces local edit distance implementation with shared utility
crates/oxc_linter/src/rules/eslint/valid_typeof.rs Replaces hardcoded typo patterns with edit distance matching (threshold=2)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@graphite-app
Copy link
Contributor

graphite-app bot commented Jan 25, 2026

Merge activity

@graphite-app graphite-app bot force-pushed the c/01-25-refactor_linter_share_edit-distance_typo_matching branch from b4279f4 to 59e5de5 Compare January 25, 2026 19:35
@graphite-app graphite-app bot merged commit 59e5de5 into main Jan 25, 2026
21 checks passed
@graphite-app graphite-app bot deleted the c/01-25-refactor_linter_share_edit-distance_typo_matching branch January 25, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter 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