sindresorhus/eslint-plugin-unicorn
`prefer-number-properties`: `isNaN` and `isFinite` should be auto-fixed if argument is known to be `number`
Chiusa
#2192 aperta il 5 set 2023
enhancementhelp wanted
Metriche repository
- Star
- (5022 stelle)
- Metriche merge PR
- (Merge medio 1g 16h) (399 PR mergiate in 30 g)
Descrizione
The documentation for this rule mentions that Number.isNaN and isNaN have slightly diffent behavior, as Number.isNaN doesn't coerce to number first. However when the argument is known to be a number (see example code below), auto-fixing to Number.isNaN does not change the behavior
if (typeof offset !== "number" || isNaN(offset)) {
// this should be auto-fixed
}
const num: number = 5;
isNaN(num); // This too