@@ -22,7 +22,7 @@ ruleTester.run('catch-or-return', rule, {
2222 {
2323 code :
2424 'postJSON("/smajobber/api/reportJob.json")\n\t.then(()=>this.setState())\n\t.catch(()=>this.setState())' ,
25- parserOptions : { ecmaVersion : 6 }
25+ parserOptions : { ecmaVersion : 6 } ,
2626 } ,
2727
2828 // return
@@ -34,187 +34,187 @@ ruleTester.run('catch-or-return', rule, {
3434 // allowThen - .then(null, fn)
3535 {
3636 code : 'frank().then(go).then(null, doIt)' ,
37- options : [ { allowThen : true } ]
37+ options : [ { allowThen : true } ] ,
3838 } ,
3939 {
4040 code : 'frank().then(go).then().then().then().then(null, doIt)' ,
41- options : [ { allowThen : true } ]
41+ options : [ { allowThen : true } ] ,
4242 } ,
4343 {
4444 code :
4545 'frank().then(go).then().then(null, function() { /* why bother */ })' ,
46- options : [ { allowThen : true } ]
46+ options : [ { allowThen : true } ] ,
4747 } ,
4848 {
4949 code : 'frank.then(go).then(to).then(null, jail)' ,
50- options : [ { allowThen : true } ]
50+ options : [ { allowThen : true } ] ,
5151 } ,
5252
5353 // allowThen - .then(null, fn)
5454 { code : 'frank().then(a, b)' , options : [ { allowThen : true } ] } ,
5555 {
5656 code : 'frank().then(a).then(b).then(null, c)' ,
57- options : [ { allowThen : true } ]
57+ options : [ { allowThen : true } ] ,
5858 } ,
5959 {
6060 code : 'frank().then(a).then(b).then(c, d)' ,
61- options : [ { allowThen : true } ]
61+ options : [ { allowThen : true } ] ,
6262 } ,
6363 {
6464 code : 'frank().then(a).then(b).then().then().then(null, doIt)' ,
65- options : [ { allowThen : true } ]
65+ options : [ { allowThen : true } ] ,
6666 } ,
6767 {
6868 code :
6969 'frank().then(a).then(b).then(null, function() { /* why bother */ })' ,
70- options : [ { allowThen : true } ]
70+ options : [ { allowThen : true } ] ,
7171 } ,
7272
7373 // allowThen - .then(fn, fn)
7474 {
7575 code : 'frank().then(go).then(zam, doIt)' ,
76- options : [ { allowThen : true } ]
76+ options : [ { allowThen : true } ] ,
7777 } ,
7878 {
7979 code : 'frank().then(go).then().then().then().then(wham, doIt)' ,
80- options : [ { allowThen : true } ]
80+ options : [ { allowThen : true } ] ,
8181 } ,
8282 {
8383 code :
8484 'frank().then(go).then().then(function() {}, function() { /* why bother */ })' ,
85- options : [ { allowThen : true } ]
85+ options : [ { allowThen : true } ] ,
8686 } ,
8787 {
8888 code : 'frank.then(go).then(to).then(pewPew, jail)' ,
89- options : [ { allowThen : true } ]
89+ options : [ { allowThen : true } ] ,
9090 } ,
9191
9292 // allowFinally - .finally(fn)
9393 {
9494 code : 'frank().then(go).catch(doIt).finally(fn)' ,
95- options : [ { allowFinally : true } ]
95+ options : [ { allowFinally : true } ] ,
9696 } ,
9797 {
9898 code : 'frank().then(go).then().then().then().catch(doIt).finally(fn)' ,
99- options : [ { allowFinally : true } ]
99+ options : [ { allowFinally : true } ] ,
100100 } ,
101101 {
102102 code :
103103 'frank().then(go).then().catch(function() { /* why bother */ }).finally(fn)' ,
104- options : [ { allowFinally : true } ]
104+ options : [ { allowFinally : true } ] ,
105105 } ,
106106
107107 // terminationMethod=done - .done(null, fn)
108108 {
109109 code : 'frank().then(go).done()' ,
110- options : [ { terminationMethod : 'done' } ]
110+ options : [ { terminationMethod : 'done' } ] ,
111111 } ,
112112
113113 // terminationMethod=[catch, done] - .done(null, fn)
114114 {
115115 code : 'frank().then(go).catch()' ,
116- options : [ { terminationMethod : [ 'catch' , 'done' ] } ]
116+ options : [ { terminationMethod : [ 'catch' , 'done' ] } ] ,
117117 } ,
118118 {
119119 code : 'frank().then(go).done()' ,
120- options : [ { terminationMethod : [ 'catch' , 'done' ] } ]
120+ options : [ { terminationMethod : [ 'catch' , 'done' ] } ] ,
121121 } ,
122122 {
123123 code : 'frank().then(go).finally()' ,
124- options : [ { terminationMethod : [ 'catch' , 'finally' ] } ]
125- }
124+ options : [ { terminationMethod : [ 'catch' , 'finally' ] } ] ,
125+ } ,
126126 ] ,
127127
128128 invalid : [
129129 // catch failures
130130 {
131131 code : 'function callPromise(promise, cb) { promise.then(cb) }' ,
132- errors : [ { message : catchMessage } ]
132+ errors : [ { message : catchMessage } ] ,
133133 } ,
134134 {
135135 code : 'fetch("http://www.yahoo.com").then(console.log.bind(console))' ,
136- errors : [ { message : catchMessage } ]
136+ errors : [ { message : catchMessage } ] ,
137137 } ,
138138 {
139139 code : 'a.then(function() { return "x"; }).then(function(y) { throw y; })' ,
140- errors : [ { message : catchMessage } ]
140+ errors : [ { message : catchMessage } ] ,
141141 } ,
142142 {
143143 code : 'Promise.resolve(frank)' ,
144- errors : [ { message : catchMessage } ]
144+ errors : [ { message : catchMessage } ] ,
145145 } ,
146146 {
147147 code : 'frank().then(to).catch(fn).then(foo)' ,
148- errors : [ { message : catchMessage } ]
148+ errors : [ { message : catchMessage } ] ,
149149 } ,
150150 {
151151 code : 'frank().finally(fn)' ,
152- errors : [ { message : catchMessage } ]
152+ errors : [ { message : catchMessage } ] ,
153153 } ,
154154 {
155155 code : 'frank().then(to).finally(fn)' ,
156- errors : [ { message : catchMessage } ]
156+ errors : [ { message : catchMessage } ] ,
157157 } ,
158158 {
159159 code : 'frank().then(go).catch(doIt).finally(fn)' ,
160- errors : [ { message : catchMessage } ]
160+ errors : [ { message : catchMessage } ] ,
161161 } ,
162162 {
163163 code : 'frank().then(go).then().then().then().catch(doIt).finally(fn)' ,
164- errors : [ { message : catchMessage } ]
164+ errors : [ { message : catchMessage } ] ,
165165 } ,
166166 {
167167 code :
168168 'frank().then(go).then().catch(function() { /* why bother */ }).finally(fn)' ,
169- errors : [ { message : catchMessage } ]
169+ errors : [ { message : catchMessage } ] ,
170170 } ,
171171
172172 // return failures
173173 {
174174 code : 'function a() { frank().then(go) }' ,
175- errors : [ { message : catchMessage } ]
175+ errors : [ { message : catchMessage } ] ,
176176 } ,
177177 {
178178 code : 'function a() { frank().then(go).then().then().then() }' ,
179- errors : [ { message : catchMessage } ]
179+ errors : [ { message : catchMessage } ] ,
180180 } ,
181181 {
182182 code : 'function a() { frank().then(go).then()}' ,
183- errors : [ { message : catchMessage } ]
183+ errors : [ { message : catchMessage } ] ,
184184 } ,
185185 {
186186 code : 'function a() { frank.then(go).then(to) }' ,
187- errors : [ { message : catchMessage } ]
187+ errors : [ { message : catchMessage } ] ,
188188 } ,
189189
190190 // allowFinally=true failures
191191 {
192192 code : 'frank().then(go).catch(doIt).finally(fn).then(foo)' ,
193193 options : [ { allowFinally : true } ] ,
194- errors : [ { message : catchMessage } ]
194+ errors : [ { message : catchMessage } ] ,
195195 } ,
196196 {
197197 code : 'frank().then(go).catch(doIt).finally(fn).foobar(foo)' ,
198198 options : [ { allowFinally : true } ] ,
199- errors : [ { message : catchMessage } ]
199+ errors : [ { message : catchMessage } ] ,
200200 } ,
201201
202202 // terminationMethod=done - .done(null, fn)
203203 {
204204 code : 'frank().then(go)' ,
205205 options : [ { terminationMethod : 'done' } ] ,
206- errors : [ { message : doneMessage } ]
206+ errors : [ { message : doneMessage } ] ,
207207 } ,
208208 {
209209 code : 'frank().catch(go)' ,
210210 options : [ { terminationMethod : 'done' } ] ,
211- errors : [ { message : doneMessage } ]
211+ errors : [ { message : doneMessage } ] ,
212212 } ,
213213
214214 // assume somePromise.ANYTHING() is a new promise
215215 {
216216 code : 'frank().catch(go).someOtherMethod()' ,
217- errors : [ { message : catchMessage } ]
218- }
219- ]
217+ errors : [ { message : catchMessage } ] ,
218+ } ,
219+ ] ,
220220} )
0 commit comments