Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feat(linter): set default values to true in NoUselessUndefined rule
Modified the `NoUselessUndefined` struct to set default values for `check_arguments` and `check_arrow_function_body` to `true`. This change ensures that these fields are initialized with `true` when using the `Default` trait.

- Removed `Default` derive macro from `NoUselessUndefined`.
- Implemented custom `Default` trait for `NoUselessUndefined` to set `check_arguments` and `check_arrow_function_body` to `true`.
  • Loading branch information
cblh committed Jul 9, 2024
commit ea21b0a7e4f3b38e4cf66f618473fb6d0459ec6a
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@ fn no_useless_undefined_diagnostic_spans(spans: Vec<Span>) -> OxcDiagnostic {
warn().with_labels(spans)
}

#[derive(Debug, Default, Clone)]
#[derive(Debug, Clone)]
pub struct NoUselessUndefined {
check_arguments: bool,
check_arrow_function_body: bool,
}

impl Default for NoUselessUndefined {
fn default() -> Self {
Self { check_arguments: true, check_arrow_function_body: true }
}
}

declare_oxc_lint!(
/// ### What it does
/// Do not use useless `undefined`.
Expand Down