Answer a few questions about your project and get a modern flat eslint.config.js for ESLint 9, plus the exact packages to install. It covers JavaScript and TypeScript (including type-aware linting), React with Hooks and accessibility rules, Node.js, test globals and Prettier.
Last updated:
Quick start:
eslint.config.js
1. Install
2. Add scripts to package.json
3. Run
Advertisement
Advertisement
How to use the ESLint Config Generator
Pick a quick-start preset such as React + TypeScript or Node.js, or set the options yourself.
Choose the language and framework: TypeScript adds typescript-eslint, React adds the React, Hooks and optional accessibility plugins.
Select the environment (browser, Node.js, test globals) and whether your files use ES modules or CommonJS.
Toggle extra rules and Prettier compatibility, and list folders to ignore.
Copy the config and the install command, save the file in your project root and run npx eslint ..
Which packages does each option add?
Option
Package
What it adds to the config
Always
eslint, @eslint/js, globals
js.configs.recommended and environment globals
TypeScript
typescript-eslint, typescript
Parser, plugin and the recommended or strict rule set
React
eslint-plugin-react
react.configs.flat.recommended and the jsx-runtime config for React 17+
Rules of Hooks
eslint-plugin-react-hooks
rules-of-hooks (error) and exhaustive-deps (warning)
Accessibility
eslint-plugin-jsx-a11y
Checks for alt text, labels, valid ARIA and keyboard support in JSX
Flat config is the configuration format introduced in ESLint 8.21 and made the default in ESLint 9. Instead of .eslintrc files with extends strings, you export an array of config objects from eslint.config.js and import plugins and shared configs directly as JavaScript modules.
Should my file be eslint.config.js or eslint.config.mjs?
Use eslint.config.js when your package.json has "type": "module", because the file uses import and export. In a CommonJS project either name it eslint.config.mjs, which is always treated as an ES module, or choose eslint.config.cjs to use require and module.exports.
What does defineConfig do?
defineConfig() from eslint/config (ESLint 9.22 and newer) adds type checking and accepts nested arrays, so shared configs like tseslint.configs.recommended can be listed without the spread operator. globalIgnores() makes it explicit that the patterns apply to the whole project. Untick the option to get a plain exported array for older ESLint 9 releases.
What is type-aware linting?
typescript-eslint can use the TypeScript compiler's type information to power rules such as no-floating-promises and no-misused-promises. It needs a tsconfig.json and makes linting slower. The generated config enables projectService and turns type-aware rules off for plain .js files.
How do I use ESLint together with Prettier?
Let Prettier handle formatting and ESLint handle code quality. Tick the Prettier option to add eslint-config-prettier as the last item, which turns off every ESLint rule that could conflict with Prettier's output. Run Prettier separately or in your editor on save.
Where did .eslintignore go?
Flat config does not read .eslintignore. Put ignored paths in the config instead, as an object with only an ignores key or with globalIgnores(). node_modules and .git are ignored automatically.
Is anything uploaded?
No. The configuration is generated in your browser, and your choices are remembered only in this browser's local storage.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.