[英]Expected indentation of 4 spaces but found 0
ESLint warns me I should have spaces, where indentation seems normally set up: ESLint 警告我应该有空格,缩进似乎通常设置:
5 export const TimerContext = React.createContext<{
6 totalSeconds: number | null;
7 remainingSeconds: number | null;
8 startTimer: (s: number) => void;
9 stopTimer: () => void;
10 }>({
11 totalSeconds: null,
12 remainingSeconds: null,
13 startTimer: (_: number) => {},
14 stopTimer: () => {},
15 });
Error returned by eslint: eslint 返回的错误:
10:1 error Expected indentation of 4 spaces but found 0 indent
My.eslintrc has: My.eslintrc 有:
"indent": ["error", 2],
Why is that?这是为什么? Can't see a reason why the object type should be indented more than its member types.
看不出 object 类型应该比其成员类型缩进更多的原因。
Solution was to use "react/jsx-indent" config option, as suggested by @visizky in the comments section:解决方案是使用“react/jsx-indent”配置选项,正如@visizky 在评论部分所建议的那样:
"react/jsx-indent": [2, 2]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.