简体   繁体   English

我可以防止IDE通过TSLint或tsconfig自动包装属性吗?

[英]Can I prevent IDEs from auto-wrapping attributes via TSLint or tsconfig?

When we use PhpStorm to auto reformat code, it wraps at 120 characters. 当我们使用PhpStorm自动重新格式化代码时,它会换成120个字符。 I know I can manually set this in PhpStorm's editor settings, but I have to tell each person on the team to do that on every one of their machines in order to accomplish this. 我知道我可以在PhpStorm的编辑器设置中手动设置此设置,但是我必须告诉团队中的每个人都在其每台计算机上执行此操作才能完成此操作。 And we don't all use PhpStorm either. 而且我们也不全都使用PhpStorm。

Is there a standard, best practice way to set this via tslint.json or tsconfig.app.json so that IDE's wont autoformat to wrapped attributes? 是否有标准的最佳实践方式通过tslint.jsontsconfig.app.json进行设置,以使IDE不会自动格式化为包装的属性?

For instance, I can set "max-line-length": [ false ] in my tslint.json file and it does impact whether I get warnings but doesn't change the behavior of auto-formatters. 例如,我可以在tslint.json文件中设置"max-line-length": [ false ] ,这确实会影响我是否收到警告,但不会更改自动格式化程序的行为。 Am I missing something? 我想念什么吗?

The TSLint max-line-length rule supports setting the limit in tslint.json , like: TSLint max-line-length规则支持在tslint.json设置限制,例如:

"max-line-length": [
      true,
      60
    ]

If you import code style preferences from TSLint using Apply TSLint Code Style Rules action 如果使用“ 应用TSLint代码样式规则”操作从TSLint导入代码样式首选项

在此处输入图片说明

the Hard wrap at value in Settings | 设置| 中的值的硬包装 Editor | 编辑器 Code Style | 代码样式| TypeScript | 打字稿| Wrapping and Braces will be set accordingly: 包装和花括号将进行相应的设置:

在此处输入图片说明

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

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