[英]Eslint "No files matching the pattern "lint" were found. Please check for typing mistakes in the pattern." error
[英]Getting an error 'No files matching the pattern were found' when using prettier
我找到了这个答案 如何使用更漂亮的代码格式化
这是我所做的
npm i prettier -g
prettier --write \"./**/*.{js,html}\"
出现错误[error] No files matching the pattern were found: ""./**/*.{js,html}"".
任何想法如何解决? 你认为这是因为我在全球范围内安装了prettier
的(在答案中它是在本地安装的)?
那么当它被全局安装时,你将如何使用它呢?
可能引号是错误的。 应该是:
prettier --write "./**/*.{js,html}"
没有反斜杠。
这里提出了一个解决这个问题的方法:实际上对我有用。 注意我在 Windows 机器上,所以不确定它在其他机器上的表现如何。 只需删除表达式(引号)之前和之后的任何内容:
prettier --write ./**/*.{js,html}
问题在于引号
我正在使用
prettier --write 'src//**/*.{js,jsx,json}'
这是我修复我的方法
prettier --write src//**/*.{js,jsx,json}
这是针对 errno 2
如果您在package.json
中有更漂亮的脚本设置,则需要将文件路径用引号括起来,转义双引号或使用单引号:
"prettier": "prettier 'src/**/*'"
"prettier": "prettier \"src/**/*\""
对我有用的是使用此命令全局安装触摸命令
npm install touch-cli -g
然后使用 touch 命令创建 your.prettierrc 文件
touch .prettierrc
将简单的配置放在 .prettierrc 文件中,例如
{
“trailingComma”:“es5”,“tabWidth”:4,“semi”:假,“singleQuote”:真}
然后在 package.json 文件中写入以下脚本
"scripts": {
"prettier":"npx prettier --config .prettierrc \"src/**/*.js\" --write"
}
然后使用 npm 命令运行脚本
npm run prettier
我正在使用 windows 计算机。 删除双引号对我有用。
这是package.json上的脚本
"prettier-format": "prettier --config .prettierrc src/**/*.ts --write"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.