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

[extensions] Alerting on missing extension when using query string #1567

Closed
pcorpet opened this issue Dec 11, 2019 · 3 comments · Fixed by #1572
Closed

[extensions] Alerting on missing extension when using query string #1567

pcorpet opened this issue Dec 11, 2019 · 3 comments · Fixed by #1572

Comments

@pcorpet
Copy link
Contributor

pcorpet commented Dec 11, 2019

Since last release 2.19.1 (although I did not check 2.19.0), I get some new errors due to my imports using query strings:

error  Missing file extension "svg" for "images/logo.svg?fill=#fff"  import/extensions

This is because I use a webpack loader that transforms the SVG if I provide the right query string, however I would expect eslint-plugin-import to find that I have an .svg in there.

I think that this bug was always there bug got revealed due to #1521 fixing #1518.

pcorpet added a commit to bayesimpact/docker-react that referenced this issue Dec 11, 2019
…n 2.19.1. (#1584)"

This reverts commit d5a4fbd.

This triggers errors for imports using a query string.
import-js/eslint-plugin-import#1567
pcorpet added a commit to bayesimpact/docker-react that referenced this issue Dec 11, 2019
…n 2.19.1. (#1584)" (#1590)

This reverts commit d5a4fbd.

This triggers errors for imports using a query string.
import-js/eslint-plugin-import#1567
@ljharb
Copy link
Member

ljharb commented Dec 12, 2019

It seems like you want to configure the import/extensions rule to forbid extensions on svg imports, if you always want the query string https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md

However, this actually seems like the logic should be ignoring query strings when considering if it has the extension or not.

@pcorpet
Copy link
Contributor Author

pcorpet commented Dec 12, 2019

Thanks @ljharb however I still want some SVG without a query string but with an extension so I do not want to forbid extensions on SVG imports.

@ljharb
Copy link
Member

ljharb commented Dec 12, 2019

Fair enough, a PR that ignores the query string would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants