Skip to content

Commit a6f720b

Browse files
authored
docs(linter): Expose use-isnan rule config options. (#14844)
So it'll now get picked up by the auto-generated documentation. Part of #14743. Generated docs: ```md ## Configuration This rule accepts a configuration object with the following properties: ### enforceForIndexOf type: `boolean` default: `false` Whether to disallow NaN as arguments of `indexOf` and `lastIndexOf` ### enforceForSwitchCase type: `boolean` default: `true` Whether to disallow NaN in switch cases and discriminants ```
1 parent 7dc609b commit a6f720b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

crates/oxc_linter/src/rules/eslint/use_isnan.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use oxc_diagnostics::OxcDiagnostic;
66
use oxc_macros::declare_oxc_lint;
77
use oxc_span::{GetSpan, Span};
88
use oxc_syntax::operator::BinaryOperator;
9+
use schemars::JsonSchema;
910

1011
use crate::{AstNode, context::LintContext, rule::Rule};
1112

@@ -35,7 +36,8 @@ fn index_of_na_n(method_name: &str, span: Span) -> OxcDiagnostic {
3536
.with_label(span)
3637
}
3738

38-
#[derive(Debug, Clone)]
39+
#[derive(Debug, Clone, JsonSchema)]
40+
#[serde(rename_all = "camelCase", default)]
3941
pub struct UseIsnan {
4042
/// Whether to disallow NaN in switch cases and discriminants
4143
enforce_for_switch_case: bool,
@@ -80,7 +82,8 @@ declare_oxc_lint!(
8082
UseIsnan,
8183
eslint,
8284
correctness,
83-
conditional_fix
85+
conditional_fix,
86+
config = UseIsnan,
8487
);
8588

8689
impl Rule for UseIsnan {

0 commit comments

Comments
 (0)