我在Visual Code中使用ESLint格式化JS文件,但每次运行时都会出现错误。以下是我的命令行:
node ./node_modules/eslint/bin/eslint -- src --fix
错误信息如下:
E:\PATH\src\reducers\roote-reducer.js
1:8 error There should be no space after '{' object-curly-spacing
1:26 error There should be no space before '}' object-curly-spacing
6:1 error Expected indentation of 1 tab but found 2 spaces indent
7:1 error Expected indentation of 1 tab but found 2 spaces indent
8:4 error Newline required at end of file but not found eol-last
E:\PATH\src\reducers\schedule-reducer.js
1:8 error There should be no space after '{' object-curly-spacing
1:22 error There should be no space before '}' object-curly-spacing
4:1 error Expected indentation of 1 tab but found 4 spaces indent
7:24 error Missing space before function parentheses space-before-function-paren
7:54 error Missing space before opening brace space-before-blocks
8:1 error Expected indentation of 1 tab but found 4 spaces indent
9:1 error Expected indentation of 1 tab but found 4 spaces indent
E:\PATH\src\register-service-worker.js
12:1 error Expected indentation of 1 tab but found 2 spaces indent
17:1 error Expected indentation of 5 tabs but found 6 spaces indent
17:7 error Use regex shorthands to improve readability unicorn/regex-shorthand
22:1 error Expected indentation of 1 tab but found 2 spaces indent
✖ 309 problems (309 errors, 0 warnings)
309 errors, 0 warnings potentially fixable with the `--fix` option.
我如何自动修复它们?
--fix
修复。 - piuspbd