【发布时间】:2020-08-19 07:08:24
【问题描述】:
我有一个问题,当我提交时,我有 Husky 检查缩进错误/常见错误(如未使用道具......等)。我的应用是 TypeScript React-Native 应用。
我得到以下信息:
25:1 error Expected indentation of 4 spaces but found 2 indent
26:1 error Expected indentation of 2 spaces but found 0 indent
27:1 error Expected indentation of 4 spaces but found 2 indent
28:1 error Expected indentation of 6 spaces but found 4 indent
29:1 error Expected indentation of 8 spaces but found 6 indent
30:1 error Expected indentation of 8 spaces but found 6 indent
31:1 error Expected indentation of 10 spaces but found 8 indent
32:1 error Expected indentation of 10 spaces but found 8 indent
33:1 error Expected indentation of 10 spaces but found 8 indent
34:1 error Expected indentation of 10 spaces but found 8 indent
35:1 error Expected indentation of 10 spaces but found 8 indent
36:1 error Expected indentation of 8 spaces but found 6 indent
37:1 error Expected indentation of 6 spaces but found 4 indent
39:1 error Expected indentation of 6 spaces but found 4 indent
40:1 error Expected indentation of 8 spaces but found 6 indent
41:1 error Expected indentation of 8 spaces but found 6 indent
42:1 error Expected indentation of 8 spaces but found 6 indent
43:1 error Expected indentation of 8 spaces but found 6 indent
44:1 error Expected indentation of 6 spaces but found 4 indent
45:1 error Expected indentation of 4 spaces but found 2 indent
46:1 error Expected indentation of 2 spaces but found 0 indent
我的VSCode设置为2个空格,
我的eslint.rc 规则是"indent": ["error", 2],我的prettier.rc 设置为"tabWidth": 2,
我不明白为什么它会出错,代码的格式应该是这样的。我什至在 Mac 上跑得更漂亮command-shift-f。
有什么想法吗?
【问题讨论】:
标签: typescript react-native eslint prettier