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

@import linter for bundlers #1083

Conversation

romainmenke
Copy link
Member

@romainmenke romainmenke commented Aug 15, 2023

This covers the main issues authors can encounter when bundling CSS :

  • bad ordering of remote (https://) and local imports
  • ambiguous notations that have different results when viewed as file paths or urls
  • case sensitivity
  • query params
  • url anchors

We might add some more later, but I think this is already a good base set of issues it can detect.

@romainmenke

This comment was marked as resolved.

Comment on lines +115 to +116
const url = new URL(uri, 'https://454c178c-dadf-429e-8d9c-88e032826008.com');
if (url.host && url.host !== '454c178c-dadf-429e-8d9c-88e032826008.com') {
Copy link
Member

Choose a reason for hiding this comment

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

Why this domain? Clever though!

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted something that is extremely unlikely to be used in a real url and generating a new uuid is easy :)

I really which there was some builtin API to detect if a given string is a full url or only a relative path.

Copy link
Member

@Antonio-Laguna Antonio-Laguna left a comment

Choose a reason for hiding this comment

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

This LGTM! Nice to be able to lint these!

@romainmenke romainmenke merged commit ef059f8 into main Sep 5, 2023
7 checks passed
@romainmenke romainmenke deleted the at-import-linter-for-bundlers--impartial-pygmy-marmoset-dcd64d6c43 branch September 5, 2023 16:52
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.

2 participants