@@ -213,6 +213,29 @@ ruleTester.run('jsx-no-bind', rule, {
213
213
' }' ,
214
214
'});'
215
215
] . join ( '\n' )
216
+ } ,
217
+ {
218
+ code : [
219
+ 'class Hello23 extends React.Component {' ,
220
+ ' renderDiv = () => {' ,
221
+ ' const onClick = this.doSomething.bind(this, "no")' ,
222
+ ' return <div onClick={click}>Hello</div>;' ,
223
+ ' }' ,
224
+ '};'
225
+ ] . join ( '\n' ) ,
226
+ parser : 'babel-eslint'
227
+ } ,
228
+ {
229
+ code : [
230
+ 'class Hello23 extends React.Component {' ,
231
+ ' renderDiv = async () => {' ,
232
+ ' return (<div>{' ,
233
+ ' this.props.list.map(this.wrap.bind(this, "span"))' ,
234
+ ' }</div>);' ,
235
+ ' }' ,
236
+ '};'
237
+ ] . join ( '\n' ) ,
238
+ parser : 'babel-eslint'
216
239
}
217
240
] ,
218
241
@@ -267,6 +290,30 @@ ruleTester.run('jsx-no-bind', rule, {
267
290
] . join ( '\n' ) ,
268
291
errors : [ { message : 'JSX props should not use .bind()' } ]
269
292
} ,
293
+ {
294
+ code : [
295
+ 'class Hello23 extends React.Component {' ,
296
+ ' renderDiv = () => {' ,
297
+ ' const click = this.doSomething.bind(this, "no")' ,
298
+ ' return <div onClick={click}>Hello</div>;' ,
299
+ ' }' ,
300
+ '};'
301
+ ] . join ( '\n' ) ,
302
+ errors : [ { message : 'JSX props should not use .bind()' } ] ,
303
+ parser : 'babel-eslint'
304
+ } ,
305
+ {
306
+ code : [
307
+ 'class Hello23 extends React.Component {' ,
308
+ ' renderDiv = async () => {' ,
309
+ ' const click = this.doSomething.bind(this, "no")' ,
310
+ ' return <div onClick={click}>Hello</div>;' ,
311
+ ' }' ,
312
+ '};'
313
+ ] . join ( '\n' ) ,
314
+ errors : [ { message : 'JSX props should not use .bind()' } ] ,
315
+ parser : 'babel-eslint'
316
+ } ,
270
317
{
271
318
code : `
272
319
const foo = {
@@ -347,6 +394,18 @@ ruleTester.run('jsx-no-bind', rule, {
347
394
errors : [ { message : 'JSX props should not use arrow functions' } ] ,
348
395
parser : 'babel-eslint'
349
396
} ,
397
+ {
398
+ code : [
399
+ 'class Hello23 extends React.Component {' ,
400
+ ' renderDiv = async () => {' ,
401
+ ' const click = () => true' ,
402
+ ' return <div onClick={click}>Hello</div>;' ,
403
+ ' }' ,
404
+ '};'
405
+ ] . join ( '\n' ) ,
406
+ errors : [ { message : 'JSX props should not use arrow functions' } ] ,
407
+ parser : 'babel-eslint'
408
+ } ,
350
409
{
351
410
code : [
352
411
'var Hello = React.createClass({' ,
@@ -428,6 +487,18 @@ ruleTester.run('jsx-no-bind', rule, {
428
487
errors : [ { message : 'JSX props should not use ::' } ] ,
429
488
parser : 'babel-eslint'
430
489
} ,
490
+ {
491
+ code : [
492
+ 'class Hello23 extends React.Component {' ,
493
+ ' renderDiv = async () => {' ,
494
+ ' const click = this.bar::baz' ,
495
+ ' return <div onClick={click}>Hello</div>;' ,
496
+ ' }' ,
497
+ '};'
498
+ ] . join ( '\n' ) ,
499
+ errors : [ { message : 'JSX props should not use ::' } ] ,
500
+ parser : 'babel-eslint'
501
+ } ,
431
502
{
432
503
code : [
433
504
'class Hello23 extends React.Component {' ,
0 commit comments