Skip to content

Commit

Permalink
Use pragma option & add more specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Calyhre committed Apr 18, 2017
1 parent 269bffd commit 3da1140
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/rules/no-deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ module.exports = {
deprecated.MemberExpression['ReactPerf.getMeasurementsSummaryMap'] = ['15.0.0', 'ReactPerf.getWasted'];
deprecated.MemberExpression['Perf.getMeasurementsSummaryMap'] = ['15.0.0', 'Perf.getWasted'];
// 15.5.0
deprecated.MemberExpression['React.createClass'] = ['15.5.0', 'the npm module create-react-class'];
deprecated.MemberExpression['React.PropTypes'] = ['15.5.0', 'the npm module prop-types'];
deprecated.MemberExpression[pragma + '.createClass'] = ['15.5.0', 'the npm module create-react-class'];
deprecated.MemberExpression[pragma + '.PropTypes'] = ['15.5.0', 'the npm module prop-types'];

return deprecated;
}
Expand Down
10 changes: 9 additions & 1 deletion tests/lib/rules/no-deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ ruleTester.run('no-deprecated', rule, {
'ReactDOMServer.renderToString(element);',
'ReactDOMServer.renderToStaticMarkup(element);',
// Deprecated in a later version
{code: 'React.renderComponent()', settings: {react: {version: '0.11.0'}}}
{code: 'React.renderComponent()', settings: {react: {version: '0.11.0'}}},
{code: 'React.createClass()', settings: {react: {version: '15.4.0'}}},
{code: 'React.PropTypes', settings: {react: {version: '15.4.0'}}}
],

invalid: [{
Expand Down Expand Up @@ -98,6 +100,12 @@ ruleTester.run('no-deprecated', rule, {
errors: [{
message: 'React.createClass is deprecated since React 15.5.0, use the npm module create-react-class instead'
}]
}, {
code: 'Foo.createClass({});',
settings: {react: {pragma: 'Foo'}},
errors: [{
message: 'Foo.createClass is deprecated since React 15.5.0, use the npm module create-react-class instead'
}]
}, {
code: 'React.PropTypes',
errors: [{
Expand Down

0 comments on commit 3da1140

Please sign in to comment.