Skip to content

Commit 3ec59c0

Browse files
authored
docs(linter): Add configuration option docs for no-async-endpoint-handlers rule. (#14965)
Part of #14743. Generated docs: ```md ## Configuration This rule accepts a configuration object with the following properties: ### allowedNames type: `string[]` default: `[]` An array of names that are allowed to be async. ```
1 parent 7a275fd commit 3ec59c0

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

crates/oxc_linter/src/rules/oxc/no_async_endpoint_handlers.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use oxc_diagnostics::{LabeledSpan, OxcDiagnostic};
99
use oxc_macros::declare_oxc_lint;
1010
use oxc_span::{CompactStr, Span};
1111
use rustc_hash::FxHashSet;
12+
use schemars::JsonSchema;
1213
use serde_json::Value;
1314

1415
use crate::{AstNode, context::LintContext, rule::Rule, utils};
@@ -23,8 +24,10 @@ impl Deref for NoAsyncEndpointHandlers {
2324
}
2425
}
2526

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

@@ -154,21 +157,10 @@ declare_oxc_lint!(
154157
/// }
155158
/// app.get('/user', (req, res, next) => asyncHandler(req, res).catch(next))
156159
/// ```
157-
///
158-
/// ## Configuration
159-
///
160-
/// This rule takes the following configuration:
161-
/// ```ts
162-
/// type NoAsyncEndpointHandlersConfig = {
163-
/// /**
164-
/// * An array of names that are allowed to be async.
165-
/// */
166-
/// allowedNames?: string[];
167-
/// }
168-
/// ```
169160
NoAsyncEndpointHandlers,
170161
oxc,
171-
suspicious
162+
suspicious,
163+
config = NoAsyncEndpointHandlersConfig
172164
);
173165

174166
impl Rule for NoAsyncEndpointHandlers {

0 commit comments

Comments
 (0)