gpt4 book ai didi

javascript - --fix 不修复使用 eslint 的错误

转载 作者:行者123 更新时间:2023-12-03 13:17:13 24 4
gpt4 key购买 nike

我在可视代码中使用 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选项,您需要直接运行eslint。

试试这个

./node_modules/.bin/eslint src --fix

在 Windows 上:

.\node_modules\.bin\eslint src\** --fix

关于javascript - --fix 不修复使用 eslint 的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51265476/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com