Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

babel-plugin-react-check

dingquantracy8MIT1.0.1

babel plugin used to check react code

babel-plugin, babel, react

readme

babel-plugin-react-check

目前检测的内容有:

  1. 禁止使用 class properties 的方式定义方法

  2. 禁止在 'constructor', 'componentWillMount', 'componentDidUpdate' 三个方法中使用 this.setState

  3. 禁止在 'constructor', 'componentWillMount' 中使用 'document', 'window', 'location' 等全局变量,防止 SSR 时报错

  4. 如果一个组件中进行了 addEventListener(), 一定要进行 removeEventListener()