diff --git a/docs/rules/no-deprecated.md b/docs/rules/no-deprecated.md
index 2ca554168a..8e168543e5 100644
--- a/docs/rules/no-deprecated.md
+++ b/docs/rules/no-deprecated.md
@@ -16,6 +16,12 @@ React.findDOMNode(this.refs.foo);
React.renderToString();
React.renderToStaticMarkup();
+
+React.createClass({ /* Class object */ });
+
+const propTypes = {
+ foo: React.PropTypes.bar,
+};
```
The following patterns are not considered warnings:
diff --git a/lib/rules/no-deprecated.js b/lib/rules/no-deprecated.js
index 4552a4f688..be063e91da 100644
--- a/lib/rules/no-deprecated.js
+++ b/lib/rules/no-deprecated.js
@@ -64,6 +64,9 @@ module.exports = {
deprecated.MemberExpression['Perf.printDOM'] = ['15.0.0', 'Perf.printOperations'];
deprecated.MemberExpression['ReactPerf.getMeasurementsSummaryMap'] = ['15.0.0', 'ReactPerf.getWasted'];
deprecated.MemberExpression['Perf.getMeasurementsSummaryMap'] = ['15.0.0', 'Perf.getWasted'];
+ // 15.5.0
+ 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;
}
diff --git a/tests/lib/rules/no-deprecated.js b/tests/lib/rules/no-deprecated.js
index 6a775767d1..8ebb3ce847 100644
--- a/tests/lib/rules/no-deprecated.js
+++ b/tests/lib/rules/no-deprecated.js
@@ -23,7 +23,6 @@ ruleTester.run('no-deprecated', rule, {
valid: [
// Not deprecated
- 'var MyClass = React.createClass({});',
'var element = React.createElement(\'p\', {}, null);',
'var clone = React.cloneElement(element);',
'ReactDOM.render(element, container);',
@@ -32,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: [{
@@ -94,6 +95,22 @@ ruleTester.run('no-deprecated', rule, {
'use ReactDOMServer.renderToStaticMarkup instead'
)
}]
+ }, {
+ code: 'React.createClass({});',
+ 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: [{
+ message: 'React.PropTypes is deprecated since React 15.5.0, use the npm module prop-types instead'
+ }]
}]
});