Building Custom TSLint Rules

Building Custom TSLint Rules

0ebf471a3ae8df42a84f93a7efbbdbd0?s=128

Ash Furrow

October 30, 2018
Tweet

Transcript

  1. 2.

    whoami - Hi I’m Ash - Artsy - Canadian -

    Recovering iOS developer - Photography - Guitar - Likes type systems - Really likes developer tooling
  2. 3.
  3. 4.
  4. 5.

    TSLint - Checks (“lints”) your code for problems - There

    are a bunch of built-in rules - Line length - Alphabetically ordered imports - Variable name consistency - Prevent unnecessary type assertions - etc - And you can build your own!
  5. 6.

    Custom TSLint Rules - Rules are just code - Rules

    provide details of what’s wrong - Optionally, rules can fix the code automatically ✨ - Two types of rules: - String-based rules - AST-based rules - So what’s an AST?
  6. 7.

    Abstract Syntax Trees - Compiler data type - Machine-readable representation

    of your code if (user.isAdmin) { return "Hello, Admin." } else { return "401 lol" } if user.isAdmin return return "Hello, Admin" "401 lol"