eslint-plugin-import
eslint-plugin-import copied to clipboard
`import/no-unresolved` has false positives for search query
Queries are supported: https://nodejs.org/api/esm.html#esm_url_based_paths
Using [email protected]
and [email protected]
Gross, but you're right, they are :-)
Is there a workaround that anyone stumbled upon until this gets fixed?
Maybe we need something like eslint-import-resolver-query
?
I think the node resolver needs to handle them by default.
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"
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.
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'
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