为什么我收到代码 2:“没有匹配的文件”?

问题描述

有人可以向我解释为什么我会得到这个结果吗? 我尝试运行:npx prettier --c .

.prettierignore :

*
!src/app/
!src/app/**

结果:

[error] No matching files. Patterns tried: . !**/node_modules/** !./node_modules/** !**/.{git,svn,hg}/** !./.{git,hg}/**
All matched files use Prettier code style!
npm ERR! code 2
npm ERR! path D:\Users\Guillaume\Documents\Work\project-front
npm ERR! command Failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c "prettier "--check" ".""

解决方法

这就是 gitignore syntax 的工作原理。滚动到该页面的末尾,您会看到一个与您的非常相似的示例。

显然,您的 .prettierignore 应该如下所示:

/*
!/src
/src/*
!/src/app