场景

在vue3项目配置hysky进行格式校验,在commit前会先运行npm run lint,但是npm run lint会报错

> eslint --fix './src/**/*.{ts,js,vue}'
Oops! Something went wrong! :(
ESLint: 8.18.0
No files matching the pattern "'./src/**/*.{ts,js,vue}'" were found.
Please check for typing mistakes in the pattern.

在pakage.json中scripts模块找到lint的配置

解决方案

将scripts中的"lint": "eslint --fix './src/**/*.{ts,js,vue}'"改为 "lint": "eslint --fix \"./src/**/*.{ts,js,vue}\""
即有些因为操作系统的缘故,需要将将单引号改成双引号,双引号需要加转义字符

参考文章

https://segmentfault.com/a/1190000038932542?utm_source=tag-newest

Logo

前往低代码交流专区

更多推荐