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

chore: align warning and error objects, add frame property #12325

Closed
wants to merge 2 commits into from

Conversation

dummdidumm
Copy link
Member

@dummdidumm dummdidumm commented Jul 6, 2024

This aligns warning and error objects to contain the same properties and have their toString methods return the same shape. It also adds back the frame property that got lost in the Svelte 4->5 transition. The only difference to Svelte 4 now is a slightly adjusted toString property (which is consistent between warnings and errors now) and a position property that contains a tuple of start/end offsets instead of a pos property only containing the start offset

closes #12151

FYI @Conduitry - is this what you had in mind?

If we wanted we could consolidate this further by giving both a common base class which they then abstract from. Should we do that? Edit: Implemented in alternative PR #12326 - choose one.

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

This aligns warning and error objects to contain the same properties and have their toString methods return the same shape. It also adds back the `frame` property that got lost in the Svelte 4->5 transition. The only difference to Svelte 4 now is a slightly adjusted toString property (which is consistent between warnings and errors now) and a `position` property that contains a tuple of start/end offsets instead of a `pos` property only containing the start offset

closes #12151
Copy link

changeset-bot bot commented Jul 6, 2024

🦋 Changeset detected

Latest commit: f3f6344

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dominikg
Copy link
Member

dominikg commented Jul 6, 2024

great!

@Conduitry
Copy link
Member

Yup! This is what I had in mind. Either this or #12326 would satisfy my desire here.

@dummdidumm dummdidumm closed this Jul 8, 2024
@dummdidumm dummdidumm deleted the consolidate-warnings-errors branch July 8, 2024 15:09
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.

Svelte 5: Reintroduce frame/pos/toString() in compiler warnings
4 participants