Skip to content

Commit 81d0e8b

Browse files
committed
Remove test cases for always option in state-in-constructor rule
Since `always` is the default option, we can use the no-option cases to cover these `always` cases. I left one `always` case to make sure that having an option as `always` will act the same way as no-option.
1 parent 4706e86 commit 81d0e8b

File tree

1 file changed

+0
-119
lines changed

1 file changed

+0
-119
lines changed

tests/lib/rules/state-in-constructor.js

Lines changed: 0 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,6 @@ ruleTester.run('state-in-constructor', rule, {
3636
}
3737
}
3838
`
39-
}, {
40-
code: `
41-
class Foo extends React.Component {
42-
render() {
43-
return <div>Foo</div>
44-
}
45-
}
46-
`,
47-
options: ['always']
4839
}, {
4940
code: `
5041
class Foo extends React.Component {
@@ -92,20 +83,6 @@ ruleTester.run('state-in-constructor', rule, {
9283
}
9384
}
9485
`
95-
}, {
96-
code: `
97-
class Foo extends React.Component {
98-
constructor(props) {
99-
super(props)
100-
this.state = { bar: 0 }
101-
}
102-
baz = { bar: 0 }
103-
render() {
104-
return <div>Foo</div>
105-
}
106-
}
107-
`,
108-
options: ['always']
10986
}, {
11087
code: `
11188
class Foo extends React.Component {
@@ -118,19 +95,6 @@ ruleTester.run('state-in-constructor', rule, {
11895
}
11996
}
12097
`
121-
}, {
122-
code: `
123-
class Foo extends React.Component {
124-
constructor(props) {
125-
super(props)
126-
this.baz = { bar: 0 }
127-
}
128-
render() {
129-
return <div>Foo</div>
130-
}
131-
}
132-
`,
133-
options: ['always']
13498
}, {
13599
code: `
136100
class Foo extends React.Component {
@@ -153,16 +117,6 @@ ruleTester.run('state-in-constructor', rule, {
153117
}
154118
}
155119
`
156-
}, {
157-
code: `
158-
class Foo extends React.Component {
159-
baz = { bar: 0 }
160-
render() {
161-
return <div>Foo</div>
162-
}
163-
}
164-
`,
165-
options: ['always']
166120
}, {
167121
code: `
168122
class Foo extends React.Component {
@@ -177,11 +131,6 @@ ruleTester.run('state-in-constructor', rule, {
177131
code: `
178132
const Foo = () => <div>Foo</div>
179133
`
180-
}, {
181-
code: `
182-
const Foo = () => <div>Foo</div>
183-
`,
184-
options: ['always']
185134
}, {
186135
code: `
187136
const Foo = () => <div>Foo</div>
@@ -193,13 +142,6 @@ ruleTester.run('state-in-constructor', rule, {
193142
return <div>Foo</div>
194143
}
195144
`
196-
}, {
197-
code: `
198-
function Foo () {
199-
return <div>Foo</div>
200-
}
201-
`,
202-
options: ['always']
203145
}, {
204146
code: `
205147
function Foo () {
@@ -289,19 +231,6 @@ ruleTester.run('state-in-constructor', rule, {
289231
errors: [{
290232
message: 'State initialization should be in a constructor'
291233
}]
292-
}, {
293-
code: `
294-
class Foo extends React.Component {
295-
state = { bar: 0 }
296-
render() {
297-
return <div>Foo</div>
298-
}
299-
}
300-
`,
301-
options: ['always'],
302-
errors: [{
303-
message: 'State initialization should be in a constructor'
304-
}]
305234
}, {
306235
code: `
307236
class Foo extends React.Component {
@@ -315,20 +244,6 @@ ruleTester.run('state-in-constructor', rule, {
315244
errors: [{
316245
message: 'State initialization should be in a constructor'
317246
}]
318-
}, {
319-
code: `
320-
class Foo extends React.Component {
321-
state = { bar: 0 }
322-
baz = { bar: 0 }
323-
render() {
324-
return <div>Foo</div>
325-
}
326-
}
327-
`,
328-
options: ['always'],
329-
errors: [{
330-
message: 'State initialization should be in a constructor'
331-
}]
332247
}, {
333248
code: `
334249
class Foo extends React.Component {
@@ -345,39 +260,6 @@ ruleTester.run('state-in-constructor', rule, {
345260
errors: [{
346261
message: 'State initialization should be in a constructor'
347262
}]
348-
}, {
349-
code: `
350-
class Foo extends React.Component {
351-
constructor(props) {
352-
super(props)
353-
this.baz = { bar: 0 }
354-
}
355-
state = { baz: 0 }
356-
render() {
357-
return <div>Foo</div>
358-
}
359-
}
360-
`,
361-
options: ['always'],
362-
errors: [{
363-
message: 'State initialization should be in a constructor'
364-
}]
365-
}, {
366-
code: `
367-
class Foo extends React.Component {
368-
constructor(props) {
369-
super(props)
370-
this.state = { bar: 0 }
371-
}
372-
state = { baz: 0 }
373-
render() {
374-
return <div>Foo</div>
375-
}
376-
}
377-
`,
378-
errors: [{
379-
message: 'State initialization should be in a constructor'
380-
}]
381263
}, {
382264
code: `
383265
class Foo extends React.Component {
@@ -391,7 +273,6 @@ ruleTester.run('state-in-constructor', rule, {
391273
}
392274
}
393275
`,
394-
options: ['always'],
395276
errors: [{
396277
message: 'State initialization should be in a constructor'
397278
}]

0 commit comments

Comments
 (0)