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: add a query-string option to handle false positives wh… #1108
Conversation
…se positives when using some webpack loaders. Fixes import-js#1107.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add to the rule schema.
Why a string of “different”? What other options are allowed?
docs/rules/no-duplicates.md
Outdated
@@ -35,6 +35,31 @@ The motivation is that this is likely a result of two developers importing diffe | |||
names from the same module at different times (and potentially largely different | |||
locations in the file.) This rule brings both (or n-many) to attention. | |||
|
|||
### Query Strings | |||
|
|||
By default, this rule ignores query strings (i.e. paths followed by a question mark), and thus imports from `./mod?a` and `./mod?b` will be considered as duplicates. However you can use the option `query-string` to handle them as different (usually because a webpack loader would actually resolve those imports differently). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
primarily because browsers will resolve them differently; a webpack loader is secondary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Schema added to the rule. I had the impression that several options could be offered, but let's keep it simple for now as I don't have any immediate usecase. |
@benmosher @jfmengels can I get a review please? |
0328e99
to
7aa4ce2
Compare
@ljharb what do we need to do to get this pull request merged? |
…en using some webpack loaders. Fixes #1107.