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-default-export #22

Closed
benmosher opened this issue Apr 8, 2015 · 5 comments
Closed

no-duplicate-default-export #22

benmosher opened this issue Apr 8, 2015 · 5 comments
Milestone

Comments

@benmosher
Copy link
Member

Flag subsequent export default ... statements if more than one is encountered in a given file.

@benmosher benmosher modified the milestones: 0.4.1, v0.4.1 Apr 8, 2015
@benmosher
Copy link
Member Author

fixed in master, also duplicate named exports (see import/export rule)

@benmosher benmosher added this to the v0.7.3 milestone Jul 20, 2015
@AndrewLeedham
Copy link
Contributor

AndrewLeedham commented Dec 31, 2019

@benmosher @ljharb Came across an issue with this feature, thought I would open a discussion here:

The following example causes 3 error Multiple default exports import/export errors, but there is only technically 1 default export the other 2 are overloads.

export default function foo(param: string): boolean;
export default function foo(param: string, param1: number): boolean;
export default function foo(param: string, param1?: number): boolean {
  return param && param1;
}

There seems to be some code for checking overloads: https://github.com/benmosher/eslint-plugin-import/blob/master/src/rules/export.js#L37-L40 but this does not seem to catch this case. I added some debug logs in and the rough contents of namespace is:

root: {
  default: [
    {
       type: 'ExportDefaultDeclaration'
    },
    {
       type: 'ExportDefaultDeclaration'
    },
    {
       type: 'ExportDefaultDeclaration'
    }
  ]
}

I am running this in the following environment:

  • eslint: 5.16.0
  • eslint-plugin-import: 2.19.1
  • eslint-import-resolver-typescript: 2.0.0
  • typescript: 3.7.2
  • @typescript-eslint/parser: 2.13.0

@ljharb
Copy link
Member

ljharb commented Dec 31, 2019

Please file a new issue for this (altho i think there already is one)

@AndrewLeedham
Copy link
Contributor

This one? #1357

@ljharb
Copy link
Member

ljharb commented Dec 31, 2019

That’s fixed in v2.19, so perhaps a new issue is best.

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

No branches or pull requests

3 participants