"react/jsx-uses-vars": 2,
Run Code Online (Sandbox Code Playgroud)
在规则对象下的 .eslintrc 文件中,我有此属性和其他属性,其值为 0、1 和 2。值 0、1、2 表示什么?
Nik*_*Nik 21
规则有几个级别:
\n\n\n\n\n“off”或 0 - 关闭规则
\n\n“warn”或 1 - 打开规则作为警告(n\xe2\x80\x99t 是否影响退出代码)
\n\n"error" 或 2 - 将规则作为错误打开(触发时退出代码为 1)
\n
例如:
\n\nreact/no-did-mount-set-state: 0
如果在 componentDidMount 中使用 setState,\xe2\x80\x94 不会显示错误react/no-did-mount-set-state: 1
\xe2\x80\x94 将显示警告react/no-did-mount-set-state: 2
\xe2\x80\x94 将显示错误。所以这些值类似于:
\n\nreact/no-did-mount-set-state: "off"
==react/no-did-mount-set-state: 0
react/no-did-mount-set-state: "warning"
==react/no-did-mount-set-state: 1
react/no-did-mount-set-state: "error"
===react/no-did-mount-set-state: 2
另外,您可以在文档中查看:https://eslint.org/docs/user-guide/configuring#configuring-rules
\n 归档时间: |
|
查看次数: |
7710 次 |
最近记录: |