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

feat: add svelte/restrict-mustache-expressions rule #840

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

AlbertMarashi
Copy link

@AlbertMarashi AlbertMarashi commented Aug 9, 2024

Being able to use non-stringifiable objects in string contexts is a major footgun and surface area for bugs. This new rule creates lint errors for situation such as:

<script lang="ts">

let foo = {
  bar: true
}
</script>
<a href="/foo/{foo}">foo</a>

where the href is serialised into "/foo/[object Object]" which is almost never wanted behavior, and these types of bugs can easily be introduced through refactoring

Related: #747

Copy link

changeset-bot bot commented Aug 9, 2024

🦋 Changeset detected

Latest commit: e1c168d

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

This PR includes changesets to release 1 package
Name Type
eslint-plugin-svelte Minor

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

@AlbertMarashi AlbertMarashi changed the title Add restrict-mustache-expressions rule Feat: add restrict-mustache-expressions rule Aug 9, 2024
@AlbertMarashi AlbertMarashi changed the title Feat: add restrict-mustache-expressions rule feat: add restrict-mustache-expressions rule Aug 9, 2024
@AlbertMarashi AlbertMarashi changed the title feat: add restrict-mustache-expressions rule feat: add svelte/restrict-mustache-expressions rule Aug 9, 2024
@AlbertMarashi AlbertMarashi marked this pull request as draft August 9, 2024 18:40
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.

1 participant