eslint Oops! Something went wrong!
遇到老多次了

problem

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)

reason

git commit 出现eslint报错
原因是工程没有 .eslintrc.js 配置文件

solution1

可能是项目拷贝过程,丢失了因此文件 .eslintrc.js

solution2

根据提示执行 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

方法

  1. 根据语法提示 修复问题
  2. .eslintrc.js rule中关闭规则
  3. .eslintignore 添加忽略检查的文件
// .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

eslint Oops! Something went wrong!相关推荐

  1. eslint检测时报错

    配置是这样的: 安装的依赖: "devDependencies": {"@babel/core": "^7.9.0","@babe ...

  2. ESLint couldn‘t find the config “standard“ to extend from 解决办法

    记一次给code-server配置eslint的经过 之前在code-server某个项目下配置eslint, 步骤如下: npm i eslint -g eslint --init # 走完配置流程 ...

  3. ESLint问题记录

    1.报错:ESLint: Unexpected string concatenation. (prefer-template) 原因ES6规则:表现符号错误,应该为Tab键上方的·   ,修改如下: ...

  4. VSCode环境下配置ESLint 对Vue单文件的检测

    本文介绍了在VSCode环境下如何配置eslint进行代码检查,并介绍了如何对.vue单文件进行支持. ESLint 安装 1.在工程根目录下,安装eslint及初始化 $ npm install e ...

  5. 如何创建自己的ESLint配置包

    ESLint is a powerful tool that helps you enforce consistent coding conventions and ensure quality in ...

  6. eslint 换行_javascript – 预期的换行符为“LF”,但在Eslint中使用gulp找到“CRLF”换行符...

    当在gulp项目中使用eslint时,我遇到了像这样的错误的问题.预期的linebreaks为'LF',但是发现'CRLF'linebreak-style,我正在使用 Windows环境运行gulp, ...

  7. (开发)ESLint - 代码规范

    参考文档:http://eslint.cn/ ESLint 是在 ECMAScript/JavaScript 代码中识别和报告模式匹配的工具,它的目标是保证代码的一致性和避免错误.在许多方面,它和 J ...

  8. eslint vscode 自动格式化_配置VSCode编辑器适配VUE3开发

    团队协作开发一般都有统一的编码规范,举个例子:A习惯一个tab占位2个空格,B习惯一个tab占位4个空格,如果不统一,提交到仓库的代码将变得难以阅读和维护. 幸运的是我们可以通过插件来规范化代码,只要 ...

  9. 关闭eslint检查2020_2020 vscode配置eslint保存后自动fix

    2020 vscode配置eslint保存后自动fix 这篇文章发布于 2019/10/12,归类于 计算机基础与开发工具 标签: vscode 保存自动fix,vscode 保存执行fix,esli ...

最新文章

  1. Ubuntu18.04+RTX 2080Ti+CUDA 10.0 +cuDNN+PyTorch搭建深度学习环境
  2. Vsphere 6.0
  3. Java的poi的excel导入怎么验证整型格式的单元格
  4. [原]调试实战——程序CPU占用率飙升,你知道如何快速定位吗?
  5. mybatis学习(42):mybatis的一级缓存
  6. 基于阿里云MaxCompute实现游戏数据运营
  7. 搜索算法-三个简单的小问题
  8. Oracle故障:Breaking the connection before proto/dty negotiation, error raised 3136
  9. 华为机试HJ88:扑克牌大小
  10. boost.asio mysql_boost asio学习笔记
  11. 任意文件下载漏洞学习
  12. 漫谈数据仓库中的元数据管理
  13. 思科路由器和交换机的硬件结构
  14. SAP 订单结算方式
  15. 大自然Windows XP日文版镜像
  16. 电瓶车.20180804
  17. Gitlab集成Sonarqube实现自动检测代码并发送报告给提交者
  18. 海康监控虚拟服务器设置,海康监控如何连接网络设置教程
  19. 解决html页面图片大小不能自适应的问题
  20. ORB-SLAM2源码阅读(四)—LoopClosing线程SIM3变换

热门文章

  1. python网页批量查询_批量查询网站的pr
  2. Python readline()和readlines()函数:按行读取文件
  3. wpa_supplicant驱动移植
  4. 第二次作业——Service、Listview与ACtivity参数传递
  5. python 制作srt字幕
  6. 基于NET蛋糕销售网站 毕业设计-附源码090918
  7. (纪中)1747. 马蹄印【DFS】
  8. 月薪10K码农,跳槽到40K架构师,技术学习路线图汇总
  9. oracle数据泵导出 不全,Oracle RAC数据泵导出问题处理
  10. java自动装箱的好处_Java自动拆装箱为什么不起作用了