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

Eslint plugin: Use @typescript-eslint/no-duplicate-imports in TS projects #34055

Merged
merged 2 commits into from
Aug 13, 2021

Conversation

walbo
Copy link
Member

@walbo walbo commented Aug 12, 2021

Description

Update eslint plugin to use @typescript-eslint/no-duplicate-imports on TypeScript projects. This rule extends the base eslint/no-duplicate-imports rule and adds support for type-only import and export.

See https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-duplicate-imports.md

This allows importing types and exports from the same package without trowing an error. All files that import types today in Gutenberg adds a // eslint-disable-next-line no-duplicate-imports to avoid it. This PR fixes so these are no longer needed.

How has this been tested?

Locally by running npm run lint-js

Types of changes

Code quality

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@gziolo gziolo added [Tool] ESLint plugin /packages/eslint-plugin [Type] Bug An existing feature does not function as intended labels Aug 13, 2021
Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

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

This is a really nice improvement. I'm glad it's finally resolved.

I tested it locally and it works perfectly fine. It still reports an error when you write two import statements that reference the same file when not bringing types.

@gziolo gziolo merged commit f2393cb into WordPress:trunk Aug 13, 2021
@github-actions github-actions bot added this to the Gutenberg 11.4 milestone Aug 13, 2021
@walbo walbo deleted the ts/eslint-no-dup-imports branch August 13, 2021 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Tool] ESLint plugin /packages/eslint-plugin [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants