Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 5 additions & 18 deletions crates/oxc_linter/src/rules/typescript/no_explicit_any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use oxc_ast::AstKind;
use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::Span;
use schemars::JsonSchema;
use serde_json::Value;

use crate::{
Expand All @@ -16,15 +17,12 @@ fn no_explicit_any_diagnostic(span: Span) -> OxcDiagnostic {
.with_label(span)
}

#[derive(Debug, Default, Clone)]
#[derive(Debug, Default, Clone, JsonSchema)]
#[serde(rename_all = "camelCase", default)]
pub struct NoExplicitAny {
/// Whether to enable auto-fixing in which the `any` type is converted to the `unknown` type.
///
/// `false` by default.
fix_to_unknown: bool,
/// Whether to ignore rest parameter arrays.
///
/// `false` by default.
ignore_rest_args: bool,
}

Expand Down Expand Up @@ -70,22 +68,11 @@ declare_oxc_lint!(
/// function greet(param: Array<string>): string {}
/// function greet(param: Array<string>): Array<string> {}
/// ```
///
/// ### Options
///
/// #### `ignoreRestArgs`
///
/// A boolean to specify if arrays from the rest operator are considered ok. `false` by
/// default.
///
/// #### `fixToUnknown`
///
/// Whether to enable auto-fixing in which the `any` type is converted to the `unknown` type.
/// `false` by default.
NoExplicitAny,
typescript,
restriction,
conditional_fix
conditional_fix,
config = NoExplicitAny,
);

impl Rule for NoExplicitAny {
Expand Down
Loading