当前位置:网站首页>当项目中自动格式化插件Prettier和ESLint冲突报错时如何解决
当项目中自动格式化插件Prettier和ESLint冲突报错时如何解决
2022-08-04 18:05:00 【笑歪了狗头】
一、问题
ESLint 要求尾部不能有分; 后面不能有逗号; 字符串不能双引号,必须单引号;
而用Prettier会自动加上这些,解决办法也简单
------------------------------------------------------------------------------------------------
二、解决
项目根目录新增文件 .prettierrc.js
module.exports = {
semi: false, // 去除分号
singleQuote: true, // 单引号
bracketSpacing: true, //空格
trailingComma: "none", // 去掉逗号
};
此时解决了大部分问题,但还有一个小细节,要求函数名和小括号中间有空格
Prettier没有相关配置只能从ESLint的配置入手
在 .eslintrc.js 文件中 rules中添加一行,就关闭了该错误提示
'space-before-function-paren': 0,
------------------------------------------------------------------------------------------------
完美
边栏推荐
- FE01_OneHot-Scala应用
- 全球电子产品需求放缓:三星越南工厂大幅压缩产能
- Route lazy loading
- July 31, 2022 Summary of the third week of summer vacation
- 2022年五一数学建模C题讲解
- 语音识别学习资源
- 【技术笔记】let 和 var和const的异同
- EasyCVR calls the cloud recording API and returns an error and no recording file is generated. What is the reason?
- 不论你是大众,科班和非科班,我这边整理很久,总结出的学习路线,还不快卷起来
- leetcode/含有所有字符的最短字符串
猜你喜欢
EasyCVR calls the cloud recording API and returns an error and no recording file is generated. What is the reason?
leetcode 13. 罗马数字转整数
Nintendo won't launch any new hardware until March 2023, report says
"Involution" Index Analysis Based on AHP
Flink / Scala - 使用 RedisSink 存储数据
基于 eBPF 的 Kubernetes 可观测实践
SQL优化最全总结 - MySQL(2022最新版)
Develop those things: How to obtain the traffic statistics of the monitoring site through the EasyCVR platform?
JS兼容问题总结
小程序笔记1
随机推荐
Matlab画图1
mood swings
clickhouse 上下线表
Matlab drawing 1
PT100铂热电阻三种测温方法介绍
Error when using sourcemap for reporting an error: Can‘t resolve original location of error.
离线同步odps到mysql 中文乱码是因为?mysql已是utf8mb4
After EasyCVR is locally connected to the national standard device to map the public network, the local device cannot play and cascade the solution
Alibaba Cloud International Edition uses ROS to build WordPress tutorial
EasyCVR如何通过接口调用设备录像的倍速回放?
斯坦福:未来的RGB LED可以贴在你的皮肤上
谁能解答?从mysql的binlog读取数据到kafka,但是数据类型有Insert,updata,
(ECCV-2022)GaitEdge:超越普通的端到端步态识别,提高实用性
小程序笔记3
【注册荣耀开发者】赢【荣耀70】手机
阿里云国际版使用ROS搭建WordPress教程
使用scikit-learn计算文本TF-IDF值
基于层次分析法的“内卷”指数分析
如何模拟后台API调用场景,很细!
Web端即时通讯技术:WebSocket、socket.io、SSE