Skip to content

feat: added the prefer-svelte-reactivity rule #1151

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

marekdedic
Copy link
Contributor

@marekdedic marekdedic commented Mar 24, 2025

Copy link

changeset-bot bot commented Mar 24, 2025

🦋 Changeset detected

Latest commit: 0996bb0

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

@marekdedic marekdedic force-pushed the prefer-svelte-reactivity branch from d061a99 to 6999c90 Compare March 24, 2025 09:03
Copy link
Contributor

github-actions bot commented Mar 24, 2025

Try the Instant Preview in Online Playground

ESLint Online Playground

Install the Instant Preview to Your Local

npm i https://pkg.pr.new/eslint-plugin-svelte@0996bb0

Published Instant Preview Packages:

View Commit

@marekdedic marekdedic force-pushed the prefer-svelte-reactivity branch 2 times, most recently from 5cede00 to f44a65c Compare March 24, 2025 09:25
Copy link
Member

@baseballyama baseballyama left a comment

Choose a reason for hiding this comment

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

I think we need to add tests for .svelte.js files also.

@marekdedic
Copy link
Contributor Author

I think we need to add tests for .svelte.js files also.

Yes, I wanted to ask about whether that's something we're set up to do, I couldn't find any such tests on the repo...

@marekdedic
Copy link
Contributor Author

@ota-meshi Can you please take a look at the test file? I tried the solution from eslint-community/eslint-utils#249 (comment), but it didn't work for me :/

@ota-meshi
Copy link
Member

@marekdedic What have you tried? Have you added URL here?

@marekdedic marekdedic force-pushed the prefer-svelte-reactivity branch from 7603712 to d1230de Compare May 3, 2025 10:11
@marekdedic
Copy link
Contributor Author

@marekdedic What have you tried? Have you added URL here?

That's exactly what I tried, but it didn't work :(

@ota-meshi
Copy link
Member

ota-meshi commented May 8, 2025

Is it url01-input.svelte that you're saying didn't work? I've tried adding URL: 'readonly', URLSearchParams: 'readonly' to globals in your repository and it seems to work fine.

image

@marekdedic marekdedic force-pushed the prefer-svelte-reactivity branch 6 times, most recently from 18dad7e to dcf3e34 Compare May 8, 2025 14:09
@marekdedic
Copy link
Contributor Author

Ok, I was adding it in a different place and the value got overriden, thanks :)

@marekdedic marekdedic marked this pull request as ready for review May 8, 2025 14:13
@marekdedic marekdedic requested a review from baseballyama May 8, 2025 14:13
@marekdedic marekdedic force-pushed the prefer-svelte-reactivity branch from dcf3e34 to 1319f62 Compare May 12, 2025 15:59
@marekdedic marekdedic force-pushed the prefer-svelte-reactivity branch 2 times, most recently from 30e17ee to 8e74c27 Compare May 28, 2025 16:00
@marekdedic marekdedic force-pushed the prefer-svelte-reactivity branch 2 times, most recently from 169791a to af1cb8f Compare June 7, 2025 08:32
@marekdedic marekdedic force-pushed the prefer-svelte-reactivity branch from af1cb8f to 1689df3 Compare June 7, 2025 15:07
@marekdedic marekdedic force-pushed the prefer-svelte-reactivity branch 9 times, most recently from 23c8253 to 586dca9 Compare June 9, 2025 15:36
@marekdedic marekdedic requested a review from ota-meshi June 9, 2025 15:41
@marekdedic
Copy link
Contributor Author

I have re-implemented the PR so that it checks all the property calls and only reports if the variable is mutated.

Copy link
Member

@ota-meshi ota-meshi left a comment

Choose a reason for hiding this comment

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

Awesome! Looks almost good to me, but I have two comments.

@marekdedic marekdedic force-pushed the prefer-svelte-reactivity branch from 586dca9 to 064f100 Compare June 10, 2025 16:25
@marekdedic marekdedic force-pushed the prefer-svelte-reactivity branch from 064f100 to 0996bb0 Compare June 10, 2025 16:39
@marekdedic marekdedic requested a review from ota-meshi June 10, 2025 16:43
Copy link
Member

@ota-meshi ota-meshi left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

@ota-meshi
Copy link
Member

@baseballyama Just to be sure, could you please check this PR?
This is a new rule that is included in the recommended config.

@baseballyama
Copy link
Member

I will review it within a few days.👍

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add rule prefer-svelte-reactivity
3 participants