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-duplicate-imports should ignore export * #12760

Closed
mdjermanovic opened this issue Jan 8, 2020 · 3 comments · Fixed by #14238
Closed

no-duplicate-imports should ignore export * #12760

mdjermanovic opened this issue Jan 8, 2020 · 3 comments · Fixed by #14238
Assignees
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules

Comments

@mdjermanovic
Copy link
Member

Tell us about your environment

  • ESLint Version: v6.8.0
  • Node Version: v12.14.0
  • npm Version: v6.13.4

What parser (default, Babel-ESLint, etc.) are you using?

default

Please show your full configuration:

Configuration
module.exports = {
    parserOptions: {
        ecmaVersion: 2015,
        sourceType: "module"
    },
};

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

Online Demo Link

/* eslint no-duplicate-imports: ["error", { "includeExports": true }] */

import foo from 'foo';
export * from 'foo';

import { a } from 'bar';
export * from 'bar';

import * as ns from 'baz';
export * from 'baz';

export { a as b } from 'quux';
export * from 'quux';

export { default } from 'quuux';
export * from 'quuux';
eslint index.js

What did you expect to happen?

I think no errors. The rule requires only 1 import/export statement per source module. I'm not sure how to rewrite any of these 5 examples to achieve that. Or any other code with export * and another import/export from the same source, including the test case:

{
    code: "import os from \"os\";\nexport * from \"os\";",
    options: [{ includeExports: true }],
    errors: [{ messageId: "exportAs", data: { module: "os" }, type: "ExportAllDeclaration" }]
}

If I'm not missing something, this rule should probably ignore export *.

What actually happened? Please include the actual, raw output from ESLint.

Errors for all 5 export * declarations:

   4:1  error  'foo' export is duplicated as import  no-duplicate-imports
   7:1  error  'bar' export is duplicated as import  no-duplicate-imports
  10:1  error  'baz' export is duplicated as import  no-duplicate-imports
  13:1  error  'quux' export is duplicated           no-duplicate-imports
  16:1  error  'quuux' export is duplicated          no-duplicate-imports

Are you willing to submit a pull request to fix this bug?

Yes.

@mdjermanovic mdjermanovic added bug ESLint is working incorrectly rule Relates to ESLint's core rules evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Jan 8, 2020
@kaicataldo kaicataldo added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Jan 9, 2020
@kaicataldo
Copy link
Member

Agreed!

@mdjermanovic
Copy link
Member Author

I'm working on this

@eslint-deprecated
Copy link

Unfortunately, it looks like there wasn't enough interest from the team
or community to implement this change. While we wish we'd be able to
accommodate everyone's requests, we do need to prioritize. We've found
that accepted issues failing to be implemented after 90 days tend to
never be implemented, and as such, we close those issues.
This doesn't mean the idea isn't interesting or useful, just that it's
not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

@mdjermanovic mdjermanovic self-assigned this Apr 9, 2020
@mdjermanovic mdjermanovic removed the auto closed The bot closed this issue label Apr 9, 2020
@mdjermanovic mdjermanovic reopened this Apr 9, 2020
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue Mar 21, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue Mar 21, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue Mar 23, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 9, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 9, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 9, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 9, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 9, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 9, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 9, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 9, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 9, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 9, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 9, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 9, 2021
…slint#13180) & Fix: Ignore re-export all in no-duplicate-imports (fixes eslint#12760)
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 9, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 23, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 23, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 23, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 23, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 23, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 27, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 27, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 27, 2021
boutahlilsoufiane added a commit to boutahlilsoufiane/eslint that referenced this issue May 30, 2021
mdjermanovic pushed a commit that referenced this issue Jun 4, 2021
…) (#14238)

* Fix: ignore unmergable imports when checking no-duplicate-imports (fixes #13180) & Fix: Ignore re-export all in no-duplicate-imports (fixes #12760)

* Fix: ignore unmergable imports when checking no-duplicate-imports (fixes #13180) & Fix: Ignore re-export all in no-duplicate-imports (fixes #12760)

* Fix: ignore unmergable imports when checking no-duplicate-imports (fixes #13180) & Fix: Ignore re-export all in no-duplicate-imports (fixes #12760)

* Fix: ignore unmergable imports when checking no-duplicate-imports (fixes #13180) & Fix: Ignore re-export all in no-duplicate-imports (fixes #12760)

* Fix: ignore unmergable imports when checking no-duplicate-imports (fixes #13180) & Fix: Ignore re-export all in no-duplicate-imports (fixes #12760)

* Fix: ignore unmergable imports when checking no-duplicate-imports (fixes
 #13180) & Fix: Ignore re-export all in no-duplicate-imports (fixes #12760)

* Fix: ignore unmergable imports when checking no-duplicate-imports (fixes
 #13180) & Fix: Ignore re-export all in no-duplicate-imports (fixes #12760)

* Fix: ignore unmergable imports when checking no-duplicate-imports (fixes
 #13180) & Fix: Ignore re-export all in no-duplicate-imports (fixes #12760)

* Fix: ignore unmergable imports when checking no-duplicate-imports (fixes #13180) & Fix: Ignore re-export all in no-duplicate-imports (fixes #12760)
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Dec 2, 2021
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Dec 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
2 participants