[英]React JS - ESLint - Rules for ignoring components with UNSAFE_componentWillMount, UNSAFE_componentWillUpdate, and UNSAFE_componentWillReceiveProps
Currently, I'm getting these linting errors:目前,我收到这些 linting 错误:
ESLint: UNSAFE_componentWillUpdate should be placed after someFunction (react/sort-comp)
and和
ESLint: Identifier 'UNSAFE_componentWillUpdate' is not in camel case. (camelcase)
Currently, I'm not able to find the correct rules to add to .eslintrc
to apply to the prepended UNSAFE_
component lifecycles.目前,我无法找到正确的规则来添加到
.eslintrc
以应用于前置的UNSAFE_
组件生命周期。 I'm trying to make it apply to both react/sort-comp
and camelcase
rules, any clues/help would be appreciated我正在尝试使其同时适用于
react/sort-comp
和camelcase
规则,任何线索/帮助将不胜感激
You can add this to your eslint您可以将此添加到您的 eslint
"camelcase": [
"error", {
"ignoreDestructuring": true,
"allow": [ "^UNSAFE_" ]
}
],
This basically just allows all the renamed UNSAFE_
lifecycle methods.这基本上只允许所有重命名的
UNSAFE_
生命周期方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.