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: update warning codes for svelte5 #1044

Merged
merged 4 commits into from
Dec 12, 2024
Merged

fix: update warning codes for svelte5 #1044

merged 4 commits into from
Dec 12, 2024

Conversation

dominikg
Copy link
Member

needs to be backported to v-p-s@4 too

@@ -114,6 +114,7 @@ export function enhanceCompileError(err, originalCode, preprocessors) {

// Handle incorrect CSS preprocessor usage
if (err.code === 'css-syntax-error') {
Copy link
Member Author

Choose a reason for hiding this comment

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

@dummdidumm whats the new way to identify css syntax errors? i looked but didn't find the corrosponding code in svelte5

Copy link
Member

Choose a reason for hiding this comment

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

There are two things you can look for:

  • any error starting with css_ - right now it's css_expected_identifier, css_selector_invalid and css_empty_declaration
  • more general errors: expected_token and unexpected_eof - though these could also happen in other parts outside the style sheet (not sure if that is a problem)

Copy link
Member Author

Choose a reason for hiding this comment

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

added with generic startswith css_ , technically this could introduce false positives for users who don't use a css preprocessor, so if we want to play it conservative, we'd have to use a hardcoded list at the cost of that getting out of date if new codes are added.

@dominikg
Copy link
Member Author

see sveltejs/svelte#14654

@dominikg dominikg merged commit e41edff into main Dec 12, 2024
6 checks passed
@dominikg dominikg deleted the fix/css-warning-code branch December 12, 2024 11:46
@github-actions github-actions bot mentioned this pull request Dec 12, 2024
dominikg added a commit that referenced this pull request Dec 12, 2024
* fix: update warning codes for svelte5

* fix(audit): bump nanoid

* fix: replace css error code detection so that it works for svelte5

* chore: update changeset

(cherry picked from commit e41edff)
dominikg added a commit that referenced this pull request Dec 12, 2024
* fix: update warning codes for svelte5

* fix(audit): bump nanoid

* fix: replace css error code detection so that it works for svelte5

* chore: update changeset

(cherry picked from commit e41edff)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants