git提交時(shí)由于eslint的檢測(cè)機(jī)制報(bào)錯(cuò):npm run lint-staged:js found some errors
git提交時(shí)報(bào)了兩條錯(cuò)誤:
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報(bào)錯(cuò)如下:
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.
?第一種解決方案,在提交時(shí)加入 --no-verify參數(shù),用來(lái)跳過(guò)檢測(cè)機(jī)制,輸入以下命令:
git commit --no-verify -m "提交時(shí)的注釋"
另一種解決方案:
找到根目錄中的.eslintignore文件,將src放入其中,以便git提交時(shí)跳過(guò)src目錄中所有文件的eslint檢測(cè)機(jī)制。如下
build/*.js
src
public
dist
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-735959.html
?文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-735959.html
到了這里,關(guān)于git 提交報(bào)錯(cuò)eslint --fix found some errors. Please fix them and try committing again...的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!