当前位置:网站首页>当项目中自动格式化插件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,------------------------------------------------------------------------------------------------
完美
边栏推荐
- 链表的经典入门LeetCode题目
- DSPE-PEG-DBCO,DBCO-PEG-DSPE,磷脂-聚乙二醇-二苯并环辛炔科研实验用
- July 31, 2022 Summary of the third week of summer vacation
- 语音识别学习资源
- 华为云计算HCIE之oceanstor仿真器的使用操作
- dotnet core 使用 CoreRT 将程序编译为 Native 程序
- CAS:474922-26-4,DSPE-PEG-NH2,DSPE-PEG-amine,磷脂-聚乙二醇-氨基供应
- Alibaba Cloud International Edition uses ROS to build WordPress tutorial
- SQL优化最全总结 - MySQL(2022最新版)
- Route lazy loading
猜你喜欢

DOM Clobbering的原理及应用

PT100铂热电阻三种测温方法介绍

斯坦福:未来的RGB LED可以贴在你的皮肤上

2018年南海区小学生程序设计竞赛详细答案

Web端即时通讯技术:WebSocket、socket.io、SSE

After EasyCVR is locally connected to the national standard device to map the public network, the local device cannot play and cascade the solution

Short-term reliability and economic evaluation of resilient microgrids under incentive-based demand response programs (Matlab code implementation)

How to make JS code unbreakable

小程序笔记2

About the two architectures of ETL (ETL architecture and ELT architecture)
随机推荐
自己经常使用的三种调试:Pycharm、Vscode、pdb调试
npm配置国内镜像(淘宝镜像)
基于激励的需求响应计划下弹性微电网的短期可靠性和经济性评估(Matlab代码实现)
悦刻难回巅峰
Route lazy loading
开发那些事儿:如何通过EasyCVR平台获取监控现场的人流量统计数据?
OpenInfra Days China 2022 | SelectDB to share with you the Apache Doris in Internet advertising business practices
Error when using sourcemap for reporting an error: Can‘t resolve original location of error.
js函数传参是按值传递还是按引用传递?
通配符SSL证书不支持多域名吗?
【日记】mysql基本操作
Develop those things: How to obtain the traffic statistics of the monitoring site through the EasyCVR platform?
Thrift installation configuration
FE01_OneHot-Scala应用
Google Earth Engine APP - one-click online viewing of global images from 1984 to this year and loading an image analysis at the same time
企业即时通讯软件有哪些功能?对企业有什么帮助?
Speech Recognition Learning Resources
动态数组底层是如何实现的
小程序笔记1
localstorage本地存储的方法