Skip to content

fix(linter/plugins): resolve JS plugins only with conditions Node.js supports#15248

Merged
graphite-app[bot] merged 1 commit intomainfrom
11-04-fix_linter_plugins_resolve_js_plugins_only_with_conditions_node.js_supports
Nov 4, 2025
Merged

fix(linter/plugins): resolve JS plugins only with conditions Node.js supports#15248
graphite-app[bot] merged 1 commit intomainfrom
11-04-fix_linter_plugins_resolve_js_plugins_only_with_conditions_node.js_supports

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Nov 4, 2025

Fixes the require related error described in #14862 (comment).
This was happening because Node.js does not use module condition but the plugin resolver used that. I aligned the conditions to what Node.js uses (I didn't include node-addon because it's not popular and requires detecting --no-addons to do it properly).
https://nodejs.org/docs/v24.11.0/api/packages.html#conditional-exports

I'm not sure why, but the test snapshot doesn't seem stable on my machine.

cc @TheAlexLichter

refs #14541

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI C-bug Category - Bug labels Nov 4, 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.

@sapphi-red sapphi-red marked this pull request as ready for review November 4, 2025 02:04
@sapphi-red sapphi-red requested a review from camc314 as a code owner November 4, 2025 02:04
Copilot AI review requested due to automatic review settings November 4, 2025 02:04
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 updates the module resolution configuration for external plugin loading to support the module-sync export condition and prioritize node and import conditions. The key change removes the main_fields configuration and updates the condition_names to better align with Node.js module resolution standards.

  • Replaced main_fields with updated condition_names for external plugin resolution
  • Added support for module-sync export condition with priority ordering
  • Added test fixtures (plugin15 and plugin16) to verify the new resolution behavior

Reviewed Changes

Copilot reviewed 23 out of 28 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/oxc_linter/src/config/config_builder.rs Updated resolver configuration to use module-sync, node, and import condition names, removed main_fields
apps/oxlint/test/fixtures/load_paths/node_modules/plugin16/* Added test plugin using module-sync export condition
apps/oxlint/test/fixtures/load_paths/node_modules/plugin15/* Added test plugin with module and default exports to verify correct condition resolution
apps/oxlint/test/fixtures/load_paths/.oxlintrc.json Added plugin15 and plugin16 to test configuration
apps/oxlint/test/fixtures/load_paths/output.snap.md Updated snapshot to reflect new plugin loading order
Various other output.snap.md files Updated snapshots reflecting diagnostic output ordering changes due to parallel execution

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

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 4, 2025

CodSpeed Performance Report

Merging #15248 will not alter performance

Comparing 11-04-fix_linter_plugins_resolve_js_plugins_only_with_conditions_node.js_supports (bb2784f) with main (ec6721c)

Summary

✅ 4 untouched
⏩ 33 skipped1

Footnotes

  1. 33 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.

@camc314
Copy link
Contributor

camc314 commented Nov 4, 2025

I'm not sure why, but the test snapshot doesn't seem stable on my machine.

possibly pnpm run build-dev vs pnpm run build-test, build test enables a special feature flag for more consistent diagnostics. i'll take a look

@camc314 camc314 force-pushed the 11-04-fix_linter_plugins_resolve_js_plugins_only_with_conditions_node.js_supports branch from bb2784f to eb8bcb1 Compare November 4, 2025 15:51
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Nov 4, 2025
Copy link
Contributor

camc314 commented Nov 4, 2025

Merge activity

…supports (#15248)

Fixes the `require` related error described in #14862 (comment).
This was happening because Node.js does not use `module` condition but the plugin resolver used that. I aligned the conditions to what Node.js uses (I didn't include `node-addon` because it's not popular and requires detecting `--no-addons` to do it properly).
https://nodejs.org/docs/v24.11.0/api/packages.html#conditional-exports

I'm not sure why, but the test snapshot doesn't seem stable on my machine.

cc @TheAlexLichter

refs #14541
@graphite-app graphite-app bot force-pushed the 11-04-fix_linter_plugins_resolve_js_plugins_only_with_conditions_node.js_supports branch from eb8bcb1 to 56c6627 Compare November 4, 2025 15:58
@graphite-app graphite-app bot merged commit 56c6627 into main Nov 4, 2025
20 checks passed
@graphite-app graphite-app bot deleted the 11-04-fix_linter_plugins_resolve_js_plugins_only_with_conditions_node.js_supports branch November 4, 2025 16:03
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Nov 4, 2025
@sapphi-red
Copy link
Member Author

I'm not sure why, but the test snapshot doesn't seem stable on my machine.

possibly pnpm run build-dev vs pnpm run build-test, build test enables a special feature flag for more consistent diagnostics. i'll take a look

Ah, I see. FYI I was running with pnpm build && pnpm test and pnpm build-dev && pnpm test and didn't try pnpm build-test && pnpm test.

@Boshen Boshen mentioned this pull request Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants