Since ESLint 9.9.0, it's now possible to use the (experimental) eslint.config.ts format:
- https://eslint.org/blog/2024/08/eslint-v9.9.0-released/#experimental-typescript-configuration-files
TypeScript ESlint
typescript-eslint.io › getting-started
Getting Started | typescript-eslint
This page is a quick-start for ESLint's new "flat" config format to go from zero to linting with our recommended rules on your TypeScript code as quickly as possible.
TypeScript ESlint
typescript-eslint.io › packages › typescript-eslint
typescript-eslint | typescript-eslint
Below is a more complex example of how you might use our tooling with flat configs. This config: ... // @ts-check import eslint from '@eslint/js'; import { defineConfig } from 'eslint/config'; import jestPlugin from 'eslint-plugin-jest'; import tseslint from 'typescript-eslint'; export default defineConfig( { // config with just ignores is the replacement for `.eslintignore` ignores: ['**/build/**', '**/dist/**', 'src/some/file/to/ignore.ts'], }, eslint.configs.recommended, { plugins: { '@typescript-eslint': tseslint.plugin, jest: jestPlugin, }, languageOptions: { parser: tseslint.parser, parserOptions: { projectService: true, }, }, rules: { '@typescript-eslint/no-floating-promises': 'error', // ...
Videos
Top answer 1 of 5
34
I am using ESLint's flat-config using flat config with TypeScript. Here's what I think are the important parts of the config:
import ts from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import functional from 'eslint-plugin-functional';
import imprt from 'eslint-plugin-import'; // 'import' is ambiguous & prettier has trouble
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaFeatures: {
modules: true
},
ecmaVersion: 'latest',
project: './tsconfig.json',
},
},
plugins: {
functional,
import: imprt,
'@typescript-eslint': ts,
ts,
},
rules: {
...ts.configs['eslint-recommended'].rules,
...ts.configs['recommended'].rules,
'ts/return-await': 2,
}
Take note that the ts plugin is there twice. The shared configs use the longer namespace, and I perfer using a shorter namespace.
2 of 5
13
This works for me but I still find the API to be rather verbose.
const tsPlugin = require("@typescript-eslint/eslint-plugin");
const tsParser = require("@typescript-eslint/parser");
const tsOverrideConfig = tsPlugin.configs["eslint-recommended"].overrides[0];
const tsRecommemdedConfig = tsPlugin.configs.recommended;
const files = ["**/*.ts", "**/*.tsx"];
module.exports = [
"eslint:recommended",
{
files,
linterOptions: {
reportUnusedDisableDirectives: true,
},
languageOptions: {
parser: tsParser,
},
plugins: {
"@typescript-eslint": tsPlugin,
},
},
{ files, rules: tsOverrideConfig.rules },
{ files, rules: tsRecommemdedConfig.rules },
];
ESLint
eslint.org › docs › latest › use › configure › migration-guide
Configuration Migration Guide - ESLint - Pluggable JavaScript Linter
(Flat config files act as if root: true is set.) The files option cannot be a single string anymore, it must be an array. The sourceType option now supports the new value "commonjs" (.eslintrc supports it too, but it was never documented). You can see the TypeScript types for the flat config file format in the lib/types source folder on GitHub.
GitHub
github.com › typescript-eslint › typescript-eslint › issues › 7694
ESLint Flat Config Support · Issue #7694 · typescript-eslint/typescript-eslint
June 19, 2023 - Edit: typescript-eslint@>=v7 supports ESLint flat config! See: https://typescript-eslint.io/blog/announcing-typescript-eslint-v7 Overview ESLint is adding an exciting new config system called "flat" configs: Configuration files docs: htt...
Author JoshuaKGoldberg
Advancedfrontends
advancedfrontends.com › eslint-flat-config-typescript-javascript
Modern Linting in 2025: ESLint Flat Config with TypeScript and JavaScript - Advanced Frontends.com
April 9, 2025 - The new flat config eliminates legacy concepts like "extends" chains and config merging, replacing them with a single JavaScript file (eslint.config.js) that gives you full control over: ... The following will demonstrate how to use rulesets for Typescript independently of JavaScript and apply plugins and sharable configs.
DEV Community
dev.to › psychosynthesis › new-eslint-flat-config-file-format-example-217c
New ESLint flat config file format example - DEV Community
April 12, 2024 - import path from "path"; import { fileURLToPath } from "url"; import { FlatCompat } from "@eslint/eslintrc"; import pluginJs from "@eslint/js"; // mimic CommonJS variables -- not needed if using CommonJS const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const compat = new FlatCompat({ baseDirectory: __dirname, recommendedConfig: pluginJs.configs.recommended }); export default [ ...compat.extends("standard-with-typescript") ];
TypeScript ESlint
typescript-eslint.io › users › configs
Shared Configs | typescript-eslint
If a majority of developers working on your project are comfortable with TypeScript and typescript-eslint, consider replacing recommended with strict. If your project enables typed linting, we suggest enabling the recommended-type-checked and stylistic-type-checked configurations to start: note · To use type-checking, you also need to configure languageOptions.parserOptions as shown in typed linting docs. Flat Config ·
GitHub
github.com › vercel › next.js › discussions › 49337
How to use new "flat config" approach in Eslint? · vercel/next.js · Discussion #49337
I did the exact same thing but ran into this error: ConfigError: Config (unnamed): Key "extends": This appears to be in eslintrc format rather than flat config format. ... import eslintPluginNext from "@next/eslint-plugin-next"; import tseslint from "typescript-eslint"; import eslintPluginReactHooks from "eslint-plugin-react-hooks"; import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"; const eslintConfig = [ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access eslintPluginNext.flatConfig.recommended, // eslint-disable-next-line @typescript-eslint/n
Author vercel
GitHub
gist.github.com › x7ddf74479jn5 › 1cf36b185950ce088130d60426cb4e2e
ESLint Flat Configメモ · GitHub
import { FlatCompat } from "@eslint/eslintrc" const compat = new FlatCompat(); export default [{ ...compat.extends("plugin:@typescript-eslint/recommended"), rules: { "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-var-requires": "off", } }]; ... import typescriptEslint from "@typescript-eslint/eslint-plugin"; export default [ { plugins: { "@typescript-eslint": typescriptEslint, }, rules: { ...typescriptEslint.configs["eslint-recommended"].rules, ...typescriptEslint.configs["recommended"].rules, ...typescriptEslint.configs["recommended-requiring-type-checking"].rules, }, }, ];
Chris
chris.lu › web_development › tutorials › next-js-static-first-mdx-starterkit › typescript-eslint-flat-config
Typescript Linting and custom flat config - Next.js 15 Tutorial
Line 31: first we specify that the name for custom flat config will be tseslintConfig · Line 32: We use the files option to tell ESLint which files (extensions) we want to include (for this tutorial we will enable linting for ES Module (esm) files (.mjs), for regular Typescript (.ts) and also for Typescript & JSX files (.tsx))
GitHub
github.com › typescript-eslint › typescript-eslint › issues › 5938
Docs: new eslint.config.js - adapt all existing content to new flat config · Issue #5938 · typescript-eslint/typescript-eslint
February 14, 2022 - On this occasion, it would be nice to supplement the Custom rules > Testing section because there's no more defineParser(), and people might want few examples how to set up let linter = new Linter({ configType: "flat" }); linter.verifyAndFix(str, [ ... and how to test the plugin works on esprima and @typescript-eslint/parser.
Published Nov 08, 2022
GitHub
github.com › eslint › eslint › discussions › 18303
Migrating from JSON to flat config · eslint/eslint · Discussion #18303
I find the new flat config syntax verbose and cryptic. I have posted a question on StackOverflow but I feel I need to ask here as well. I have a monorepo project that has this as my base config for ESlint 8.57.0 · { "root": true, "plugins": ["@typescript-eslint", "deprecation", "simple-import-sort", "prettier", "only-warn"], "reportUnusedDisableDirectives": true, "overrides": [ { "files": ["*.ts"], "extends": [ "eslint:recommended", "plugin:@typescript-eslint/strict-type-checked", "plugin:@typescript-eslint/stylistic-type-checked", "plugin:deprecation/recommended", "plugin:eslint-comments/recommended", "plugin:prettier/recommended" ], "rules": { //specific rules go here } }, { "files": ["*.spec.ts"], "extends": [], "rules": { //Less strict in test files - disable a few here //etc.
Author eslint