简体   繁体   English

package.json-.ts .tsx .js .jsx的路径名模式

[英]package.json - pathname pattern for .ts .tsx .js .jsx

I am trying to write a npm script that goes trought all of my src files and tests (lints) files that end in either .ts .tsx .js or .jsx . 我正在尝试编写一个npm脚本,该脚本遍历了所有以.ts .tsx .js.jsx结尾的src文件和测试(皮棉)文件。 So the linter should test all of these (and only these). 因此,lint应该测试所有这些(并且仅测试这些)。

What I have so far: "lint": "eslint --max-warnings 0 --ext .js \\"src/**/*.ts*\\"" 到目前为止,我所拥有的: "lint": "eslint --max-warnings 0 --ext .js \\"src/**/*.ts*\\""

  • Does this test both .ts and .tsx files? 这会同时测试.ts.tsx文件吗?
  • How do I write a pattern for multiple file types? 如何为多种文件类型编写模式?

You could do it like this: 您可以这样做:

"lint": "eslint --max-warnings 0 --ext .js \"src/**/*.{ts,tsx}\""  

As can be seen Here 可以在这里看到

As far as I know, that is the only way to handle multiple file extensions. 据我所知,这是处理多个文件扩展名的唯一方法。 When using a asteriks, i get the feedback "The system cannot find the path specified." 使用星号时,我得到反馈“系统找不到指定的路径”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM