logoESLint React
Getting Started

TypeScript with alternative parser

Getting started with TypeScript + TS Blank ESLint Parser setup

The ts-blank-eslint-parser is a work in progress and not support rules that require type information or TypeScript syntax that need transformation like enums, namespaces, decorators. Use it with caution.
When using this approach, the auto-fix may not work properly, it is recommended to use https://github.com/chiefmikey/eslint-plugin-disable-autofix to disable any problematic auto-fix without turning off the rule.

Install

Terminal
# npm
npm install --save-dev eslint ts-blank-eslint-parser @eslint-react/eslint-plugin
 
# pnpm
pnpm add --save-dev eslint ts-blank-eslint-parser @eslint-react/eslint-plugin
 
# yarn
yarn add --dev eslint ts-blank-eslint-parser @eslint-react/eslint-plugin

Setup

eslint.config.js
 
// @ts-check
import eslintJs from "@eslint/js";
import eslintReact from "@eslint-react/eslint-plugin";
import tsBlankEslintParser from "ts-blank-eslint-parser";
 
export default tseslint.config({
  files: ["**/*.ts", "**/*.tsx"],
  extends: [
    eslintJs.configs.recommended,
    eslintReact.configs.recommended,
  ],
  languageOptions: {
    parser: tsBlankEslintParser,
  },
});

Setup with Fallback Parsers

Add typescript-eslint to the project dependencies

Terminal
# npm
npm install --save-dev typescript-eslint
 
# pnpm
pnpm add --save-dev typescript-eslint
 
# yarn
yarn add --dev typescript-eslint

Update the eslint.config.js file

eslint.config.js
 
// @ts-check
import eslintJs from "@eslint/js";
import eslintReact from "@eslint-react/eslint-plugin";
import tsBlankEslintParser from "ts-blank-eslint-parser";
import tseslint from "typescript-eslint";
 
export default tseslint.config({
  files: ["**/*.ts", "**/*.tsx"],
  extends: [
    eslintJs.configs.recommended,
    eslintReact.configs.recommended,
  ],
  languageOptions: {
    parser: tsBlankEslintParser,
    parserOptions: {
      // Fallback to `@typescript-eslint/parser` when `ts-blank-eslint-parser` fails
      fallbackParsers: [
        {
          parser: tseslint.parser,
          parserOptions: {
            projectService: true,
          },
        },
      ],
    },
  },
});

On this page