eslint-plugin-import icon indicating copy to clipboard operation
eslint-plugin-import copied to clipboard

`import/no-unresolved` has false positives for search query

Open SimenB opened this issue 4 years ago • 10 comments

image

Queries are supported: https://nodejs.org/api/esm.html#esm_url_based_paths

Using [email protected] and [email protected]

SimenB avatar Apr 29 '20 08:04 SimenB

Gross, but you're right, they are :-)

ljharb avatar Apr 29 '20 18:04 ljharb

Is there a workaround that anyone stumbled upon until this gets fixed?

cansin avatar Oct 21 '20 20:10 cansin

Maybe we need something like eslint-import-resolver-query ?

Airkro avatar Jan 14 '21 08:01 Airkro

I think the node resolver needs to handle them by default.

ljharb avatar Jan 26 '21 14:01 ljharb

Just a note on a common use-case that runs into this issue: https://symfony.com/doc/current/frontend/encore/vuejs.html#using-scoped-styles. Namely that this pattern seems to be the recommended way to invoke CSS Modules in webpack-encore:

import styles from './Component.css?module' // suffix with "?module"

mattsbennett avatar Oct 07 '21 21:10 mattsbennett

That seems like a super terrible recommendation, but thanks for the context.

The main challenge here is that resolve, and thus this plugin, does not support ESM yet - only transpiled ESM.

ljharb avatar Oct 07 '21 22:10 ljharb

Another example: This library uses the query in imports for dynamically import different things.: https://github.com/jpkleemans/vite-svg-loader

import iconRaw from './my-icon.svg?raw'
import IconComponent from './my-icon.svg?component'
import iconUrl from './my-icon.svg?url'

AliLozano avatar Jun 23 '22 02:06 AliLozano

In eslint-import-resolver-typescript, this is implemented without relied on resolve module.

https://github.com/import-js/eslint-import-resolver-typescript/blob/master/src/index.ts#L223-L230

JounQin avatar Jul 19 '22 20:07 JounQin