Search code examples
javascripttypescriptidephpstormtslint

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?


Solution

  • 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

    enter image description here

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

    enter image description here