Airbnb ESLint Config for TypeScript

18.0.0 · active · verified Sun Apr 19

eslint-config-airbnb-typescript extends the popular Airbnb ESLint configuration to provide full support for TypeScript projects. It ensures consistent code style and identifies potential issues across JavaScript and TypeScript files. Currently stable at version 18.0.0, this configuration typically updates in lockstep with major releases of `@typescript-eslint/eslint-plugin`, `@typescript-eslint/parser`, and `eslint`, as well as updates to `eslint-config-airbnb` or `eslint-config-airbnb-base`. The project has a moderately active release cadence, issuing updates to align with its core dependencies and address bug fixes. Its key differentiator is providing a TypeScript-compatible wrapper around the widely adopted and opinionated Airbnb style guide, making it a go-to choice for teams wanting to enforce a strict, well-defined coding standard in their TypeScript codebase. It requires manual peer dependency installation, a common pattern for shareable ESLint configurations.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to install the package and its peer dependencies, configure your `.eslintrc` file to extend the Airbnb TypeScript rules (with React support), and set up the `parserOptions.project` for type-aware linting.

npm install --save-dev eslint-config-airbnb-typescript \
            @typescript-eslint/eslint-plugin@^7.0.0 \
            @typescript-eslint/parser@^7.0.0 \
            eslint@^8.56.0 \
            eslint-config-airbnb # or eslint-config-airbnb-base

// .eslintrc.cjs (or .js)
module.exports = {
  extends: [
    'airbnb', // or 'airbnb-base' if no React
    'airbnb-typescript'
  ],
  parserOptions: {
    project: './tsconfig.json' // Path to your TypeScript config
  },
  root: true,
  env: {
    node: true,
    browser: true,
    es2021: true
  }
};

// tsconfig.json
{
  "compilerOptions": {
    "target": "es2021",
    "module": "esnext",
    "lib": ["dom", "es2021"],
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    // ... other compiler options
  },
  "include": ["src/**/*", ".eslintrc.cjs"]
}

// package.json script for linting
// "lint": "eslint . --ext .js,.jsx,.ts,.tsx"

view raw JSON →