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
10 changes: 7 additions & 3 deletions crates/oxc_linter/src/rules/jest/max_nested_describe.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_semantic::ScopeId;
use oxc_span::Span;
use schemars::JsonSchema;

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

#[derive(Debug, Clone)]
#[derive(Debug, Clone, JsonSchema)]
#[serde(rename_all = "camelCase", default)]
#[schemars(default)]
pub struct MaxNestedDescribe {
/// Maximum allowed depth of nested describe calls.
pub max: usize,
}

Expand All @@ -39,13 +43,12 @@ declare_oxc_lint!(
///
/// Nesting `describe()` blocks too deeply can make the test suite hard to read and understand.
///
///
/// ### Example
///
/// The following patterns are considered warnings (with the default option of
/// `{ "max": 5 } `):
///
/// /// /// Examples of **incorrect** code for this rule:
/// Examples of **incorrect** code for this rule:
/// ```javascript
/// describe('foo', () => {
/// describe('bar', () => {
Expand Down Expand Up @@ -118,6 +121,7 @@ declare_oxc_lint!(
MaxNestedDescribe,
jest,
style,
config = MaxNestedDescribe
);

impl Rule for MaxNestedDescribe {
Expand Down
Loading