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

support export type named exports from typescript #1304

Merged
merged 4 commits into from
Apr 10, 2019

Conversation

bradennapier
Copy link
Contributor

@bradennapier bradennapier commented Mar 19, 2019

Adds support so that export type named imports work with this plugin.

Resolves #1282

@coveralls
Copy link

coveralls commented Mar 19, 2019

Coverage Status

Coverage remained the same at 97.862% when pulling 49af9d8 on bradennapier:feature/typescript-export-type into 3aefa79 on benmosher:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+3.2%) to 97.336% when pulling 4d93618 on bradennapier:feature/typescript-export-type into 206d676 on benmosher:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+3.2%) to 97.336% when pulling 4d93618 on bradennapier:feature/typescript-export-type into 206d676 on benmosher:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+3.2%) to 97.336% when pulling 4d93618 on bradennapier:feature/typescript-export-type into 206d676 on benmosher:master.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Can you please add some test cases?

@kjleitz
Copy link

kjleitz commented Mar 27, 2019

@ljharb I was checking out the bug this fixes, and I'm just curious—what would a test case look like for this? I'm not sure I see any existing examples of specs for the other named declaration exports (just grepped for a few of them)

@bradennapier
Copy link
Contributor Author

Yeah I’ve been meaning to ask that. In fact it would seem this somehow increased coverage although not sure how or why.

It’s a single case statement added and only covers a typescript type alias.

@ljharb
Copy link
Member

ljharb commented Mar 28, 2019

The OP in the linked issue seems to have a test case?

schmod pushed a commit to schmod/eslint-plugin-import that referenced this pull request Apr 1, 2019
@schmod
Copy link
Contributor

schmod commented Apr 1, 2019

Here's a commit that adds test-coverage. (GitHub won't let me PR it directly into @bradennapier's branch for some reason)

This turned out to be a weird one -- there are already tests for this functionality, but they were passing. The root issue actually appears to be a regression that only appears when switching from typescript-eslint-parser to @typescript-eslint/parser. I've updated the tests to run against both parsers.

typescript-eslint-parser was recently deprecated, but is widely-used to the extent where we should avoid deliberately breaking support for it in the short-term.

@ljharb ljharb force-pushed the feature/typescript-export-type branch from 4d93618 to 035ddb3 Compare April 1, 2019 18:27
ljharb pushed a commit to bradennapier/eslint-plugin-import that referenced this pull request Apr 1, 2019
@ljharb
Copy link
Member

ljharb commented Apr 1, 2019

@schmod thanks; i've added that commit to this branch.

package.json Show resolved Hide resolved
@ljharb ljharb force-pushed the feature/typescript-export-type branch from 035ddb3 to c3b5707 Compare April 2, 2019 03:00
ljharb pushed a commit to bradennapier/eslint-plugin-import that referenced this pull request Apr 2, 2019
@ljharb
Copy link
Member

ljharb commented Apr 2, 2019

@schmod looks like tests are failing in eslint 2 and 3.

@schmod
Copy link
Contributor

schmod commented Apr 3, 2019

Huh. I'm guessing that we've uncovered an existing incompatibility between @typescript-eslint/parser and eslint 3.

Given that @typescript-eslint/parser has a peerDependency on eslint 5.x, I guess we'll just want to skip any tests using that parser on ESLint <5.

@schmod
Copy link
Contributor

schmod commented Apr 3, 2019

@ljharb schmod@8355aaf

@ljharb ljharb force-pushed the feature/typescript-export-type branch from c3b5707 to eeff95f Compare April 6, 2019 06:43
ljharb pushed a commit to bradennapier/eslint-plugin-import that referenced this pull request Apr 6, 2019
@ljharb
Copy link
Member

ljharb commented Apr 6, 2019

@schmod eslint 2 and 3 tests are still failing with that commit :-/

@schmod
Copy link
Contributor

schmod commented Apr 6, 2019

Huh, I'll have to dig in. They passed on my local machine.

@schmod
Copy link
Contributor

schmod commented Apr 8, 2019

Fun times. The tests pass on MacOS (using the dep-time-travel.sh script and all), but fail on Linux/Docker, and I have no clue why.

I've narrowed this down to @eslint-typescript/parser merely being installed (which shouldn't matter?!). I'll add a workaround to dep-time-travel to remove the new parser when it isn't being used by the tests (ie. on ESLint <5), but this is a pretty spooky bug, TBH.

Commit: 1914fd6

@tpakhoa1996
Copy link

Does this one also include export import SomeEnum = SomeModule.SomeEnum;

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

Successfully merging this pull request may close these issues.

TypeScript export and import/named rule
6 participants