Description
What version of Oxlint are you using?
1.1.0
What command did you run?
oxlint --fix
What does your .oxlintrc.json
config file look like?
What happened?
type TFoo = {
play: () => void,
};
export class C1 {
public play(index: number) {
if (index > 1) {
var a: TFoo | undefined = {
play: () => {
console.warn("index > 1", index);
},
};
} else {
var a: TFoo | undefined = {
play: () => {
console.warn("index > 1 , false", index);
},
};
}
if (a != null) {
a.play();
}
}
}
run oxlint --fix
, and get it.
type TFoo = {
play: () => void,
};
export class C1 {
public play(index: number) {
if (index > 1) {
const a: TFoo | undefined = {
play: () => {
console.warn("index > 1", index);
},
};
} else {
const a: TFoo | undefined = {
play: () => {
console.warn("index > 1 , false", index);
},
};
}
if (a != null) {
a.play();
}
}
}
https://github.com/CoffeeChaton/oxlint-no-var-shouldbe-unsafe-fix