Skip to content

Commit 69babde

Browse files
authored
docs(linter): Add configuration option docs for unicorn/no-array-reduce rule. (#15142)
Part of #14743. Generated docs: ```md ## Configuration This rule accepts a configuration object with the following properties: ### allowSimpleOperations type: `boolean` default: `true` When set to `true`, allows simple operations (like summing numbers) in `reduce` and `reduceRight` calls. ```
1 parent 2c40ad8 commit 69babde

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

crates/oxc_linter/src/rules/unicorn/no_array_reduce.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use oxc_ast::{
55
use oxc_diagnostics::OxcDiagnostic;
66
use oxc_macros::declare_oxc_lint;
77
use oxc_span::Span;
8+
use schemars::JsonSchema;
89

910
use crate::{
1011
AstNode, ast_util::is_method_call, context::LintContext, rule::Rule,
@@ -19,8 +20,10 @@ fn no_array_reduce_diagnostic(span: Span) -> OxcDiagnostic {
1920
.with_label(span)
2021
}
2122

22-
#[derive(Debug, Clone)]
23+
#[derive(Debug, Clone, JsonSchema)]
24+
#[serde(rename_all = "camelCase", default)]
2325
pub struct NoArrayReduce {
26+
/// When set to `true`, allows simple operations (like summing numbers) in `reduce` and `reduceRight` calls.
2427
pub allow_simple_operations: bool,
2528
}
2629

@@ -50,7 +53,8 @@ declare_oxc_lint!(
5053
/// ```
5154
NoArrayReduce,
5255
unicorn,
53-
restriction
56+
restriction,
57+
config = NoArrayReduce,
5458
);
5559

5660
impl Rule for NoArrayReduce {

0 commit comments

Comments
 (0)