Skip to content

Conversation

dominikg
Copy link
Member

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

const additionalMessages = [];

// 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