-
-
Notifications
You must be signed in to change notification settings - Fork 859
Open
Labels
A-linterArea - LinterArea - Linter
Description
What version of Oxlint are you using?
1.48.0
What command did you run?
oxlint -c ./.oxlintrc.json
What does your .oxlintrc.json config file look like?
(Truncated to contain only relevant rule)
What happened?
Given this input Svelte file:
<script lang="ts">
let divEl: HTMLElement | null = $state(null);
</script>
<div bind:this={divEl}></div>Oxlint outputs:
⚠ eslint(prefer-const): `divEl` is never reassigned.
╭─[Example.svelte]
│<script lang="ts">
│ let divEl: HTMLElement | null = $state(null);
· ─────
│ </script>
╰────
help: Use `const` instead.
But the variable is actually written to by the bind:this part of the template.
Applying Oxlint's suggestion/auto-fix switching from let to const produces a TypeScript error:
Cannot assign to 'divEl' because it is a constant.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-linterArea - LinterArea - Linter
{ "rules": { "prefer-const": ["warn", { "destructuring": "all" }] } }