0Pricing
TypeScript Academy · Lesson

Building a Simple Linting Tool

Create a custom diagnostic tool using the compiler API.

What Is a Linting Tool?

A linting tool analyzes source code to report style or correctness issues. Using the TypeScript compiler API lets you build type-aware rules that ESLint plugins cannot achieve alone.

// Goal: warn when console.log is called in TypeScript files

Project Setup

Create a Node.js script that loads a TypeScript program, traverses the AST, and reports diagnostics.

import ts from "typescript";
import path from "path";

const files = ["src/index.ts"];
const program = ts.createProgram(files, { strict: true });

All lessons in this course

  1. Creating a TypeScript Program with the API
  2. Traversing the AST with Visitors
  3. Custom Transformers and Code Generation
  4. Building a Simple Linting Tool
← Back to TypeScript Academy