git提交时由于eslint的检测机制报错:npm run lint-staged:js found some errors
git提交时报了两条错误:
1、stylelint --syntax less found some errors. Please fix them and try committing again
2、npm run lint-staged:js found some errors. Please fix them and try committing again.
vscode报错如下:
E:\wanghx\react-antd-pro\config\config.js
0:0 warning File ignored because of a matching ignore pattern. Use "--no-ignore" to override
E:\wanghx\react-antd-pro\config\router.config.js
0:0 warning File ignored because of a matching ignore pattern. Use "--no-ignore" to override
E:\wanghx\react-antd-pro\src\pages\Table\TablePagination\index.jsx
4:10 warning 'FormattedMessage' is defined but never used @typescript-eslint/no-unused-vars
8:28 error Curly braces are unnecessary here react/jsx-curly-brace-presence
9:17 error Curly braces are unnecessary here react/jsx-curly-brace-presence
19:17 error Curly braces are unnecessary here react/jsx-curly-brace-presence
6 problems (3 errors, 3 warnings)
3 errors and 0 warnings potentially fixable with the `--fix` option.
第一种解决方案,在提交时加入 --no-verify参数,用来跳过检测机制,输入以下命令:
git commit --no-verify -m "提交时的注释"
另一种解决方案:
找到根目录中的.eslintignore文件,将src放入其中,以便git提交时跳过src目录中所有文件的eslint检测机制。如下
build/*.js
src
public
dist
文章来源:https://www.toymoban.com/news/detail-735959.html
文章来源地址https://www.toymoban.com/news/detail-735959.html
到了这里,关于git 提交报错eslint --fix found some errors. Please fix them and try committing again...的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!