eslint-config
eslint-config copied to clipboard
Svelte: prefer-const is counterproductive in Svelte 5
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.
Sounds good, PR welcome