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: add rule to detect erroneous external imports #961

Merged
merged 19 commits into from
Nov 6, 2023

Conversation

iOvergaard
Copy link
Collaborator

@iOvergaard iOvergaard commented Nov 2, 2023

This new rule ensures that we won't accidentally make imports from external libraries elsewhere. The only allowed places to do so are in tests, stories, and src/external/* modules.

We won't notice these errors in the dev-server, because Vite knows how to handle them, but it WILL become a problem in the compiled output used in the CMS.

BAD:

import { html } from 'lit';

GOOD:

import { html } from '@umbraco-cms/backoffice/external/lit';

Copy link

github-actions bot commented Nov 3, 2023

Azure Static Web Apps: Your stage site is ready! Visit it here: https://ambitious-stone-0033b3603-961.westeurope.1.azurestaticapps.net

Copy link

github-actions bot commented Nov 3, 2023

Azure Static Web Apps: Your stage site is ready! Visit it here: https://ambitious-stone-0033b3603-961.westeurope.1.azurestaticapps.net

Copy link

github-actions bot commented Nov 3, 2023

Azure Static Web Apps: Your stage site is ready! Visit it here: https://ambitious-stone-0033b3603-961.westeurope.1.azurestaticapps.net

Copy link
Contributor

@madsrasmussen madsrasmussen left a comment

Choose a reason for hiding this comment

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

Really great to get this rule in place! You found some weird imports here an there.

I only have one request regarding the rule name. It can be misunderstood because we call our own module "external".

.eslintrc.json Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Nov 6, 2023

Azure Static Web Apps: Your stage site is ready! Visit it here: https://ambitious-stone-0033b3603-961.westeurope.1.azurestaticapps.net

Copy link
Member

@nielslyngsoe nielslyngsoe left a comment

Choose a reason for hiding this comment

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

Looks good to me :-)

@iOvergaard iOvergaard merged commit 006f30d into main Nov 6, 2023
6 checks passed
@iOvergaard iOvergaard deleted the feature/eslint-no-external-imports branch November 6, 2023 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants