@@ -28,95 +28,95 @@ const ruleTester = new RuleTester({parserOptions});
28
28
ruleTester . run ( 'no-find-dom-node' , rule , {
29
29
30
30
valid : [ {
31
- code : [
32
- ' var Hello = function() {};'
33
- ] . join ( '\n' )
31
+ code : `
32
+ var Hello = function() {};
33
+ `
34
34
} , {
35
- code : [
36
- ' var Hello = createReactClass({' ,
37
- ' render: function() {' ,
38
- ' return <div>Hello</div>;' ,
39
- ' }' ,
40
- ' });'
41
- ] . join ( '\n' )
35
+ code : `
36
+ var Hello = createReactClass({
37
+ render: function() {
38
+ return <div>Hello</div>;
39
+ }
40
+ });
41
+ `
42
42
} , {
43
- code : [
44
- ' var Hello = createReactClass({' ,
45
- ' componentDidMount: function() {' ,
46
- ' someNonMemberFunction(arg);' ,
47
- ' this.someFunc = React.findDOMNode;' ,
48
- ' },' ,
49
- ' render: function() {' ,
50
- ' return <div>Hello</div>;' ,
51
- ' }' ,
52
- ' });'
53
- ] . join ( '\n' )
43
+ code : `
44
+ var Hello = createReactClass({
45
+ componentDidMount: function() {
46
+ someNonMemberFunction(arg);
47
+ this.someFunc = React.findDOMNode;
48
+ },
49
+ render: function() {
50
+ return <div>Hello</div>;
51
+ }
52
+ });
53
+ `
54
54
} , {
55
- code : [
56
- ' var Hello = createReactClass({' ,
57
- ' componentDidMount: function() {' ,
58
- ' React.someFunc(this);' ,
59
- ' },' ,
60
- ' render: function() {' ,
61
- ' return <div>Hello</div>;' ,
62
- ' }' ,
63
- ' });'
64
- ] . join ( '\n' )
55
+ code : `
56
+ var Hello = createReactClass({
57
+ componentDidMount: function() {
58
+ React.someFunc(this);
59
+ },
60
+ render: function() {
61
+ return <div>Hello</div>;
62
+ }
63
+ });
64
+ `
65
65
} ] ,
66
66
67
67
invalid : [ {
68
- code : [
69
- ' var Hello = createReactClass({' ,
70
- ' componentDidMount: function() {' ,
71
- ' React.findDOMNode(this).scrollIntoView();' ,
72
- ' },' ,
73
- ' render: function() {' ,
74
- ' return <div>Hello</div>;' ,
75
- ' }' ,
76
- ' });'
77
- ] . join ( '\n' ) ,
68
+ code : `
69
+ var Hello = createReactClass({
70
+ componentDidMount: function() {
71
+ React.findDOMNode(this).scrollIntoView();
72
+ },
73
+ render: function() {
74
+ return <div>Hello</div>;
75
+ }
76
+ });
77
+ ` ,
78
78
errors : [ {
79
79
message : 'Do not use findDOMNode'
80
80
} ]
81
81
} , {
82
- code : [
83
- ' var Hello = createReactClass({' ,
84
- ' componentDidMount: function() {' ,
85
- ' ReactDOM.findDOMNode(this).scrollIntoView();' ,
86
- ' },' ,
87
- ' render: function() {' ,
88
- ' return <div>Hello</div>;' ,
89
- ' }' ,
90
- ' });'
91
- ] . join ( '\n' ) ,
82
+ code : `
83
+ var Hello = createReactClass({
84
+ componentDidMount: function() {
85
+ ReactDOM.findDOMNode(this).scrollIntoView();
86
+ },
87
+ render: function() {
88
+ return <div>Hello</div>;
89
+ }
90
+ });
91
+ ` ,
92
92
errors : [ {
93
93
message : 'Do not use findDOMNode'
94
94
} ]
95
95
} , {
96
- code : [
97
- ' class Hello extends Component {' ,
98
- ' componentDidMount() {' ,
99
- ' findDOMNode(this).scrollIntoView();' ,
100
- ' }' ,
101
- ' render() {' ,
102
- ' return <div>Hello</div>;' ,
103
- ' }' ,
104
- '};'
105
- ] . join ( '\n' ) ,
96
+ code : `
97
+ class Hello extends Component {
98
+ componentDidMount() {
99
+ findDOMNode(this).scrollIntoView();
100
+ }
101
+ render() {
102
+ return <div>Hello</div>;
103
+ }
104
+ };
105
+ ` ,
106
106
errors : [ {
107
107
message : 'Do not use findDOMNode'
108
108
} ]
109
109
} , {
110
- code : [
111
- ' class Hello extends Component {' ,
112
- ' componentDidMount() {' ,
113
- ' this.node = findDOMNode(this);' ,
114
- ' }' ,
115
- ' render() {' ,
116
- ' return <div>Hello</div>;' ,
117
- ' }' ,
118
- '};'
119
- ] . join ( '\n' ) ,
110
+ code : `
111
+ class Hello extends Component {
112
+ componentDidMount() {
113
+ this.node = findDOMNode(this);
114
+ }
115
+ render() {
116
+ return <div>Hello</div>;
117
+ }
118
+ };
119
+ ` ,
120
120
errors : [ {
121
121
message : 'Do not use findDOMNode'
122
122
} ]
0 commit comments