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-unused-modules: ignore flow type exports #1906

Merged

Conversation

nicolashenry
Copy link
Contributor

@nicolashenry nicolashenry commented Sep 22, 2020

Fixes #1564 :

  • Ignore Flow type exports
  • Add tests for Flow type imports/exports
  • Remove Typescript tests using "babel-eslint" (because resulting types seems to be Flow types)
  • Add some missing cases in Typescript tests
  • Add some tests for Typescript type imports

@coveralls
Copy link

coveralls commented Sep 22, 2020

Coverage Status

Coverage decreased (-0.002%) to 97.904% when pulling 5ade156 on nicolashenry:feature/ignore-flow-type-imports into c51b6a9 on benmosher:master.

@nicolashenry nicolashenry changed the title no-unused-modules: ignore flow type imports no-unused-modules: ignore flow type exports Sep 22, 2020
@ljharb ljharb added the flow label Sep 27, 2020
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.

LGTM overall, just a few comments!

],
invalid: [
test({
options: unusedExportsTypescriptOptions,
code: `export const b = 2;`,
parser: parser,
filename: testFilePath('./no-unused-modules/typescript/file-ts-b.ts'),
filename: testFilePath('./no-unused-modules/typescript/file-ts-b-2.ts'),
Copy link
Member

Choose a reason for hiding this comment

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

is there a way we could rework these tests so we don't have to change these existing ones, and so "b-2" could have a more meaningful name for the new tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I needed to split them into files exporting unused exports (the files ending with "-2") and the files exporting used exports (the files without "-2") because the existing tests was only actually testing the unused case. I will rename those with better names.

@@ -0,0 +1,3 @@
// @flow strict
export type Bar = number;
export interface BarInterface {};
Copy link
Member

Choose a reason for hiding this comment

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

please ensure every file has a trailing newline

@ljharb ljharb force-pushed the feature/ignore-flow-type-imports branch from aec5361 to 5ade156 Compare October 3, 2020 05:33
@ljharb ljharb merged commit 5ade156 into import-js:master Oct 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

no-unused-modules does not work properly with flow types exports
3 participants