Skip to content

Commit aa339b3

Browse files
authored
docs(linter): Add configuration option docs for eslint/no-void rule. (#14970)
These already existed, but this allows us to autogenerate them. Part of #14743. Generated docs: ```md ## Configuration This rule accepts a configuration object with the following properties: ### allowAsStatement type: `boolean` default: `false` If set to `true`, using `void` as a standalone statement is allowed. ```
1 parent af8bdae commit aa339b3

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use oxc_diagnostics::OxcDiagnostic;
33
use oxc_macros::declare_oxc_lint;
44
use oxc_span::Span;
55
use oxc_syntax::operator::UnaryOperator;
6+
use schemars::JsonSchema;
67

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

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

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

@@ -41,18 +44,11 @@ declare_oxc_lint!(
4144
/// "foo.void()";
4245
/// "foo.void = bar";
4346
/// ```
44-
///
45-
/// ### Options
46-
///
47-
/// #### allowAsStatement
48-
///
49-
/// `{ type: boolean, default: false }`
50-
///
51-
/// If set to `true`, using `void` as a standalone statement is allowed.
5247
NoVoid,
5348
eslint,
5449
restriction,
55-
suggestion
50+
suggestion,
51+
config = NoVoid,
5652
);
5753

5854
impl Rule for NoVoid {

0 commit comments

Comments
 (0)