We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 82ad880 commit 1b1aa95Copy full SHA for 1b1aa95
misc/ast-grep/rules/no-non-terminal-res-inside-condition.yml
@@ -0,0 +1,28 @@
1
+id: no-non-terminal-res-inside-condition
2
+message: Potentially suspicious non-terminal response inside condition
3
+severity: hint
4
+language: typescript
5
+rule:
6
+ all:
7
+ - pattern: res.$A($$$B)
8
+ - kind: call_expression
9
+ - not:
10
+ inside:
11
+ kind: return_statement
12
+ stopBy: end
13
+ - inside:
14
+ kind: if_statement
15
16
+fix: return res.$A($$$B)
17
+constraints:
18
+ A:
19
+ any:
20
+ - regex: badRequest
21
+ - regex: conflict
22
+ - regex: forbidden
23
+ - regex: invalidGocardlessToken
24
+ - regex: methodNotAllowed
25
+ - regex: notFound
26
+ - regex: serverError
27
+ - regex: serviceUnavailable
28
+ - regex: unauthorized
0 commit comments