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

Fix '.' and '..' imports #11142

Merged

Conversation

colin-grant-work
Copy link
Contributor

@colin-grant-work colin-grant-work commented May 11, 2022

What it does

Imports from index.ts files in the same directory as a file or a higher level almost always entail circular dependencies. That doesn't have to be a catastrophe, but it's not a good idea. This PR adds a lint rule forbidding such imports and fixes those cases that currently exist. This reduces the number of warnings from webpack from 95 to 81.

How to test

  1. Assert that there are no more imports from '.' or from '..' in our code.
  2. Add such an import to a file.
  3. Observe that the import is treated as a lint error.
  4. Check that the application builds and runs as expected.

Review checklist

Reminder for reviewers

@colin-grant-work colin-grant-work added the quality issues related to code and application quality label May 11, 2022
Copy link
Member

@paul-marechal paul-marechal left a comment

Choose a reason for hiding this comment

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

LGTM, the ESLint rule is like icing on the cake ;)

@paul-marechal paul-marechal merged commit d6e571e into eclipse-theia:master May 12, 2022
@colin-grant-work colin-grant-work deleted the chore/no-index-imports branch May 12, 2022 15:46
@colin-grant-work colin-grant-work added this to the 1.26.0 milestone May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
quality issues related to code and application quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants