Commit 9c427f8 1 parent 485a9b0 commit 9c427f8 Copy full SHA for 9c427f8
File tree 2 files changed +18
-8
lines changed
2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -32,26 +32,20 @@ declare_oxc_lint!(
32
32
/// Examples of **incorrect** code for this rule:
33
33
/// ```javascript
34
34
/// doThing().then(() => a.then())
35
- /// ```
36
35
///
37
- /// ```javascript
38
36
/// doThing().then(function() { a.then() })
39
- /// ```
40
37
///
41
- /// ```javascript
42
38
/// doThing().then(() => { b.catch() })
39
+ ///
40
+ /// doThing().catch((val) => doSomething(val).catch(errors))
43
41
/// ```
44
42
///
45
43
/// Examples of **correct** code for this rule:
46
44
/// ```javascript
47
45
/// doThing().then(() => 4)
48
- /// ```
49
46
///
50
- /// ```javascript
51
47
/// doThing().then(function() { return 4 })
52
- /// ```
53
48
///
54
- /// ```javascript
55
49
/// doThing().catch(() => 4)
56
50
/// ```
57
51
///
@@ -273,6 +267,8 @@ fn test() {
273
267
"doThing().then(() => { b.catch() })" ,
274
268
"doThing().then(() => a.then())" ,
275
269
"doThing().then(() => b.catch())" ,
270
+ "doThing().then((val) => doSomething(val).catch(errors))" ,
271
+ "doThing().catch((val) => doSomething(val).catch(errors))" ,
276
272
"doThing()
277
273
.then(() =>
278
274
a.then(() => Promise.resolve(1)))" ,
Original file line number Diff line number Diff line change @@ -57,6 +57,20 @@ source: crates/oxc_linter/src/tester.rs
57
57
╰────
58
58
help : Refactor so that promises are chained in a flat manner .
59
59
60
+ ⚠ eslint - plugin - promise (no - nesting ): Avoid nesting promises .
61
+ ╭─[no_nesting .tsx :1 :25 ]
62
+ 1 │ doThing ().then ((val ) => doSomething (val ).catch (errors ))
63
+ · ──────────────────────
64
+ ╰────
65
+ help : Refactor so that promises are chained in a flat manner .
66
+
67
+ ⚠ eslint - plugin - promise (no - nesting ): Avoid nesting promises .
68
+ ╭─[no_nesting .tsx :1 :26 ]
69
+ 1 │ doThing ().catch ((val ) => doSomething (val ).catch (errors ))
70
+ · ──────────────────────
71
+ ╰────
72
+ help : Refactor so that promises are chained in a flat manner .
73
+
60
74
⚠ eslint - plugin - promise (no - nesting ): Avoid nesting promises .
61
75
╭─[no_nesting .tsx :3 :13 ]
62
76
2 │ .then (() =>
You can’t perform that action at this time.
0 commit comments