Skip to content

Commit

Permalink
Duplicate the test cases with the default parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joachim Seminck committed May 31, 2017
1 parent ebc6778 commit 8983d64
Showing 1 changed file with 165 additions and 0 deletions.
165 changes: 165 additions & 0 deletions tests/lib/rules/no-unused-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -1504,6 +1504,24 @@ ruleTester.run('no-unused-prop-types', rule, {
'}'
].join('\n'),
parser: 'babel-eslint'
}, {
code: [
'class Hello extends Component {',
' shouldComponentUpdate (props) {',
' if (props.foo) {',
' return true;',
' }',
' }',
'',
' render() {',
' return (<div>{this.props.bar}</div>);',
' }',
'}',
'Hello.propTypes = {',
' foo: PropTypes.string,',
' bar: PropTypes.string,',
'};'
].join('\n')
}, {
code: [
'class Hello extends Component {',
Expand All @@ -1524,6 +1542,24 @@ ruleTester.run('no-unused-prop-types', rule, {
'}'
].join('\n'),
parser: 'babel-eslint'
}, {
code: [
'class Hello extends Component {',
' componentWillUpdate (props) {',
' if (props.foo) {',
' return true;',
' }',
' }',
'',
' render() {',
' return (<div>{this.props.bar}</div>);',
' }',
'}',
'Hello.propTypes = {',
' foo: PropTypes.string,',
' bar: PropTypes.string,',
'};'
].join('\n')
}, {
code: [
'class Hello extends Component {',
Expand All @@ -1545,6 +1581,24 @@ ruleTester.run('no-unused-prop-types', rule, {
'}'
].join('\n'),
parser: 'babel-eslint'
}, {
code: [
'class Hello extends Component {',
' componentWillReceiveProps (props) {',
' if (props.foo) {',
' return true;',
' }',
' }',
'',
' render() {',
' return (<div>{this.props.bar}</div>);',
' }',
'}',
'Hello.propTypes = {',
' foo: PropTypes.string,',
' bar: PropTypes.string,',
'};'
].join('\n')
}, {
code: [
'class Hello extends Component {',
Expand All @@ -1565,6 +1619,24 @@ ruleTester.run('no-unused-prop-types', rule, {
'}'
].join('\n'),
parser: 'babel-eslint'
}, {
code: [
'class Hello extends Component {',
' shouldComponentUpdate (nextProps) {',
' if (nextProps.foo) {',
' return true;',
' }',
' }',
'',
' render() {',
' return (<div>{this.props.bar}</div>);',
' }',
'}',
'Hello.propTypes = {',
' foo: PropTypes.string,',
' bar: PropTypes.string,',
'};'
].join('\n')
}, {
code: [
'class Hello extends Component {',
Expand All @@ -1585,6 +1657,24 @@ ruleTester.run('no-unused-prop-types', rule, {
'}'
].join('\n'),
parser: 'babel-eslint'
}, {
code: [
'class Hello extends Component {',
' componentWillUpdate (nextProps) {',
' if (nextProps.foo) {',
' return true;',
' }',
' }',
'',
' render() {',
' return (<div>{this.props.bar}</div>);',
' }',
'}',
'Hello.propTypes = {',
' foo: PropTypes.string,',
' bar: PropTypes.string,',
'};'
].join('\n')
}, {
code: [
'class Hello extends Component {',
Expand All @@ -1605,6 +1695,24 @@ ruleTester.run('no-unused-prop-types', rule, {
'}'
].join('\n'),
parser: 'babel-eslint'
}, {
code: [
'class Hello extends Component {',
' componentDidUpdate (prevProps) {',
' if (prevProps.foo) {',
' return true;',
' }',
' }',
'',
' render() {',
' return (<div>{this.props.bar}</div>);',
' }',
'}',
'Hello.propTypes = {',
' foo: PropTypes.string,',
' bar: PropTypes.string,',
'};'
].join('\n')
}
],

Expand Down Expand Up @@ -2572,6 +2680,25 @@ ruleTester.run('no-unused-prop-types', rule, {
line: 4,
column: 10
}]
}, {
code: [
'class Hello extends Component {',
' componentWillUpdate (nextProps) {',
' if (nextProps.foo) {',
' return true;',
' }',
' }',
'}',
'Hello.propTypes = {',
' foo: PropTypes.string,',
' bar: PropTypes.string,',
'};'
].join('\n'),
errors: [{
message: '\'bar\' PropType is defined but prop is never used',
line: 19,
column: 10
}]
}, {
code: [
'class Hello extends Component {',
Expand All @@ -2593,6 +2720,25 @@ ruleTester.run('no-unused-prop-types', rule, {
line: 4,
column: 10
}]
}, {
code: [
'class Hello extends Component {',
' shouldComponentUpdate (nextProps) {',
' if (nextProps.foo) {',
' return true;',
' }',
' }',
'}',
'Hello.propTypes = {',
' foo: PropTypes.string,',
' bar: PropTypes.string,',
'};'
].join('\n'),
errors: [{
message: '\'bar\' PropType is defined but prop is never used',
line: 19,
column: 10
}]
}, {
code: [
'class Hello extends Component {',
Expand All @@ -2614,6 +2760,25 @@ ruleTester.run('no-unused-prop-types', rule, {
line: 4,
column: 10
}]
}, {
code: [
'class Hello extends Component {',
' componentDidUpdate (nextProps) {',
' if (nextProps.foo) {',
' return true;',
' }',
' }',
'}',
'Hello.propTypes = {',
' foo: PropTypes.string,',
' bar: PropTypes.string,',
'};'
].join('\n'),
errors: [{
message: '\'bar\' PropType is defined but prop is never used',
line: 19,
column: 10
}]
}
/* , {
// Enable this when the following issue is fixed
Expand Down

0 comments on commit 8983d64

Please sign in to comment.