简体   繁体   English

我可以将.js文件用于TSLint配置吗?

[英]Can I use a .js file for TSLint config?

Choosing a right set of rules, especially for a team of more than 3 members takes a lot of discussion and time. 选择一组正确的规则,尤其是对于一个由3个以上成员组成的团队,这需要花费大量的讨论和时间。 To understand some rules and the necessity of them in every single project members need to try the code with and without it, figuring out what works best. 为了理解某些规则以及每个项目中每个成员的必要性,需要在有无代码的情况下尝试使用代码,找出最有效的代码。

Thus, it would help a lot to be able to comment out and add hints comments to some rules in the tslint.json file but JSON doesn't allow comments. 因此,能够注释掉注释并将注释注释添加到tslint.json文件中的某些规则会tslint.json但是JSON不允许注释。

Even though TSLint seems to work fine with a JSON file with comments, it doesn't look right. 即使TSLint似乎可以很好地处理带有注释的JSON文件,但它看起来并不正确。

Can I use a .js file, like I would do for other JS libs that support config files in JS/JSON? 是否可以像在支持JS / JSON中的配置文件的其他JS库中那样使用.js文件?

Even though TSLint seems to work fine with a JSON file with comments, it doesn't look right. 即使TSLint似乎可以很好地处理带有注释的JSON文件,但它看起来并不正确。

But it is supported for a reason. 但是支持它是有原因的。 Other tools in the TypeScript community also support it including the typescript compiler tsconfig.json . TypeScript社区中的其他工具也支持它,包括tsconfig.json编译器tsconfig.json

Summary 摘要

Use comments in json when its supported 🌹 当JSON支持时在json中使用注释

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

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