Skip to content

Commit

Permalink
set rule category to suspicious
Browse files Browse the repository at this point in the history
  • Loading branch information
DonIsaac committed Aug 31, 2024
1 parent abba6f2 commit 113eaf9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/rules/oxc/no_async_endpoint_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ declare_oxc_lint!(
/// }
/// ```
NoAsyncEndpointHandlers,
restriction
suspicious
);

impl Rule for NoAsyncEndpointHandlers {
Expand Down Expand Up @@ -350,7 +350,7 @@ fn test() {
),
(
"
const foo = async foo => (req, res) {}
const foo = async (req, res) => {}
app.post('/', foo)
",
None,
Expand Down
14 changes: 9 additions & 5 deletions crates/oxc_linter/src/snapshots/no_async_endpoint_handlers.snap
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,18 @@ source: crates/oxc_linter/src/tester.rs
╰────
help: Express <= 4.x does not handle Promise rejections. Use `new Promise((resolve, reject) => { ... }).catch(next)` instead.

× Expected a semicolon or an implicit semicolon after a statement, but found none
╭─[no_async_endpoint_handlers.tsx:2:48]
oxc(no-async-endpoint-handlers): Express endpoint handlers should not be async.
╭─[no_async_endpoint_handlers.tsx:3:27]
1
2const foo = async foo => (req, res) {}
· ▲
2const foo = async (req, res) => {}
· ──┬──
· ╰── Async handler is declared here
3app.post('/', foo)
· ─┬─
· ╰── and is registered here
4
╰────
help: Try insert a semicolon here
help: Express <= 4.x does not handle Promise rejections. Use `new Promise((resolve, reject) => { ... }).catch(next)` instead.

oxc(no-async-endpoint-handlers): Express endpoint handlers should not be async.
╭─[no_async_endpoint_handlers.tsx:3:21]
Expand Down

0 comments on commit 113eaf9

Please sign in to comment.