目前,我遇到了这些 linting 错误:
ESLint:UNSAFE_componentWillUpdate 应该放在 someFunction (react/sort-comp) 之后
和
ESLint:标识符“UNSAFE_componentWillUpdate”不是驼峰式。 (驼峰式)
目前,我无法找到正确的规则添加到 .eslintrc
以应用于前置的 UNSAFE_
组件生命周期。我试图让它适用于 react/sort-comp
和 camelcase
规则,任何线索/帮助将不胜感激
最佳答案
你可以将它添加到你的 eslint
"camelcase": [
"error", {
"ignoreDestructuring": true,
"allow": [ "^UNSAFE_" ]
}
],
这基本上只允许所有重命名的 UNSAFE_
生命周期方法。
关于javascript - React JS - ESLint - 忽略具有 UNSAFE_componentWillMount、UNSAFE_componentWillUpdate 和 UNSAFE_componentWillReceiveProps 的组件的规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53844282/