首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >响应JS - ESLint -使用UNSAFE_componentWillMount、UNSAFE_componentWillUpdate和UNSAFE_componentWillReceiveProps忽略组件的规则

响应JS - ESLint -使用UNSAFE_componentWillMount、UNSAFE_componentWillUpdate和UNSAFE_componentWillReceiveProps忽略组件的规则
EN

Stack Overflow用户
提问于 2018-12-19 03:42:49
回答 1查看 1.3K关注 0票数 3

目前,我得到了这些衬里错误:

ESLint: UNSAFE_componentWillUpdate should be placed after someFunction (react/sort-comp)

ESLint: Identifier 'UNSAFE_componentWillUpdate' is not in camel case. (camelcase)

目前,我无法找到将正确的规则添加到.eslintrc以应用于预先添加的UNSAFE_组件生命周期。我试图使它同时适用于react/sort-compcamelcase规则,任何线索/帮助都将不胜感激

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-12-17 08:43:27

你可以把这个加到你的棉布上

代码语言:javascript
复制
"camelcase": [
  "error", {
    "ignoreDestructuring": true,
    "allow": [ "^UNSAFE_" ]
  }
],

这基本上只允许所有重命名的UNSAFE_生命周期方法。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53844282

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档