Skip to content

fix: support absolute eslintPath file paths#45

Merged
chenjiahan merged 1 commit into
masterfrom
chenjiahan/fix-eslint-absolute-path
May 13, 2026
Merged

fix: support absolute eslintPath file paths#45
chenjiahan merged 1 commit into
masterfrom
chenjiahan/fix-eslint-absolute-path

Conversation

@chenjiahan

Copy link
Copy Markdown
Member

Summary

This PR fixes absolute eslintPath file paths so they are resolved with Node CommonJS resolution before importing, matching the existing path-style fallback without changing package specifier handling. It also adds a regression test that loads the mocked ESLint module from an absolute file path.

@chenjiahan chenjiahan marked this pull request as ready for review May 13, 2026 05:53
Copilot AI review requested due to automatic review settings May 13, 2026 05:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 getESLint’s module-loading logic so absolute eslintPath values are resolved via Node CommonJS resolution before importing, aligning them with the existing path-style fallback behavior and avoiding ESM import pitfalls (notably on Windows-style absolute paths). It also adds a regression test intended to cover loading ESLint from an absolute file path.

Changes:

  • Add absolute-path detection for eslintPath and route those specifiers through require.resolve() + import(fileURL).
  • Refactor the CommonJS-resolution import path into a shared loadResolvedModule() helper.
  • Add a test case for using an absolute file path eslintPath.

Reviewed changes

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

File Description
test/eslint-path.test.js Adds a regression test for loading ESLint via an absolute file path.
src/getESLint.js Adds absolute-path handling and refactors CommonJS-resolution import into a helper.

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

Comment thread test/eslint-path.test.js
@chenjiahan chenjiahan merged commit c01aa1d into master May 13, 2026
10 checks passed
@chenjiahan chenjiahan deleted the chenjiahan/fix-eslint-absolute-path branch May 13, 2026 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants