From 1e99ace8f035d5fc5e47d0fffe1cba7dc5625d74 Mon Sep 17 00:00:00 2001 From: camchenry <1514176+camchenry@users.noreply.github.com> Date: Sun, 25 Jan 2026 18:53:05 +0000 Subject: [PATCH] feat(linter/use-isnan): Support more `indexOf` cases and improve diagnostic messages (#18537) Added support from some TODO test cases and made the diagnostic message better (more clear what's wrong and what to do). --- ...gnore fixtures__linter__nan.js@oxlint.snap | 2 +- .../snapshots/_fixtures__linter@oxlint.snap | 2 +- ...er.js fixtures__linter__nan.js@oxlint.snap | 2 +- .../oxc_linter/src/rules/eslint/use_isnan.rs | 112 +++--- .../src/snapshots/eslint_use_isnan.snap | 370 +++++++++++------- 5 files changed, 297 insertions(+), 191 deletions(-) diff --git a/apps/oxlint/src/snapshots/_--ignore-path fixtures__linter__.customignore --no-ignore fixtures__linter__nan.js@oxlint.snap b/apps/oxlint/src/snapshots/_--ignore-path fixtures__linter__.customignore --no-ignore fixtures__linter__nan.js@oxlint.snap index d429f869ae488..f7500730cd24a 100644 --- a/apps/oxlint/src/snapshots/_--ignore-path fixtures__linter__.customignore --no-ignore fixtures__linter__nan.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_--ignore-path fixtures__linter__.customignore --no-ignore fixtures__linter__nan.js@oxlint.snap @@ -13,7 +13,7 @@ working directory: `---- help: Consider using this expression or removing it - ! eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ! eslint(use-isnan): Comparison with NaN will always return false ,-[fixtures/linter/nan.js:1:8] 1 | 123 == NaN; : ^^^ diff --git a/apps/oxlint/src/snapshots/_fixtures__linter@oxlint.snap b/apps/oxlint/src/snapshots/_fixtures__linter@oxlint.snap index c3a7f67e5e057..b3f4a94f05d2e 100644 --- a/apps/oxlint/src/snapshots/_fixtures__linter@oxlint.snap +++ b/apps/oxlint/src/snapshots/_fixtures__linter@oxlint.snap @@ -28,7 +28,7 @@ working directory: `---- help: Consider using this expression or removing it - ! eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ! eslint(use-isnan): Comparison with NaN will always return false ,-[fixtures/linter/nan.js:1:8] 1 | 123 == NaN; : ^^^ diff --git a/apps/oxlint/src/snapshots/_fixtures__linter__debugger.js fixtures__linter__nan.js@oxlint.snap b/apps/oxlint/src/snapshots/_fixtures__linter__debugger.js fixtures__linter__nan.js@oxlint.snap index 441fc5901fad4..11577348e3452 100644 --- a/apps/oxlint/src/snapshots/_fixtures__linter__debugger.js fixtures__linter__nan.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_fixtures__linter__debugger.js fixtures__linter__nan.js@oxlint.snap @@ -20,7 +20,7 @@ working directory: `---- help: Consider using this expression or removing it - ! eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ! eslint(use-isnan): Comparison with NaN will always return false ,-[fixtures/linter/nan.js:1:8] 1 | 123 == NaN; : ^^^ diff --git a/crates/oxc_linter/src/rules/eslint/use_isnan.rs b/crates/oxc_linter/src/rules/eslint/use_isnan.rs index 96a21f0a654a3..84598f8163469 100644 --- a/crates/oxc_linter/src/rules/eslint/use_isnan.rs +++ b/crates/oxc_linter/src/rules/eslint/use_isnan.rs @@ -15,30 +15,30 @@ use crate::{ rule::{DefaultRuleConfig, Rule}, }; -fn comparison_with_na_n(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Requires calls to `isNaN()` when checking for NaN") +fn comparison_with_nan(span: Span) -> OxcDiagnostic { + OxcDiagnostic::warn("Comparison with NaN will always return false") .with_help("Use the `isNaN` function to compare with NaN.") .with_label(span) } -fn switch_na_n(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Requires calls to `isNaN()` when checking for NaN.") - .with_help( - "`switch(NaN)` can never match a case clause. Use `Number.isNaN` instead of the switch.", - ) +fn switch_nan(span: Span) -> OxcDiagnostic { + OxcDiagnostic::warn("Checking `switch` discriminant against NaN will never match") + .with_help("Use the `isNaN` function instead of the switch.") .with_label(span) } -fn case_na_n(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Requires calls to `isNaN()` when checking for NaN") - .with_help("`case NaN` can never match. Use `Number.isNaN` before the switch.") +fn case_nan(span: Span) -> OxcDiagnostic { + OxcDiagnostic::warn("Checking for NaN in `case` clause will never match") + .with_help("Use the `isNaN` function instead of the switch.") .with_label(span) } -fn index_of_na_n(method_name: &str, span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Requires calls to `isNaN()` when checking for NaN") - .with_help(format!("Array prototype method '{method_name}' cannot find NaN.")) - .with_label(span) +fn index_of_nan(method_name: &str, span: Span) -> OxcDiagnostic { + OxcDiagnostic::warn(format!( + "NaN values will never be found by `Array.prototype.{method_name}`" + )) + .with_help("Use the `isNaN` function to check for NaN values.") + .with_label(span) } #[derive(Debug, Clone, JsonSchema, Deserialize)] @@ -96,20 +96,20 @@ impl Rule for UseIsnan { match node.kind() { AstKind::BinaryExpression(expr) if expr.operator.is_compare() => { if is_nan_identifier(&expr.left) { - ctx.diagnostic(comparison_with_na_n(expr.left.span())); + ctx.diagnostic(comparison_with_nan(expr.left.span())); } if is_nan_identifier(&expr.right) { - ctx.diagnostic(comparison_with_na_n(expr.right.span())); + ctx.diagnostic(comparison_with_nan(expr.right.span())); } } AstKind::BinaryExpression(expr) if expr.operator.is_equality() => { if is_nan_identifier(&expr.left) { - ctx.diagnostic_with_fix(comparison_with_na_n(expr.left.span()), |fixer| { + ctx.diagnostic_with_fix(comparison_with_nan(expr.left.span()), |fixer| { fixer.replace(expr.span, make_equality_fix(true, expr, ctx)) }); } if is_nan_identifier(&expr.right) { - ctx.diagnostic_with_fix(comparison_with_na_n(expr.right.span()), |fixer| { + ctx.diagnostic_with_fix(comparison_with_nan(expr.right.span()), |fixer| { fixer.replace(expr.span, make_equality_fix(false, expr, ctx)) }); } @@ -117,26 +117,25 @@ impl Rule for UseIsnan { AstKind::SwitchCase(case) if self.enforce_for_switch_case => { let Some(test) = &case.test else { return }; if is_nan_identifier(test) { - ctx.diagnostic(case_na_n(test.span())); + ctx.diagnostic(case_nan(test.span())); } } AstKind::SwitchStatement(switch) if self.enforce_for_switch_case => { if is_nan_identifier(&switch.discriminant) { - ctx.diagnostic(switch_na_n(switch.discriminant.span())); + ctx.diagnostic(switch_nan(switch.discriminant.span())); } } AstKind::CallExpression(call) if self.enforce_for_index_of => { - // do this check first b/c it's cheaper than is_target_callee - if call.arguments.len() != 1 { + // Only check calls with 1 or 2 arguments (standard indexOf/lastIndexOf signature) + if call.arguments.is_empty() || call.arguments.len() > 2 { return; } - // Match target array prototype methods whose only argument is - // NaN + // Match target array prototype methods whose first argument is NaN let Some(method) = is_target_callee(&call.callee) else { return }; if let Some(expr) = call.arguments[0].as_expression() - && is_nan_identifier(expr) + && let Some((span, _)) = get_nan_in_expression(expr) { - ctx.diagnostic(index_of_na_n(method, expr.span())); + ctx.diagnostic(index_of_nan(method, span)); } } _ => (), @@ -149,9 +148,33 @@ impl Rule for UseIsnan { } fn is_nan_identifier<'a>(expr: &'a Expression<'a>) -> bool { + let expr = expr.get_inner_expression(); expr.is_specific_id("NaN") || expr.is_specific_member_access("Number", "NaN") } +/// Check if an expression evaluates to NaN, handling sequence expressions. +/// Returns the span of the NaN identifier and the expression itself if found. +fn get_nan_in_expression<'a>(expr: &'a Expression<'a>) -> Option<(Span, &'a Expression<'a>)> { + let expr = expr.get_inner_expression(); + + // Handle sequence expressions like (1, NaN) - the result is the last expression + if let Expression::SequenceExpression(seq) = expr { + if let Some(last) = seq.expressions.last() { + let last = last.get_inner_expression(); + if is_nan_identifier(last) { + return Some((last.span(), last)); + } + } + return None; + } + + if is_nan_identifier(expr) { + return Some((expr.span(), expr)); + } + + None +} + /// If callee is calling the `indexOf` or `lastIndexOf` function. fn is_target_callee<'a>(callee: &'a Expression) -> Option<&'a str> { const TARGET_METHODS: [&str; 2] = ["indexOf", "lastIndexOf"]; @@ -560,25 +583,24 @@ fn test() { ("foo.indexOf?.(Number.NaN)", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 }, ("foo?.indexOf(Number.NaN)", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 }, ("(foo?.indexOf)(Number.NaN)", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), - // TODO: Get these cases passing. - // ("foo.indexOf((1, NaN))", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 }, - // ("foo.indexOf((1, Number.NaN))", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 }, - // ("foo.lastIndexOf((1, NaN))", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 }, - // ( - // "foo.lastIndexOf((1, Number.NaN))", - // Some(serde_json::json!([{ "enforceForIndexOf": true }])), - // ), // { "ecmaVersion": 2020 }, - // ("foo.indexOf(NaN, 1)", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 }, - // ("foo.lastIndexOf(NaN, 1)", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 }, - // ("foo.indexOf(NaN, b)", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 }, - // ("foo.lastIndexOf(NaN, b)", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 }, - // ("foo.indexOf(Number.NaN, b)", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 }, - // ( - // "foo.lastIndexOf(Number.NaN, b)", - // Some(serde_json::json!([{ "enforceForIndexOf": true }])), - // ), // { "ecmaVersion": 2020 }, - // ("foo.lastIndexOf(NaN, NaN)", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 }, - // ("foo.indexOf((1, NaN), 1)", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 } + ("foo.indexOf((1, NaN))", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 }, + ("foo.indexOf((1, Number.NaN))", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 }, + ("foo.lastIndexOf((1, NaN))", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 }, + ( + "foo.lastIndexOf((1, Number.NaN))", + Some(serde_json::json!([{ "enforceForIndexOf": true }])), + ), // { "ecmaVersion": 2020 }, + ("foo.indexOf(NaN, 1)", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 }, + ("foo.lastIndexOf(NaN, 1)", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 }, + ("foo.indexOf(NaN, b)", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 }, + ("foo.lastIndexOf(NaN, b)", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 }, + ("foo.indexOf(Number.NaN, b)", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 }, + ( + "foo.lastIndexOf(Number.NaN, b)", + Some(serde_json::json!([{ "enforceForIndexOf": true }])), + ), // { "ecmaVersion": 2020 }, + ("foo.lastIndexOf(NaN, NaN)", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 }, + ("foo.indexOf((1, NaN), 1)", Some(serde_json::json!([{ "enforceForIndexOf": true }]))), // { "ecmaVersion": 2020 } ]; let fix = vec![ diff --git a/crates/oxc_linter/src/snapshots/eslint_use_isnan.snap b/crates/oxc_linter/src/snapshots/eslint_use_isnan.snap index 2ff3ca1db717e..4617a91433420 100644 --- a/crates/oxc_linter/src/snapshots/eslint_use_isnan.snap +++ b/crates/oxc_linter/src/snapshots/eslint_use_isnan.snap @@ -1,252 +1,252 @@ --- source: crates/oxc_linter/src/tester.rs --- - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:8] 1 │ 123 == NaN; · ─── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:9] 1 │ 123 === NaN; · ─── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:1] 1 │ NaN === "abc"; · ─── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:1] 1 │ NaN == "abc"; · ─── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:8] 1 │ 123 != NaN; · ─── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:9] 1 │ 123 !== NaN; · ─── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:1] 1 │ NaN !== "abc"; · ─── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:1] 1 │ NaN != "abc"; · ─── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:1] 1 │ NaN < "abc"; · ─── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:9] 1 │ "abc" < NaN; · ─── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:1] 1 │ NaN > "abc"; · ─── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:9] 1 │ "abc" > NaN; · ─── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:1] 1 │ NaN <= "abc"; · ─── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:10] 1 │ "abc" <= NaN; · ─── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:1] 1 │ NaN >= "abc"; · ─── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:10] 1 │ "abc" >= NaN; · ─── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:8] 1 │ 123 == Number.NaN; · ────────── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:9] 1 │ 123 === Number.NaN; · ────────── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:1] 1 │ Number.NaN === "abc"; · ────────── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:1] 1 │ Number.NaN == "abc"; · ────────── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:8] 1 │ 123 != Number.NaN; · ────────── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:9] 1 │ 123 !== Number.NaN; · ────────── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:1] 1 │ Number.NaN !== "abc"; · ────────── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:1] 1 │ Number.NaN != "abc"; · ────────── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:1] 1 │ Number.NaN < "abc"; · ────────── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:9] 1 │ "abc" < Number.NaN; · ────────── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:1] 1 │ Number.NaN > "abc"; · ────────── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:9] 1 │ "abc" > Number.NaN; · ────────── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:1] 1 │ Number.NaN <= "abc"; · ────────── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:10] 1 │ "abc" <= Number.NaN; · ────────── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:1] 1 │ Number.NaN >= "abc"; · ────────── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:10] 1 │ "abc" >= Number.NaN; · ────────── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:7] 1 │ x === Number?.NaN; · ─────────── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:7] 1 │ x !== Number?.NaN; · ─────────── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:7] 1 │ x === Number['NaN']; · ───────────── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:2:59] 1 │ /* just 2 │ adding */ x /* some */ === /* comments */ NaN; // here @@ -254,380 +254,464 @@ source: crates/oxc_linter/src/tester.rs ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Comparison with NaN will always return false ╭─[use_isnan.tsx:1:12] 1 │ (1, 2) === NaN; · ─── ╰──── help: Use the `isNaN` function to compare with NaN. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN. + ⚠ eslint(use-isnan): Checking `switch` discriminant against NaN will never match ╭─[use_isnan.tsx:1:8] 1 │ switch(NaN) { case foo: break; } · ─── ╰──── - help: `switch(NaN)` can never match a case clause. Use `Number.isNaN` instead of the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Checking for NaN in `case` clause will never match ╭─[use_isnan.tsx:1:20] 1 │ switch(foo) { case NaN: break; } · ─── ╰──── - help: `case NaN` can never match. Use `Number.isNaN` before the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN. + ⚠ eslint(use-isnan): Checking `switch` discriminant against NaN will never match ╭─[use_isnan.tsx:1:8] 1 │ switch(NaN) { case foo: break; } · ─── ╰──── - help: `switch(NaN)` can never match a case clause. Use `Number.isNaN` instead of the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Checking for NaN in `case` clause will never match ╭─[use_isnan.tsx:1:20] 1 │ switch(foo) { case NaN: break; } · ─── ╰──── - help: `case NaN` can never match. Use `Number.isNaN` before the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN. + ⚠ eslint(use-isnan): Checking `switch` discriminant against NaN will never match ╭─[use_isnan.tsx:1:8] 1 │ switch(NaN) {} · ─── ╰──── - help: `switch(NaN)` can never match a case clause. Use `Number.isNaN` instead of the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN. + ⚠ eslint(use-isnan): Checking `switch` discriminant against NaN will never match ╭─[use_isnan.tsx:1:8] 1 │ switch(NaN) { case foo: break; } · ─── ╰──── - help: `switch(NaN)` can never match a case clause. Use `Number.isNaN` instead of the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN. + ⚠ eslint(use-isnan): Checking `switch` discriminant against NaN will never match ╭─[use_isnan.tsx:1:8] 1 │ switch(NaN) { default: break; } · ─── ╰──── - help: `switch(NaN)` can never match a case clause. Use `Number.isNaN` instead of the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN. + ⚠ eslint(use-isnan): Checking `switch` discriminant against NaN will never match ╭─[use_isnan.tsx:1:8] 1 │ switch(NaN) { case foo: break; default: break; } · ─── ╰──── - help: `switch(NaN)` can never match a case clause. Use `Number.isNaN` instead of the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Checking for NaN in `case` clause will never match ╭─[use_isnan.tsx:1:20] 1 │ switch(foo) { case NaN: } · ─── ╰──── - help: `case NaN` can never match. Use `Number.isNaN` before the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Checking for NaN in `case` clause will never match ╭─[use_isnan.tsx:1:20] 1 │ switch(foo) { case NaN: break; } · ─── ╰──── - help: `case NaN` can never match. Use `Number.isNaN` before the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Checking for NaN in `case` clause will never match ╭─[use_isnan.tsx:1:20] 1 │ switch(foo) { case (NaN): break; } · ───── ╰──── - help: `case NaN` can never match. Use `Number.isNaN` before the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Checking for NaN in `case` clause will never match ╭─[use_isnan.tsx:1:37] 1 │ switch(foo) { case bar: break; case NaN: break; default: break; } · ─── ╰──── - help: `case NaN` can never match. Use `Number.isNaN` before the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Checking for NaN in `case` clause will never match ╭─[use_isnan.tsx:1:30] 1 │ switch(foo) { case bar: case NaN: default: break; } · ─── ╰──── - help: `case NaN` can never match. Use `Number.isNaN` before the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Checking for NaN in `case` clause will never match ╭─[use_isnan.tsx:1:37] 1 │ switch(foo) { case bar: break; case NaN: break; case baz: break; case NaN: break; } · ─── ╰──── - help: `case NaN` can never match. Use `Number.isNaN` before the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Checking for NaN in `case` clause will never match ╭─[use_isnan.tsx:1:71] 1 │ switch(foo) { case bar: break; case NaN: break; case baz: break; case NaN: break; } · ─── ╰──── - help: `case NaN` can never match. Use `Number.isNaN` before the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN. + ⚠ eslint(use-isnan): Checking `switch` discriminant against NaN will never match ╭─[use_isnan.tsx:1:8] 1 │ switch(NaN) { case NaN: break; } · ─── ╰──── - help: `switch(NaN)` can never match a case clause. Use `Number.isNaN` instead of the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Checking for NaN in `case` clause will never match ╭─[use_isnan.tsx:1:20] 1 │ switch(NaN) { case NaN: break; } · ─── ╰──── - help: `case NaN` can never match. Use `Number.isNaN` before the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN. + ⚠ eslint(use-isnan): Checking `switch` discriminant against NaN will never match ╭─[use_isnan.tsx:1:8] 1 │ switch(Number.NaN) { case foo: break; } · ────────── ╰──── - help: `switch(NaN)` can never match a case clause. Use `Number.isNaN` instead of the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Checking for NaN in `case` clause will never match ╭─[use_isnan.tsx:1:20] 1 │ switch(foo) { case Number.NaN: break; } · ────────── ╰──── - help: `case NaN` can never match. Use `Number.isNaN` before the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN. + ⚠ eslint(use-isnan): Checking `switch` discriminant against NaN will never match ╭─[use_isnan.tsx:1:8] 1 │ switch(Number.NaN) { case foo: break; } · ────────── ╰──── - help: `switch(NaN)` can never match a case clause. Use `Number.isNaN` instead of the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Checking for NaN in `case` clause will never match ╭─[use_isnan.tsx:1:20] 1 │ switch(foo) { case Number.NaN: break; } · ────────── ╰──── - help: `case NaN` can never match. Use `Number.isNaN` before the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN. + ⚠ eslint(use-isnan): Checking `switch` discriminant against NaN will never match ╭─[use_isnan.tsx:1:8] 1 │ switch(Number.NaN) {} · ────────── ╰──── - help: `switch(NaN)` can never match a case clause. Use `Number.isNaN` instead of the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN. + ⚠ eslint(use-isnan): Checking `switch` discriminant against NaN will never match ╭─[use_isnan.tsx:1:8] 1 │ switch(Number.NaN) { case foo: break; } · ────────── ╰──── - help: `switch(NaN)` can never match a case clause. Use `Number.isNaN` instead of the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN. + ⚠ eslint(use-isnan): Checking `switch` discriminant against NaN will never match ╭─[use_isnan.tsx:1:8] 1 │ switch(Number.NaN) { default: break; } · ────────── ╰──── - help: `switch(NaN)` can never match a case clause. Use `Number.isNaN` instead of the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN. + ⚠ eslint(use-isnan): Checking `switch` discriminant against NaN will never match ╭─[use_isnan.tsx:1:8] 1 │ switch(Number.NaN) { case foo: break; default: break; } · ────────── ╰──── - help: `switch(NaN)` can never match a case clause. Use `Number.isNaN` instead of the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Checking for NaN in `case` clause will never match ╭─[use_isnan.tsx:1:20] 1 │ switch(foo) { case Number.NaN: } · ────────── ╰──── - help: `case NaN` can never match. Use `Number.isNaN` before the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Checking for NaN in `case` clause will never match ╭─[use_isnan.tsx:1:20] 1 │ switch(foo) { case Number.NaN: break; } · ────────── ╰──── - help: `case NaN` can never match. Use `Number.isNaN` before the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Checking for NaN in `case` clause will never match ╭─[use_isnan.tsx:1:20] 1 │ switch(foo) { case (Number.NaN): break; } · ──────────── ╰──── - help: `case NaN` can never match. Use `Number.isNaN` before the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Checking for NaN in `case` clause will never match ╭─[use_isnan.tsx:1:37] 1 │ switch(foo) { case bar: break; case Number.NaN: break; default: break; } · ────────── ╰──── - help: `case NaN` can never match. Use `Number.isNaN` before the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Checking for NaN in `case` clause will never match ╭─[use_isnan.tsx:1:30] 1 │ switch(foo) { case bar: case Number.NaN: default: break; } · ────────── ╰──── - help: `case NaN` can never match. Use `Number.isNaN` before the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Checking for NaN in `case` clause will never match ╭─[use_isnan.tsx:1:37] 1 │ switch(foo) { case bar: break; case NaN: break; case baz: break; case Number.NaN: break; } · ─── ╰──── - help: `case NaN` can never match. Use `Number.isNaN` before the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Checking for NaN in `case` clause will never match ╭─[use_isnan.tsx:1:71] 1 │ switch(foo) { case bar: break; case NaN: break; case baz: break; case Number.NaN: break; } · ────────── ╰──── - help: `case NaN` can never match. Use `Number.isNaN` before the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN. + ⚠ eslint(use-isnan): Checking `switch` discriminant against NaN will never match ╭─[use_isnan.tsx:1:8] 1 │ switch(Number.NaN) { case Number.NaN: break; } · ────────── ╰──── - help: `switch(NaN)` can never match a case clause. Use `Number.isNaN` instead of the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): Checking for NaN in `case` clause will never match ╭─[use_isnan.tsx:1:27] 1 │ switch(Number.NaN) { case Number.NaN: break; } · ────────── ╰──── - help: `case NaN` can never match. Use `Number.isNaN` before the switch. + help: Use the `isNaN` function instead of the switch. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.indexOf` ╭─[use_isnan.tsx:1:13] 1 │ foo.indexOf(NaN) · ─── ╰──── - help: Array prototype method 'indexOf' cannot find NaN. + help: Use the `isNaN` function to check for NaN values. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.lastIndexOf` ╭─[use_isnan.tsx:1:17] 1 │ foo.lastIndexOf(NaN) · ─── ╰──── - help: Array prototype method 'lastIndexOf' cannot find NaN. + help: Use the `isNaN` function to check for NaN values. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.indexOf` ╭─[use_isnan.tsx:1:16] 1 │ foo['indexOf'](NaN) · ─── ╰──── - help: Array prototype method 'indexOf' cannot find NaN. + help: Use the `isNaN` function to check for NaN values. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.indexOf` ╭─[use_isnan.tsx:1:16] 1 │ foo[`indexOf`](NaN) · ─── ╰──── - help: Array prototype method 'indexOf' cannot find NaN. + help: Use the `isNaN` function to check for NaN values. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.lastIndexOf` ╭─[use_isnan.tsx:1:20] 1 │ foo['lastIndexOf'](NaN) · ─── ╰──── - help: Array prototype method 'lastIndexOf' cannot find NaN. + help: Use the `isNaN` function to check for NaN values. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.indexOf` ╭─[use_isnan.tsx:1:15] 1 │ foo().indexOf(NaN) · ─── ╰──── - help: Array prototype method 'indexOf' cannot find NaN. + help: Use the `isNaN` function to check for NaN values. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.lastIndexOf` ╭─[use_isnan.tsx:1:21] 1 │ foo.bar.lastIndexOf(NaN) · ─── ╰──── - help: Array prototype method 'lastIndexOf' cannot find NaN. + help: Use the `isNaN` function to check for NaN values. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.indexOf` ╭─[use_isnan.tsx:1:15] 1 │ foo.indexOf?.(NaN) · ─── ╰──── - help: Array prototype method 'indexOf' cannot find NaN. + help: Use the `isNaN` function to check for NaN values. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.indexOf` ╭─[use_isnan.tsx:1:14] 1 │ foo?.indexOf(NaN) · ─── ╰──── - help: Array prototype method 'indexOf' cannot find NaN. + help: Use the `isNaN` function to check for NaN values. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.indexOf` ╭─[use_isnan.tsx:1:16] 1 │ (foo?.indexOf)(NaN) · ─── ╰──── - help: Array prototype method 'indexOf' cannot find NaN. + help: Use the `isNaN` function to check for NaN values. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.indexOf` ╭─[use_isnan.tsx:1:13] 1 │ foo.indexOf(Number.NaN) · ────────── ╰──── - help: Array prototype method 'indexOf' cannot find NaN. + help: Use the `isNaN` function to check for NaN values. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.lastIndexOf` ╭─[use_isnan.tsx:1:17] 1 │ foo.lastIndexOf(Number.NaN) · ────────── ╰──── - help: Array prototype method 'lastIndexOf' cannot find NaN. + help: Use the `isNaN` function to check for NaN values. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.indexOf` ╭─[use_isnan.tsx:1:16] 1 │ foo['indexOf'](Number.NaN) · ────────── ╰──── - help: Array prototype method 'indexOf' cannot find NaN. + help: Use the `isNaN` function to check for NaN values. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.lastIndexOf` ╭─[use_isnan.tsx:1:20] 1 │ foo['lastIndexOf'](Number.NaN) · ────────── ╰──── - help: Array prototype method 'lastIndexOf' cannot find NaN. + help: Use the `isNaN` function to check for NaN values. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.indexOf` ╭─[use_isnan.tsx:1:15] 1 │ foo().indexOf(Number.NaN) · ────────── ╰──── - help: Array prototype method 'indexOf' cannot find NaN. + help: Use the `isNaN` function to check for NaN values. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.lastIndexOf` ╭─[use_isnan.tsx:1:21] 1 │ foo.bar.lastIndexOf(Number.NaN) · ────────── ╰──── - help: Array prototype method 'lastIndexOf' cannot find NaN. + help: Use the `isNaN` function to check for NaN values. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.indexOf` ╭─[use_isnan.tsx:1:15] 1 │ foo.indexOf?.(Number.NaN) · ────────── ╰──── - help: Array prototype method 'indexOf' cannot find NaN. + help: Use the `isNaN` function to check for NaN values. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.indexOf` ╭─[use_isnan.tsx:1:14] 1 │ foo?.indexOf(Number.NaN) · ────────── ╰──── - help: Array prototype method 'indexOf' cannot find NaN. + help: Use the `isNaN` function to check for NaN values. - ⚠ eslint(use-isnan): Requires calls to `isNaN()` when checking for NaN + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.indexOf` ╭─[use_isnan.tsx:1:16] 1 │ (foo?.indexOf)(Number.NaN) · ────────── ╰──── - help: Array prototype method 'indexOf' cannot find NaN. + help: Use the `isNaN` function to check for NaN values. + + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.indexOf` + ╭─[use_isnan.tsx:1:17] + 1 │ foo.indexOf((1, NaN)) + · ─── + ╰──── + help: Use the `isNaN` function to check for NaN values. + + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.indexOf` + ╭─[use_isnan.tsx:1:17] + 1 │ foo.indexOf((1, Number.NaN)) + · ────────── + ╰──── + help: Use the `isNaN` function to check for NaN values. + + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.lastIndexOf` + ╭─[use_isnan.tsx:1:21] + 1 │ foo.lastIndexOf((1, NaN)) + · ─── + ╰──── + help: Use the `isNaN` function to check for NaN values. + + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.lastIndexOf` + ╭─[use_isnan.tsx:1:21] + 1 │ foo.lastIndexOf((1, Number.NaN)) + · ────────── + ╰──── + help: Use the `isNaN` function to check for NaN values. + + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.indexOf` + ╭─[use_isnan.tsx:1:13] + 1 │ foo.indexOf(NaN, 1) + · ─── + ╰──── + help: Use the `isNaN` function to check for NaN values. + + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.lastIndexOf` + ╭─[use_isnan.tsx:1:17] + 1 │ foo.lastIndexOf(NaN, 1) + · ─── + ╰──── + help: Use the `isNaN` function to check for NaN values. + + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.indexOf` + ╭─[use_isnan.tsx:1:13] + 1 │ foo.indexOf(NaN, b) + · ─── + ╰──── + help: Use the `isNaN` function to check for NaN values. + + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.lastIndexOf` + ╭─[use_isnan.tsx:1:17] + 1 │ foo.lastIndexOf(NaN, b) + · ─── + ╰──── + help: Use the `isNaN` function to check for NaN values. + + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.indexOf` + ╭─[use_isnan.tsx:1:13] + 1 │ foo.indexOf(Number.NaN, b) + · ────────── + ╰──── + help: Use the `isNaN` function to check for NaN values. + + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.lastIndexOf` + ╭─[use_isnan.tsx:1:17] + 1 │ foo.lastIndexOf(Number.NaN, b) + · ────────── + ╰──── + help: Use the `isNaN` function to check for NaN values. + + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.lastIndexOf` + ╭─[use_isnan.tsx:1:17] + 1 │ foo.lastIndexOf(NaN, NaN) + · ─── + ╰──── + help: Use the `isNaN` function to check for NaN values. + + ⚠ eslint(use-isnan): NaN values will never be found by `Array.prototype.indexOf` + ╭─[use_isnan.tsx:1:17] + 1 │ foo.indexOf((1, NaN), 1) + · ─── + ╰──── + help: Use the `isNaN` function to check for NaN values.