prettier - 更漂亮的不清理项目根目录中的文件
问题描述
我正在使用 Prettier 来清理我的打字稿。在我的 package.json 中,我有以下脚本:
"scripts": {
"pretty": "prettier --write server/src/**/*.ts"
}
我的.prettierignore
文件:
.DS_Store
node_modules/
lib/
static/
*.config.js
我的项目中有这些文件:
server:
package.json
tsconfig.json
lib/
src/
scripts/
Mine.ts
Block.ts
Chain.ts
...
出于某种原因,prettier 只涉及server/src/scripts/Mine.ts
. 如果我删除该目录,那么 中只有文件server/src
,它会触及每个文件。但是一旦有子目录,src
目录中的文件就会被忽略。这也发生在我的 webui 项目中。
如果我尝试prettier --write server/src/*.ts
,它不会递归不同的目录,但它会触及server/src
.
它说 prettier 使用 fast-glob。fast-glob 文档有这个例子:
src/**/*.js — matches all files in the src directory (any level of nesting) that have the .js extension.
我究竟做错了什么?
解决方案
推荐阅读
- android - 如何将时间选择器添加到 Kotlin 中的 sharedPreference 和 textView 中,因为 sharedPreferences 和 textview 总是显示当前时间?
- visual-studio-code - 如何在 VSCode 中不显示多余的垂直线
- apache-spark - aws athena 在 spark 中是否具有 select struct('*') 的等价物?
- python - 在微调 Layoutlm 时过度拟合小数据集。建议使用哪些正则化技术?
- json - 添加外部帐户作为 S3 对象的 ACL
- python - StyleFrame row_index AttributeError:“int”对象没有属性“value”
- java - 如何在firestore中使用给定的语句
- nfs - GnuCobol 编译器 COBC 不能与 NFS 挂载磁盘的 -I 选项一起正常工作
- python - 从 Pandas 数据帧到 Spark 数据帧的转换需要大量时间
- c# - 如何从 api 获取单个对象并显示它