Skip to content

Add rule prefer-svelte-reactivity #1071

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
marekdedic opened this issue Feb 11, 2025 · 0 comments · May be fixed by #1151
Open

Add rule prefer-svelte-reactivity #1071

marekdedic opened this issue Feb 11, 2025 · 0 comments · May be fixed by #1151
Labels
enhancement New feature or request new rule

Comments

@marekdedic
Copy link
Contributor

Motivation

Hi,
I think it would make sense to add a rule that reports usage of non-reactive built-ins that have an alternative in svelte/reactivity.

I think the rule proposal needs some more work in order not to have too many false positives, but let's start a discussion

Description

Report any (?) usage of Date, Map, Set, URL, URLSearchParams.

Examples

<script>
  import { SvelteMap } from "svelte/reactivity";

  /* ✓ GOOD */

  const one = new SvelteMap();

  /* ✗ BAD */

  const two = new Map();
  const three = $state(new Map());
</script>

Additional comments

No response

@marekdedic marekdedic added enhancement New feature or request new rule labels Feb 11, 2025
@marekdedic marekdedic linked a pull request Mar 24, 2025 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request new rule
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant