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
20 changes: 6 additions & 14 deletions crates/oxc_linter/src/rules/oxc/no_async_endpoint_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use oxc_diagnostics::{LabeledSpan, OxcDiagnostic};
use oxc_macros::declare_oxc_lint;
use oxc_span::{CompactStr, Span};
use rustc_hash::FxHashSet;
use schemars::JsonSchema;
use serde_json::Value;

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

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

Expand Down Expand Up @@ -154,21 +157,10 @@ declare_oxc_lint!(
/// }
/// app.get('/user', (req, res, next) => asyncHandler(req, res).catch(next))
/// ```
///
/// ## Configuration
///
/// This rule takes the following configuration:
/// ```ts
/// type NoAsyncEndpointHandlersConfig = {
/// /**
/// * An array of names that are allowed to be async.
/// */
/// allowedNames?: string[];
/// }
/// ```
NoAsyncEndpointHandlers,
oxc,
suspicious
suspicious,
config = NoAsyncEndpointHandlersConfig
);

impl Rule for NoAsyncEndpointHandlers {
Expand Down
Loading