Skip to content

Commit 77e4b30

Browse files
authored
docs(linter): Add autogen doc support for max_nested_describe in jest plugin. (#14797)
Related to #14743. This results in the addition of a config block in the docs, like this: ```md ## Configuration This rule accepts a configuration object with the following properties: ### max type: `integer` default: `5` Maximum allowed depth of nested describe calls. ``` There were also some extra linebreaks I removed from the `declare_oxc_lint!` call.
1 parent b6402dd commit 77e4b30

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

crates/oxc_linter/src/rules/jest/max_nested_describe.rs

Lines changed: 7 additions & 3 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_semantic::ScopeId;
55
use oxc_span::Span;
6+
use schemars::JsonSchema;
67

78
use crate::{
89
context::LintContext,
@@ -19,8 +20,11 @@ fn exceeded_max_depth(current: usize, max: usize, span: Span) -> OxcDiagnostic {
1920
.with_label(span)
2021
}
2122

22-
#[derive(Debug, Clone)]
23+
#[derive(Debug, Clone, JsonSchema)]
24+
#[serde(rename_all = "camelCase", default)]
25+
#[schemars(default)]
2326
pub struct MaxNestedDescribe {
27+
/// Maximum allowed depth of nested describe calls.
2428
pub max: usize,
2529
}
2630

@@ -39,13 +43,12 @@ declare_oxc_lint!(
3943
///
4044
/// Nesting `describe()` blocks too deeply can make the test suite hard to read and understand.
4145
///
42-
///
4346
/// ### Example
4447
///
4548
/// The following patterns are considered warnings (with the default option of
4649
/// `{ "max": 5 } `):
4750
///
48-
/// /// /// Examples of **incorrect** code for this rule:
51+
/// Examples of **incorrect** code for this rule:
4952
/// ```javascript
5053
/// describe('foo', () => {
5154
/// describe('bar', () => {
@@ -118,6 +121,7 @@ declare_oxc_lint!(
118121
MaxNestedDescribe,
119122
jest,
120123
style,
124+
config = MaxNestedDescribe
121125
);
122126

123127
impl Rule for MaxNestedDescribe {

0 commit comments

Comments
 (0)