当前位置:网站首页>当项目中自动格式化插件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,------------------------------------------------------------------------------------------------
完美
边栏推荐
- 企业即时通讯软件有哪些功能?对企业有什么帮助?
- 公司自用的国产API管理神器
- Web端即时通讯技术:WebSocket、socket.io、SSE
- mysql cdc 为什么需要RELOAD 这个权限?这个权限在采集数据的过程中的作用是什么?有哪
- 【web自动化测试】Playwright快速入门,5分钟上手
- 基于 eBPF 的 Kubernetes 可观测实践
- 小程序学习目标
- Flask framework implementations registered encryption, a Flask enterprise class learning 】 【
- 静态iP与权限更改[通俗易懂]
- Global electronics demand slows: Samsung's Vietnam plant significantly reduces capacity
猜你喜欢

Iptables防火墙基础知识介绍

About the two architectures of ETL (ETL architecture and ELT architecture)

Thrift IDL Sample File

基于层次分析法的“内卷”指数分析

EasyCVR如何通过接口调用设备录像的倍速回放?

链表的经典入门LeetCode题目

buuctf(探险1)

Hezhou Cat1 4G module Air724UG is configured with RNDIS network card or PPP dial-up, and the development board is connected to the Internet through the RNDIS network card (taking the RV1126/1109 devel

The Industrial Metaverse Brings Changes to Industry

【web自动化测试】Playwright快速入门,5分钟上手
随机推荐
buuctf(探险1)
Nintendo won't launch any new hardware until March 2023, report says
2022 May 1 Mathematical Modeling Question C Explanation
dotnet core 输出调试信息到 DebugView 软件
【注册荣耀开发者】赢【荣耀70】手机
又一款高颜值 Redis 官方可视化工具,功能真心强大!
Global electronics demand slows: Samsung's Vietnam plant significantly reduces capacity
2018年南海区小学生程序设计竞赛详细答案
localstorage本地存储的方法
数据库SqlServer迁移PostgreSql实践
静态iP与权限更改[通俗易懂]
YOLOv7-Pose尝鲜,基于YOLOv7的关键点模型测评
【web自动化测试】Playwright快速入门,5分钟上手
JS中null与undefined的异同点
darknet源码阅读笔记-02-list.h和lish.c
DHCP&OSPF combined experimental demonstration (Huawei routing and switching equipment configuration)
【技术笔记】let 和 var和const的异同
Go 言 Go 语,一文看懂 Go 语言文件操作
Matlab画图1
Enterprise survey correlation analysis case