OMC's Blog

VSCode and TSLint Setup

July 11, 2020

TLDR;

TSLint will hopefully be deprecated next year (2021). Till then it is the best linter option for Typescript project and VSCode should work with it properly

Example TSLint Rules

{
  "extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"],
  "rules": {
    "ordered-imports": true,
    "object-literal-sort-keys": true,
    "member-ordering": true,
    "no-console": true,
    "jsx-no-lambda": true
  }
}

How to setup VSCode to format on save based on TSLint Rules

  1. Press CMD + , or click Code, Preferences and Settings
  2. Click the icon below vscode
  3. Add "tslint.autoFixOnSave": true to settings.json file

Conclusion

Your VSCode should format on save and live happily ever after with TSLint


Oguzhan Murat Cakmak, starting his software career in Istanbul and advancing through roles in San Francisco at Uber and Hims&Hers, now does remote work from Kaş, Antalya, balancing his passion for technology with interests in kitesurfing, diving, hiking, and exploring diverse content on podcasts. Follow him on Twitter and Instagram

Webmentions

00
    Loading Webmentions...