Closed
Description
Environment
What parser are you using?
@typescript-eslint/parser
What did you do?
{
"extends": [
"eslint:all",
"plugin:@typescript-eslint/all"
],
"rules": {
}
}
const foo = (two: string): void => {
"use strict";
// eslint-disable-next-line @typescript-eslint/init-declarations
let one: string | undefined;
if (one === two) {
// Noop
}
}
foo("");
What did you expect to happen?
In this code snippet, let one;
is read but never assigned. I would expect some rule to flag it – the most appropriate one seems like it would be prefer-const
.
What actually happened?
prefer-const
does not complain about this code. (Maybe because const one;
is not allowed syntax?)
Link to Minimal Reproducible Example
Participation
- I am willing to submit a pull request for this issue.
Additional comments
Here is a typescript-eslint version of the playground.
If prefer-const is not the right rule to flag this error, then what is?
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Complete