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
16 changes: 6 additions & 10 deletions crates/oxc_linter/src/rules/eslint/no_void.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::Span;
use oxc_syntax::operator::UnaryOperator;
use schemars::JsonSchema;

use crate::{AstNode, ast_util::outermost_paren_parent, context::LintContext, rule::Rule};

Expand All @@ -12,8 +13,10 @@ fn no_void_diagnostic(span: Span) -> OxcDiagnostic {
.with_label(span)
}

#[derive(Debug, Default, Clone)]
#[derive(Debug, Default, Clone, JsonSchema)]
#[serde(rename_all = "camelCase", default)]
pub struct NoVoid {
/// If set to `true`, using `void` as a standalone statement is allowed.
pub allow_as_statement: bool,
}

Expand Down Expand Up @@ -41,18 +44,11 @@ declare_oxc_lint!(
/// "foo.void()";
/// "foo.void = bar";
/// ```
///
/// ### Options
///
/// #### allowAsStatement
///
/// `{ type: boolean, default: false }`
///
/// If set to `true`, using `void` as a standalone statement is allowed.
NoVoid,
eslint,
restriction,
suggestion
suggestion,
config = NoVoid,
);

impl Rule for NoVoid {
Expand Down
Loading