Dealing With Tslint Errors/Warnings In Third Party Files

Last updated: March 14, 2017

This might be a bit of an edge case for some, but recently I needed to use a third-party script in my Aurelia TypeScript application that wasn’t installable through Npm.

I could have carefully changed it to conform to my TSLint guidelines, but that would have been more effort than I wanted to spend. I just wanted to include the file in a vendor folder and then import it without worrying how it’s written, whether it uses single or double quotes or what indentation setting it uses.

Enter TSLint rule flags.

All you need to do is put /* tslint:disable */ at the top of your file and TSLint will ignore everything after that. You can also selectively ignore certain parts of your file by using /* tslint:disable */ and /* tslint:enable */ to turn parts of your file off and then back on.

You can use TSLint rule flags to ignore certain rules as well, for cases where the rules don’t apply.

Purchase Aurelia for Real World Applications over at Leanpub now

Liked it? Take a second to support Dwayne on Patreon!
 

Dwayne

 

One thought on “Dealing With Tslint Errors/Warnings In Third Party Files

Leave a Reply

Your email address will not be published. Required fields are marked *