Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no-duplicates rule with query-string params #1107

Closed
pcorpet opened this issue May 27, 2018 · 3 comments · Fixed by #1108
Closed

no-duplicates rule with query-string params #1107

pcorpet opened this issue May 27, 2018 · 3 comments · Fixed by #1108

Comments

@pcorpet
Copy link
Contributor

pcorpet commented May 27, 2018

I'm using the svg-transform-loader which transforms SVG files on the fly but then I end up importing a file several times but with different options a query string parameter:

import rocketIcon from 'images/rocket.svg'
import blackRocketIcon from 'images/rocket.svg?fill=#000'

eslint is not happy with that and raises a import/no-duplicates error.

Any idea how I should setup my config so that this plugin actually understands that even if they are based on the same file, it's a valid different import?

@pcorpet
Copy link
Contributor Author

pcorpet commented May 27, 2018

Note that it looks a bit like #682, but there it was using different loaders: here we're using the same loader but with different options.

@ljharb
Copy link
Member

ljharb commented May 28, 2018

These are indeed two different URLs/modules in browsers, but in node, that’s still undetermined.

Seems like perhaps an option would be good, and we can decide what to do with it later once node ships ESM.

pcorpet added a commit to pcorpet/eslint-plugin-import that referenced this issue May 28, 2018
pcorpet added a commit to pcorpet/eslint-plugin-import that referenced this issue May 28, 2018
@pcorpet
Copy link
Contributor Author

pcorpet commented May 28, 2018

@ljharb I've sent a PR with an option. I'm not proud of the name though, so feel free to suggest better names.

pcorpet added a commit to pcorpet/eslint-plugin-import that referenced this issue Jun 13, 2018
pcorpet added a commit to pcorpet/eslint-plugin-import that referenced this issue Jun 13, 2018
pcorpet added a commit to pcorpet/eslint-plugin-import that referenced this issue Jul 19, 2018
pcorpet added a commit to pcorpet/eslint-plugin-import that referenced this issue Jul 19, 2018
@ljharb ljharb closed this as completed in f12ae59 Dec 6, 2019
marcusdarmstrong pushed a commit to marcusdarmstrong/eslint-plugin-import that referenced this issue Dec 9, 2019
…se positives when using some webpack loaders.

Fixes import-js#1107.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants