简体   繁体   中英

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. 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. And we don't all use PhpStorm either.

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?

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. Am I missing something?

The TSLint max-line-length rule supports setting the limit in tslint.json , like:

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

If you import code style preferences from TSLint using Apply TSLint Code Style Rules action

在此处输入图片说明

the Hard wrap at value in Settings | Editor | Code Style | TypeScript | Wrapping and Braces will be set accordingly:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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