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 does not work with export class #1368

Closed
ehmicky opened this issue May 28, 2019 · 6 comments · Fixed by #1371
Closed

no-unused-modules does not work with export class #1368

ehmicky opened this issue May 28, 2019 · 6 comments · Fixed by #1371

Comments

@ehmicky
Copy link

ehmicky commented May 28, 2019

index.js:

import { Example } from './foo.js'
export { Example }

foo.js:

export class Example {}

.eslintrc.yml:

parserOptions:
  ecmaVersion: 2019
  sourceType: module
plugins: [import]
rules:
  import/no-unused-modules: [2, {missingExports: true}]

Then:

$ eslint
/home/user/example/foo.js
  1:1  error  No exports found                                 import/no-unused-modules

✖ 1 problem (1 error, 0 warnings)

However the following works:

class Example {}
export { Example }

eslint: 5.16.0
eslint-plugin-import: 2.17.3
node: 12.3.1
OS: Ubuntu 19.04

golopot added a commit to golopot/eslint-plugin-import that referenced this issue May 29, 2019
golopot added a commit to golopot/eslint-plugin-import that referenced this issue May 29, 2019
@ehmicky
Copy link
Author

ehmicky commented May 30, 2019

Thanks for the fix! 🎉

@nathanielcook
Copy link

It seems like this same problem exists for export module Example, or am I misinterpreting?

@ljharb
Copy link
Member

ljharb commented Feb 18, 2020

@nathanielcook export module is not valid syntax.

@nathanielcook
Copy link

@ljharb It is in TypeScript; sorry for not mentioning that.

@ljharb
Copy link
Member

ljharb commented Feb 18, 2020

In that case, please feel free to file a PR to add it :-)

@nathanielcook
Copy link

nathanielcook commented Feb 19, 2020

By the way, I see now that the problem also exists for export enum and export interface.

Edit: export function as well.

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

Successfully merging a pull request may close this issue.

3 participants