@@ -30,70 +30,70 @@ const ruleTester = new RuleTester({parserOptions});
30
30
ruleTester . run ( 'no-refs' , rule , {
31
31
32
32
valid : [ {
33
- code : [
34
- ' var Hello = createReactClass({' ,
35
- ' componentDidMount: function() {' ,
36
- ' var component = this.hello;' ,
37
- ' },' ,
38
- ' render: function() {' ,
39
- ' return <div ref={c => this.hello = c}>Hello {this.props.name}</div>;' ,
40
- ' }' ,
41
- ' });'
42
- ] . join ( '\n' ) ,
33
+ code : `
34
+ var Hello = createReactClass({
35
+ componentDidMount: function() {
36
+ var component = this.hello;
37
+ },
38
+ render: function() {
39
+ return <div ref={c => this.hello = c}>Hello {this.props.name}</div>;
40
+ }
41
+ });
42
+ ` ,
43
43
parser : 'babel-eslint'
44
44
}
45
45
] ,
46
46
47
47
invalid : [ {
48
- code : [
49
- ' var Hello = createReactClass({' ,
50
- ' componentDidMount: function() {' ,
51
- ' var component = this.refs.hello;' ,
52
- ' },' ,
53
- ' render: function() {' ,
54
- ' return <div>Hello {this.props.name}</div>;' ,
55
- ' }' ,
56
- ' });'
57
- ] . join ( '\n' ) ,
48
+ code : `
49
+ var Hello = createReactClass({
50
+ componentDidMount: function() {
51
+ var component = this.refs.hello;
52
+ },
53
+ render: function() {
54
+ return <div>Hello {this.props.name}</div>;
55
+ }
56
+ });
57
+ ` ,
58
58
parser : 'babel-eslint' ,
59
59
errors : [ {
60
60
message : 'Using this.refs is deprecated.'
61
61
} ]
62
62
} , {
63
- code : [
64
- ' var Hello = createReactClass({' ,
65
- ' render: function() {' ,
66
- ' return <div ref="hello">Hello {this.props.name}</div>;' ,
67
- ' }' ,
68
- ' });'
69
- ] . join ( '\n' ) ,
63
+ code : `
64
+ var Hello = createReactClass({
65
+ render: function() {
66
+ return <div ref="hello">Hello {this.props.name}</div>;
67
+ }
68
+ });
69
+ ` ,
70
70
parser : 'babel-eslint' ,
71
71
errors : [ {
72
72
message : 'Using string literals in ref attributes is deprecated.'
73
73
} ]
74
74
} , {
75
- code : [
76
- ' var Hello = createReactClass({' ,
77
- ' render: function() {' ,
78
- ' return <div ref={\ 'hello\ '}>Hello {this.props.name}</div>;' ,
79
- ' }' ,
80
- ' });'
81
- ] . join ( '\n' ) ,
75
+ code : `
76
+ var Hello = createReactClass({
77
+ render: function() {
78
+ return <div ref={'hello'}>Hello {this.props.name}</div>;
79
+ }
80
+ });
81
+ ` ,
82
82
parser : 'babel-eslint' ,
83
83
errors : [ {
84
84
message : 'Using string literals in ref attributes is deprecated.'
85
85
} ]
86
86
} , {
87
- code : [
88
- ' var Hello = createReactClass({' ,
89
- ' componentDidMount: function() {' ,
90
- ' var component = this.refs.hello;' ,
91
- ' },' ,
92
- ' render: function() {' ,
93
- ' return <div ref="hello">Hello {this.props.name}</div>;' ,
94
- ' }' ,
95
- ' });'
96
- ] . join ( '\n' ) ,
87
+ code : `
88
+ var Hello = createReactClass({
89
+ componentDidMount: function() {
90
+ var component = this.refs.hello;
91
+ },
92
+ render: function() {
93
+ return <div ref="hello">Hello {this.props.name}</div>;
94
+ }
95
+ });
96
+ ` ,
97
97
parser : 'babel-eslint' ,
98
98
errors : [ {
99
99
message : 'Using this.refs is deprecated.'
0 commit comments