reactjs - React eslint 的意外行为
问题描述
我正在尝试在 React App 中进行一些更改,但我正在编译失败并给我这些错误
Expected indentation of 2 spaces but found 4 indent
Line 7:1: Expected indentation of 2 spaces but found 4 indent
Line 8:9: Expected indentation of 6 space characters but found 8 react/jsx-indent
Line 9:13: Expected indentation of 10 space characters but found 12 react/jsx-indent
Line 11:1: Expected indentation of 2 spaces but found 4 indent
如果我添加额外的空间,我什至会得到一个错误,请分享我如何删除这些限制。
解决方案
两种选择
- 禁用 lint
- 改变你的 Eslint 规则
如果您使用 VS 代码作为编辑器,则只需运行文档格式命令,例如
option+shift+F [for mac]
alt+shift+F
[用于窗户]
推荐阅读
- java - 如何从自定义 ToolWindow 调用 IntelliJ 重命名重构?
- ios - 如何在 Swift 中返回 0 而不是 Nan?
- html - 使用 JQuery 修改 HTML 中的类名
- python - 为什么有些人将两个不同网络的参数链接起来并用相同的优化器训练它们?
- android - putBytes() 与 putFile() 用于上传图像
- discord.js - 我安装了 quick.db,但它仍然无法正常工作
- c++ - 通过将对象显式存储为基类来抑制虚拟机制?
- android - 在 React-native 中 Gradle allprojects
- javascript - 如果消息以前缀 + 使用 discord.js 的命令开头,如何使 if 语句起作用
- excel - 从 API 下载 CSV 文件,其列数可变