eslint Oops! Something went wrong!
遇到老多次了
eslint检查报错:
Oops! Something went wrong!
完整报错信息
> running pre-commit hook: npm run precommit> ant-design-pro@5.0.0 precommit
> lint-staged✔ Preparing...
⚠ Running tasks...↓ No staged files match **/*.less [SKIPPED]❯ Running tasks for **/*.{js,jsx,ts,tsx}✖ npm run lint-staged:js [FAILED]✔ Running tasks for **/*.{js,jsx,tsx,ts,less,md,json}
↓ Skipped because of errors from tasks. [SKIPPED]
✔ Reverting to original state because of errors...
✔ Cleaning up...✖ npm run lint-staged:js:Oops! Something went wrong! :(ESLint: 7.32.0ESLint couldn't find a configuration file. To set up a configuration file for this project, please run:eslint --initESLint looked for configuration files in /path/to/src/pages/NewFun and its ancestors. If it found none, it then looked in your home directory.If you think you already have a configuration file or if you need more help, please stop by the ESLint chat room: https://eslint.org/chat/help> ant-design-pro@5.0.0 lint-staged:js
> eslint --ext .js,.jsx,.ts,.tsx "/path/to/src/pages/NewFun/index.tsx"pre-commit hook failed (add --no-verify to bypass)
git commit 出现eslint报错
原因是工程没有 .eslintrc.js 配置文件
可能是项目拷贝过程,丢失了因此文件 .eslintrc.js
根据提示执行 eslint --init
然后再 git commit 出现语法检查提示
22:16 error Component definition is missing display name react/display-name24:5 error 'React' must be in scope when using JSX react/react-in-jsx-scope25:7 error 'React' must be in scope when using JSX react/react-in-jsx-scope32:7 error 'React' must be in scope when using JSX react/react-in-jsx-scope
方法
// .eslintrc.js
module.exports = {//..."rules": {"react/react-in-jsx-scope":0,"@typescript-eslint/ban-ts-comment": 0,"react/prop-types": 0,"@typescript-eslint/no-explicit-any": 0,"@typescript-eslint/no-non-null-assertion": 0,"react/display-name": 0,}
};
// .eslintignore
src/e2e/baseLayout.e2e.js
版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。
工作时间:8:00-18:00
客服电话
电子邮件
admin@qq.com
扫码二维码
获取最新动态