logoESLint React
Getting Started

TypeScript

Getting started with TypeScript setup

This setup requires the following minimum versions:

  • node@18.18.0
  • eslint@8.57.0
  • typescript@4.9.5

Install

npm install --save-dev typescript-eslint @eslint-react/eslint-plugin

Setup

eslint.config.js
// @ts-check
import eslintJs from "@eslint/js";
import eslintReact from "@eslint-react/eslint-plugin";
import tseslint from "typescript-eslint";
 
export default tseslint.config({
  files: ["**/*.ts", "**/*.tsx"],
  extends: [
    eslintJs.configs.recommended,
    tseslint.configs.recommended,
    eslintReact.configs["recommended-typescript"],
  ],
  languageOptions: {
    parser: tseslint.parser,
    parserOptions: {
      projectService: true,
    },
  },
  rules: {
    // Put rules you want to override here
    "@eslint-react/prefer-shorthand-boolean": "warn",
  },
});

On this page