@@ -28,62 +28,62 @@ ruleTester.run('catch-error-name', rule, {
2828 const handleError = error => {
2929 try {
3030 doSomething();
31- } catch (error2 ) {
32- console.log(error2 );
31+ } catch (error_ ) {
32+ console.log(error_ );
3333 }
3434 }
3535 ` ) ,
3636 testCase ( `
3737 const handleError = err => {
3838 try {
3939 doSomething();
40- } catch (err2 ) {
41- console.log(err2 );
40+ } catch (err_ ) {
41+ console.log(err_ );
4242 }
4343 }
4444 ` , 'err' ) ,
4545 testCase ( `
4646 const handleError = error => {
47- const error2 = new Error('🦄');
47+ const error_ = new Error('🦄');
4848
4949 try {
5050 doSomething();
51- } catch (error3 ) {
52- console.log(error3 );
51+ } catch (error__ ) {
52+ console.log(error__ );
5353 }
5454 }
5555 ` ) ,
5656 testCase ( 'obj.catch(error => {})' ) ,
5757 testCase ( `
5858 const handleError = error => {
59- obj.catch(error2 => { });
59+ obj.catch(error_ => { });
6060 }
6161 ` ) ,
6262 testCase ( `
6363 const handleError = err => {
64- obj.catch(err2 => { });
64+ obj.catch(err_ => { });
6565 }
6666 ` , 'err' ) ,
6767 testCase ( `
6868 const handleError = error => {
69- const error2 = new Error('foo bar');
69+ const error_ = new Error('foo bar');
7070
71- obj.catch(error3 => { });
71+ obj.catch(error__ => { });
7272 }
7373 ` ) ,
7474 testCase ( `
7575 const handleError = error => {
76- const error2 = new Error('foo bar');
77- const error3 = new Error('foo bar');
78- const error4 = new Error('foo bar');
79- const error5 = new Error('foo bar');
80- const error6 = new Error('foo bar');
81- const error7 = new Error('foo bar');
82- const error8 = new Error('foo bar');
83- const error9 = new Error('foo bar');
84- const error10 = new Error('foo bar');
76+ const error_ = new Error('foo bar');
77+ const error__ = new Error('foo bar');
78+ const error___ = new Error('foo bar');
79+ const error____ = new Error('foo bar');
80+ const error_____ = new Error('foo bar');
81+ const error______ = new Error('foo bar');
82+ const error_______ = new Error('foo bar');
83+ const error________ = new Error('foo bar');
84+ const error_________ = new Error('foo bar');
8585
86- obj.catch(error11 => { });
86+ obj.catch(error__________ => { });
8787 }
8888 ` ) ,
8989 testCase ( 'obj.catch(() => {})' ) ,
@@ -166,6 +166,23 @@ ruleTester.run('catch-error-name', rule, {
166166 }
167167 ` ,
168168 output : `
169+ const handleError = error => {
170+ try {
171+ doSomething();
172+ } catch (error_) {
173+ console.log(error_);
174+ }
175+ }
176+ ` ,
177+ errors : [
178+ {
179+ ruleId : 'catch-error-name' ,
180+ message : 'The catch parameter should be named `error_`.'
181+ }
182+ ]
183+ } ,
184+ {
185+ code : `
169186 const handleError = error => {
170187 try {
171188 doSomething();
@@ -174,10 +191,19 @@ ruleTester.run('catch-error-name', rule, {
174191 }
175192 }
176193 ` ,
194+ output : `
195+ const handleError = error => {
196+ try {
197+ doSomething();
198+ } catch (error_) {
199+ console.log(error_);
200+ }
201+ }
202+ ` ,
177203 errors : [
178204 {
179205 ruleId : 'catch-error-name' ,
180- message : 'The catch parameter should be named `error2 `.'
206+ message : 'The catch parameter should be named `error_ `.'
181207 }
182208 ]
183209 } ,
@@ -199,59 +225,59 @@ ruleTester.run('catch-error-name', rule, {
199225
200226 try {
201227 doSomething();
202- } catch (error2 ) {
203- console.log(error2 );
228+ } catch (error_ ) {
229+ console.log(error_ );
204230 }
205231 }
206232 ` ,
207233 errors : [
208234 {
209235 ruleId : 'catch-error-name' ,
210- message : 'The catch parameter should be named `error2 `.'
236+ message : 'The catch parameter should be named `error_ `.'
211237 }
212238 ]
213239 } ,
214240 {
215241 code : `
216242 const handleError = error => {
217- const error2 = new Error('foo bar');
243+ const error_ = new Error('foo bar');
218244
219245 obj.catch(foo => { });
220246 }
221247 ` ,
222248 output : `
223249 const handleError = error => {
224- const error2 = new Error('foo bar');
250+ const error_ = new Error('foo bar');
225251
226- obj.catch(error3 => { });
252+ obj.catch(error__ => { });
227253 }
228254 ` ,
229255 errors : [
230256 {
231257 ruleId : 'catch-error-name' ,
232- message : 'The catch parameter should be named `error3 `.'
258+ message : 'The catch parameter should be named `error__ `.'
233259 }
234260 ]
235261 } ,
236262 {
237263 code : `
238264 const handleError = error => {
239- const error2 = new Error('foo bar');
265+ const error_ = new Error('foo bar');
240266
241267 obj.catch(foo => { });
242268 }
243269 ` ,
244270 output : `
245271 const handleError = error => {
246- const error2 = new Error('foo bar');
272+ const error_ = new Error('foo bar');
247273
248- obj.catch(error3 => { });
274+ obj.catch(error__ => { });
249275 }
250276 ` ,
251277 errors : [
252278 {
253279 ruleId : 'catch-error-name' ,
254- message : 'The catch parameter should be named `error3 `.'
280+ message : 'The catch parameter should be named `error__ `.'
255281 }
256282 ] ,
257283 options : [
0 commit comments