Sam
Sam

Reputation: 1314

Can I control which rules 'tslint --fix' auto fixes?

Is it possible to control which rules are auto-fixed when running tslint --fix? Ideally, I only want to autofix the whitespace and quotation rules, and I'll evaluate the rest manually. I can't seem to find anything in the documentation telling me which rules auto fix, or how to control which rules to apply though, and I'm a bit apprehensive about blindly fixing everything.

I'm currently using the tslint file that's autogenerated by Angular CLI.

Upvotes: 7

Views: 3005

Answers (2)

Pac0
Pac0

Reputation: 23174

As already said, you can use you own tslint.json, with your custom rules.

For the "evaluation" part of your problem, I suggest simply using your source-control. For instance, it's easy with Git to validate / discard changes by files, or even by lines / chunk.

Upvotes: 0

Matt McCutchen
Matt McCutchen

Reputation: 30929

You could always run tslint --fix using a separate tslint.json file that contains only the rules you want to fix. I believe the rules that auto-fix are the ones marked "Has Fixer" in the list.

Upvotes: 9

Related Questions