eslint-config-ts-lib
Version:
ts-lib-scripts创建的ts库项目使用的ESLint配置
59 lines (36 loc) • 1.36 kB
Markdown
> 来自 [undefined](undefined) 的规则。
Several methods are deprecated between React versions. This rule will warn you if you try to use a deprecated method. Use the [shared settings](/README.md
Examples of **incorrect** code for this rule:
```jsx
React.render(<MyComponent />, root);
React.unmountComponentAtNode(root);
React.findDOMNode(this.refs.foo);
React.renderToString(<MyComponent />);
React.renderToStaticMarkup(<MyComponent />);
React.createClass({ /* Class object */ });
const propTypes = {
foo: PropTypes.bar,
};
//Any factories under React.DOM
React.DOM.div();
import React, { PropTypes } from 'react';
// old lifecycles (since React 16.9)
componentWillMount() { }
componentWillReceiveProps() { }
componentWillUpdate() { }
```
Examples of **correct** code for this rule:
```jsx
ReactDOM.render(<MyComponent />, root);
// When [1, {"react": "0.13.0"}]
ReactDOM.findDOMNode(this.refs.foo);
import { PropTypes } from 'prop-types';
UNSAFE_componentWillMount() { }
UNSAFE_componentWillReceiveProps() { }
UNSAFE_componentWillUpdate() { }
```
- [react/no-deprecated 官方文档](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-deprecated.md)