Skip to content

import-x/no-unresolved: false positive casing mismatch for query string imports on macOS #473

@karlhorky

Description

@karlhorky

import-x/no-unresolved reports a false casing mismatch on macOS for a relative import with a query string suffix like ?raw.

The same import resolves successfully on Linux CI, and the same local file passes when the query string is removed.

Environment

  • eslint-plugin-import-x: 4.16.1
  • eslint: 9.39.2
  • Node.js: v24.13.0
  • OS: macOS 26.3.1

Repro

package.json

{
  "name": "import-x-raw-repro",
  "private": true,
  "type": "module",
  "devDependencies": {
    "eslint": "9.39.2",
    "eslint-plugin-import-x": "4.16.1"
  }
}

eslint.config.js

import importX from 'eslint-plugin-import-x';

export default [
  {
    files: ['**/*.js'],
    plugins: {
      'import-x': importX,
    },
    rules: {
      'import-x/no-unresolved': 'error',
    },
    languageOptions: {
      sourceType: 'module',
      ecmaVersion: 'latest',
    },
  },
];

index.js

import example from './example.ts?raw';

console.log(example);

index-no-query.js

import example from './example.ts';

console.log(example);

example.ts

export const value = 1;

Run:

npm install
npx eslint index.js
npx eslint index-no-query.js

Actual

index.js fails with:

1:21  error  Casing of ./example.ts?raw does not match the underlying filesystem  import-x/no-unresolved

index-no-query.js passes.

Expected

Both files should pass.

If the resolver accepts ./example.ts?raw, no-unresolved should not report a casing mismatch for the same import.

Notes

This looks like the macOS-only case check may be using a resolved path that still includes the query string when it compares the basename against directory entries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions