Skip to content

Commit 5a81953

Browse files
authored
docs(linter): Add configuration option docs for jest/require-hook rule. (#14972)
Part of #14743. Generated docs: ```md ## Configuration This rule accepts a configuration object with the following properties: ### allowedFunctionCalls type: `string[]` default: `[]` An array of function names that are allowed to be called outside of hooks. ```
1 parent 1be268d commit 5a81953

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use oxc_diagnostics::OxcDiagnostic;
77
use oxc_macros::declare_oxc_lint;
88
use oxc_semantic::AstNode;
99
use oxc_span::{CompactStr, Span};
10+
use schemars::JsonSchema;
1011

1112
use crate::{
1213
context::LintContext,
@@ -23,8 +24,10 @@ fn use_hook(span: Span) -> OxcDiagnostic {
2324
.with_label(span)
2425
}
2526

26-
#[derive(Debug, Default, Clone)]
27+
#[derive(Debug, Default, Clone, JsonSchema)]
28+
#[serde(rename_all = "camelCase", default)]
2729
pub struct RequireHookConfig {
30+
/// An array of function names that are allowed to be called outside of hooks.
2831
allowed_function_calls: Vec<CompactStr>,
2932
}
3033

@@ -157,7 +160,8 @@ declare_oxc_lint!(
157160
/// ```
158161
RequireHook,
159162
jest,
160-
style
163+
style,
164+
config = RequireHookConfig
161165
);
162166

163167
impl Rule for RequireHook {

0 commit comments

Comments
 (0)