Skip to content

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Nov 21, 2025

Pure refactor. Split up plugins/utils.ts into 3 files in utils directory.

Most importantly, assertion functions are by themselves in an asserts.ts file. This paves the way for the next PR (#15946).

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Nov 21, 2025
Copy link
Member Author


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.

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 the plugins/utils.ts file by splitting it into three focused files within a new utils directory: asserts.ts for assertion functions, types.ts for type utilities, and utils.ts for general utility functions. This reorganization improves code organization and prepares for future changes mentioned in PR #15946.

Key Changes:

  • Split plugins/utils.ts into three separate files: utils/asserts.ts, utils/types.ts, and utils/utils.ts
  • Updated 12 import statements across the codebase to reference the new file locations
  • Removed unnecessary // oxlint-disable-next-line no-unused-vars comment from assertIsNonNull function

Reviewed changes

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

Show a summary per file
File Description
apps/oxlint/src-js/utils/utils.ts New file containing getErrorMessage utility function moved from plugins/utils.ts
apps/oxlint/src-js/utils/types.ts New file containing SetNullable type utility moved from plugins/utils.ts
apps/oxlint/src-js/utils/asserts.ts New file containing assertion functions (assertIs, assertIsNonNull) moved from plugins/utils.ts
apps/oxlint/src-js/plugins/visitor.ts Updated import path for assertion functions to ../utils/asserts.js
apps/oxlint/src-js/plugins/utils.ts File deleted - content split into three new files
apps/oxlint/src-js/plugins/tokens.ts Updated import path for assertIsNonNull to ../utils/asserts.js
apps/oxlint/src-js/plugins/source_code.ts Updated import path for assertIsNonNull to ../utils/asserts.js
apps/oxlint/src-js/plugins/settings.ts Updated import path for assertIsNonNull to ../utils/asserts.js
apps/oxlint/src-js/plugins/scope.ts Updated import paths for assertions to ../utils/asserts.js and types to ../utils/types.ts
apps/oxlint/src-js/plugins/location.ts Updated import path for assertIsNonNull to ../utils/asserts.js
apps/oxlint/src-js/plugins/load.ts Updated import paths for getErrorMessage and SetNullable type to new locations
apps/oxlint/src-js/plugins/lint.ts Split imports to reference both ../utils/asserts.js and ../utils/utils.js
apps/oxlint/src-js/plugins/fix.ts Updated import path for assertIs to ../utils/asserts.js
apps/oxlint/src-js/plugins/context.ts Updated import path for assertIsNonNull to ../utils/asserts.js
apps/oxlint/src-js/plugins/comments.ts Updated import path for assertIsNonNull to ../utils/asserts.js
apps/oxlint/src-js/index.ts Updated import paths for assertions and types to reference new utils/ directory

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

@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Nov 21, 2025
Copy link
Contributor

camc314 commented Nov 21, 2025

Merge activity

Pure refactor. Split up `plugins/utils.ts` into 3 files in `utils` directory.

Most importantly, assertion functions are by themselves in an `asserts.ts` file. This paves the way for the next PR (#15946).
@graphite-app graphite-app bot force-pushed the 11-21-refactor_linter_plugins_move_assertions_into_own_file branch from c16cca7 to 512e43a Compare November 21, 2025 14:42
@graphite-app graphite-app bot merged commit 512e43a into main Nov 21, 2025
18 checks passed
@graphite-app graphite-app bot deleted the 11-21-refactor_linter_plugins_move_assertions_into_own_file branch November 21, 2025 14:48
Copilot AI pushed a commit that referenced this pull request Nov 21, 2025
Pure refactor. Split up `plugins/utils.ts` into 3 files in `utils` directory.

Most importantly, assertion functions are by themselves in an `asserts.ts` file. This paves the way for the next PR (#15946).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0-merge Merge with Graphite Merge Queue A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins 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