Skip to content

Commit

Permalink
Remove test cases for always option in state-in-constructor rule
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lukyth committed Aug 19, 2018
1 parent 4706e86 commit 81d0e8b
Showing 1 changed file with 0 additions and 119 deletions.
119 changes: 0 additions & 119 deletions tests/lib/rules/state-in-constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ ruleTester.run('state-in-constructor', rule, {
}
}
`
}, {
code: `
class Foo extends React.Component {
render() {
return <div>Foo</div>
}
}
`,
options: ['always']
}, {
code: `
class Foo extends React.Component {
Expand Down Expand Up @@ -92,20 +83,6 @@ ruleTester.run('state-in-constructor', rule, {
}
}
`
}, {
code: `
class Foo extends React.Component {
constructor(props) {
super(props)
this.state = { bar: 0 }
}
baz = { bar: 0 }
render() {
return <div>Foo</div>
}
}
`,
options: ['always']
}, {
code: `
class Foo extends React.Component {
Expand All @@ -118,19 +95,6 @@ ruleTester.run('state-in-constructor', rule, {
}
}
`
}, {
code: `
class Foo extends React.Component {
constructor(props) {
super(props)
this.baz = { bar: 0 }
}
render() {
return <div>Foo</div>
}
}
`,
options: ['always']
}, {
code: `
class Foo extends React.Component {
Expand All @@ -153,16 +117,6 @@ ruleTester.run('state-in-constructor', rule, {
}
}
`
}, {
code: `
class Foo extends React.Component {
baz = { bar: 0 }
render() {
return <div>Foo</div>
}
}
`,
options: ['always']
}, {
code: `
class Foo extends React.Component {
Expand All @@ -177,11 +131,6 @@ ruleTester.run('state-in-constructor', rule, {
code: `
const Foo = () => <div>Foo</div>
`
}, {
code: `
const Foo = () => <div>Foo</div>
`,
options: ['always']
}, {
code: `
const Foo = () => <div>Foo</div>
Expand All @@ -193,13 +142,6 @@ ruleTester.run('state-in-constructor', rule, {
return <div>Foo</div>
}
`
}, {
code: `
function Foo () {
return <div>Foo</div>
}
`,
options: ['always']
}, {
code: `
function Foo () {
Expand Down Expand Up @@ -289,19 +231,6 @@ ruleTester.run('state-in-constructor', rule, {
errors: [{
message: 'State initialization should be in a constructor'
}]
}, {
code: `
class Foo extends React.Component {
state = { bar: 0 }
render() {
return <div>Foo</div>
}
}
`,
options: ['always'],
errors: [{
message: 'State initialization should be in a constructor'
}]
}, {
code: `
class Foo extends React.Component {
Expand All @@ -315,20 +244,6 @@ ruleTester.run('state-in-constructor', rule, {
errors: [{
message: 'State initialization should be in a constructor'
}]
}, {
code: `
class Foo extends React.Component {
state = { bar: 0 }
baz = { bar: 0 }
render() {
return <div>Foo</div>
}
}
`,
options: ['always'],
errors: [{
message: 'State initialization should be in a constructor'
}]
}, {
code: `
class Foo extends React.Component {
Expand All @@ -345,39 +260,6 @@ ruleTester.run('state-in-constructor', rule, {
errors: [{
message: 'State initialization should be in a constructor'
}]
}, {
code: `
class Foo extends React.Component {
constructor(props) {
super(props)
this.baz = { bar: 0 }
}
state = { baz: 0 }
render() {
return <div>Foo</div>
}
}
`,
options: ['always'],
errors: [{
message: 'State initialization should be in a constructor'
}]
}, {
code: `
class Foo extends React.Component {
constructor(props) {
super(props)
this.state = { bar: 0 }
}
state = { baz: 0 }
render() {
return <div>Foo</div>
}
}
`,
errors: [{
message: 'State initialization should be in a constructor'
}]
}, {
code: `
class Foo extends React.Component {
Expand All @@ -391,7 +273,6 @@ ruleTester.run('state-in-constructor', rule, {
}
}
`,
options: ['always'],
errors: [{
message: 'State initialization should be in a constructor'
}]
Expand Down

0 comments on commit 81d0e8b

Please sign in to comment.