@@ -31,118 +31,119 @@ const ruleTester = new RuleTester();
31
31
ruleTester . run ( 'no-redundant-should-component-update' , rule , {
32
32
valid : [
33
33
{
34
- code : [
35
- ' class Foo extends React.Component {' ,
36
- ' shouldComponentUpdate() {' ,
37
- ' return true;' ,
38
- ' }' ,
39
- '}'
40
- ] . join ( '\n' ) ,
34
+ code : `
35
+ class Foo extends React.Component {
36
+ shouldComponentUpdate() {
37
+ return true;
38
+ }
39
+ }
40
+ ` ,
41
41
parserOptions : parserOptions
42
42
} ,
43
43
{
44
- code : [
45
- ' class Foo extends React.Component {' ,
46
- ' shouldComponentUpdate = () => {' ,
47
- ' return true;' ,
48
- ' }' ,
49
- '}'
50
- ] . join ( '\n' ) ,
44
+ code : `
45
+ class Foo extends React.Component {
46
+ shouldComponentUpdate = () => {
47
+ return true;
48
+ }
49
+ }
50
+ ` ,
51
51
parser : 'babel-eslint' ,
52
52
parserOptions : parserOptions
53
53
} ,
54
54
{
55
- code : [
56
- ' class Foo extends React.Component {' ,
57
- ' shouldComponentUpdate() {' ,
58
- ' return true;' ,
59
- ' }' ,
60
- '}'
61
- ] . join ( '\n' ) ,
55
+ code : `
56
+ class Foo extends React.Component {
57
+ shouldComponentUpdate() {
58
+ return true;
59
+ }
60
+ }
61
+ ` ,
62
62
parserOptions : parserOptions
63
63
} ,
64
64
{
65
- code : [
66
- ' function Foo() {' ,
67
- ' return class Bar extends React.Component {' ,
68
- ' shouldComponentUpdate() {' ,
69
- ' return true;' ,
70
- ' }' ,
71
- ' };' ,
72
- '}'
73
- ] . join ( '\n' ) ,
65
+ code : `
66
+ function Foo() {
67
+ return class Bar extends React.Component {
68
+ shouldComponentUpdate() {
69
+ return true;
70
+ }
71
+ };
72
+ }
73
+ ` ,
74
74
parserOptions : parserOptions
75
75
}
76
76
] ,
77
+
77
78
invalid : [
78
79
{
79
- code : [
80
- ' class Foo extends React.PureComponent {' ,
81
- ' shouldComponentUpdate() {' ,
82
- ' return true;' ,
83
- ' }' ,
84
- '}'
85
- ] . join ( '\n' ) ,
80
+ code : `
81
+ class Foo extends React.PureComponent {
82
+ shouldComponentUpdate() {
83
+ return true;
84
+ }
85
+ }
86
+ ` ,
86
87
errors : [ { message : errorMessage ( 'Foo' ) } ] ,
87
88
parserOptions : parserOptions
88
89
} ,
89
90
{
90
- code : [
91
- ' class Foo extends PureComponent {' ,
92
- ' shouldComponentUpdate() {' ,
93
- ' return true;' ,
94
- ' }' ,
95
- '}'
96
- ] . join ( '\n' ) ,
91
+ code : `
92
+ class Foo extends PureComponent {
93
+ shouldComponentUpdate() {
94
+ return true;
95
+ }
96
+ }
97
+ ` ,
97
98
errors : [ { message : errorMessage ( 'Foo' ) } ] ,
98
99
parserOptions : parserOptions
99
100
} ,
100
101
{
101
- code : [
102
- ' class Foo extends React.PureComponent {' ,
103
- ' shouldComponentUpdate = () => {' ,
104
- ' return true;' ,
105
- ' }' ,
106
- '}'
107
- ] . join ( '\n' ) ,
102
+ code : `
103
+ class Foo extends React.PureComponent {
104
+ shouldComponentUpdate = () => {
105
+ return true;
106
+ }
107
+ }
108
+ ` ,
108
109
errors : [ { message : errorMessage ( 'Foo' ) } ] ,
109
110
parser : 'babel-eslint' ,
110
111
parserOptions : parserOptions
111
112
} ,
112
113
{
113
- code : [
114
- ' function Foo() {' ,
115
- ' return class Bar extends React.PureComponent {' ,
116
- ' shouldComponentUpdate() {' ,
117
- ' return true;' ,
118
- ' }' ,
119
- ' };' ,
120
- '}'
121
- ] . join ( '\n' ) ,
114
+ code : `
115
+ function Foo() {
116
+ return class Bar extends React.PureComponent {
117
+ shouldComponentUpdate() {
118
+ return true;
119
+ }
120
+ };
121
+ }
122
+ ` ,
122
123
errors : [ { message : errorMessage ( 'Bar' ) } ] ,
123
124
parserOptions : parserOptions
124
125
} ,
125
126
{
126
- code : [
127
- ' function Foo() {' ,
128
- ' return class Bar extends PureComponent {' ,
129
- ' shouldComponentUpdate() {' ,
130
- ' return true;' ,
131
- ' }' ,
132
- ' };' ,
133
- '}'
134
- ] . join ( '\n' ) ,
127
+ code : `
128
+ function Foo() {
129
+ return class Bar extends PureComponent {
130
+ shouldComponentUpdate() {
131
+ return true;
132
+ }
133
+ };
134
+ }
135
+ ` ,
135
136
errors : [ { message : errorMessage ( 'Bar' ) } ] ,
136
137
parserOptions : parserOptions
137
138
} ,
138
139
{
139
- code : [
140
- ' var Foo = class extends PureComponent {' ,
141
- ' shouldComponentUpdate() {' ,
142
- ' return true;' ,
143
- ' }' ,
144
- '}'
145
- ] . join ( '\n' ) ,
140
+ code : `
141
+ var Foo = class extends PureComponent {
142
+ shouldComponentUpdate() {
143
+ return true;
144
+ }
145
+ }
146
+ ` ,
146
147
errors : [ { message : errorMessage ( 'Foo' ) } ] ,
147
148
parserOptions : parserOptions
148
149
}
0 commit comments