InvGhostt
InvGhostt

Reputation: 43

Is it possible to enforce prettier style as tslint rule?

As we can have command line lint tools that show if a code is linked, is there something else for prettier, maybe it can integrate with tslint and tslint could show errors if the code is not formatted?

Upvotes: 0

Views: 221

Answers (2)

WayneC
WayneC

Reputation: 5740

There is tslint-plugin-prettier which will report prettier differences as tslint issues.

as mentioned in the readme you should also use tslint-config-prettier to avoid conflicts between prettier rules and tslint rules.

Upvotes: 2

matt helliwell
matt helliwell

Reputation: 2678

You can use the various TS Lint formatting rules, eg https://palantir.github.io/tslint/rules/indent/, so if the code isn't formatted you'll get a warning. Once you've worked out your set of rules you need, it should give you warnings.

Alternatively, why not just add commit hooks to format the code before it is pushed?

Upvotes: 0

Related Questions