Skip to content

Add rule prefer-svelte-reactivity #1071

Open
@marekdedic

Description

@marekdedic

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions