eslint-config icon indicating copy to clipboard operation
eslint-config copied to clipboard

Svelte: prefer-const is counterproductive in Svelte 5

Open gregmulvaney opened this issue 1 year ago • 1 comments

Clear and concise description of the problem

The prefer-const rule interferes with the required mutability of Rune variables in Svelte 5 if they aren't reassigned before linting.

Required format:

let foo = $state(0)

Issues is obviously exacerbated by allowing editors to format on save and save on focus change.

I'm no ESlint wizard so I am unsure whether or not improved Svelte 5 support in the official eslint-plugin-svelte or svelte-eslint-parser packages would fix this.

Suggested solution

Disable prefer-const for all *.svelte files.

Alternative

No response

Additional context

No response

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the Contributing Guide.
  • [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

gregmulvaney avatar Dec 29 '23 16:12 gregmulvaney

Sounds good, PR welcome

antfu avatar Dec 29 '23 18:12 antfu