Skip to content

Commit b69b586

Browse files
authored
docs(linter): Add configuration option docs for jest/max-expects rule. (#14975)
Part of #14743. Generated docs: ```md ## Configuration This rule accepts a configuration object with the following properties: ### max type: `integer` default: `5` Maximum number of `expect()` assertion calls allowed within a single test. ```
1 parent 2e02fe0 commit b69b586

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 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 rustc_hash::FxHashMap;
6+
use schemars::JsonSchema;
67

78
use crate::{
89
context::LintContext,
@@ -16,8 +17,10 @@ fn exceeded_max_assertion(count: usize, max: usize, span: Span) -> OxcDiagnostic
1617
.with_label(span)
1718
}
1819

19-
#[derive(Debug, Clone)]
20+
#[derive(Debug, Clone, JsonSchema)]
21+
#[serde(rename_all = "camelCase", default)]
2022
pub struct MaxExpects {
23+
/// Maximum number of `expect()` assertion calls allowed within a single test.
2124
pub max: usize,
2225
}
2326

@@ -37,7 +40,7 @@ declare_oxc_lint!(
3740
/// ### Why is this bad?
3841
///
3942
/// This rule enforces a maximum number of `expect()` calls.
40-
/// The following patterns are considered warnings (with the default option of `{ "max": 5 } `):
43+
/// The following patterns are considered warnings (with the default max of 5):
4144
///
4245
/// ### Examples
4346
///
@@ -64,6 +67,7 @@ declare_oxc_lint!(
6467
MaxExpects,
6568
jest,
6669
style,
70+
config = MaxExpects,
6771
);
6872

6973
impl Rule for MaxExpects {

0 commit comments

Comments
 (0)