@nish1896/eslint-flat-config
v4.0.0
Published
Linting rules configured for ESLint v10 and above to catch potential errors and ensure consistent code formatting.
Downloads
626
Maintainers
Keywords
Readme
@nish1896/eslint-flat-config
A modern, modular ESLint flat config for JavaScript, TypeScript, React, and Next.js.
Built for ESLint v10 with a focus on:
- Developer experience
- Readability
- Real-world usability
✨ Features
- ✅ ESLint
v10flat config support - ✅ Modular (use only what you need)
- ✅ TypeScript-aware linting
- ✅ React & accessibility support
- ✅ Works seamlessly with Next.js
- ✅ Clean, consistent stylistic rules via @stylistic
This package is compatible with eslint v10 and above (use
@nish1896/eslint-flat-config@3for ESLintv9). For usage with eslint8.57.1or below check @nish1896/eslint-config.
Requirements
| Requirement | Version |
|-|-|
| Node.js | ^20.19.0 \|\| ^22.13.0 \|\| >=24 |
| eslint | >=10 |
| typescript (only for the ts / next-ts modules) | >=4.8.4 <6.1.0 |
typescript-eslintdoes not support TypeScript 7 yet. Some starters, such as thecreate-viteReact + TypeScript template, shiptypescript ~7. Pintypescriptto~6.0untiltypescript-eslintadds support.
Installation
npm i -D eslint @nish1896/eslint-flat-configpnpm add -D eslint @nish1896/eslint-flat-configyarn add -D eslint @nish1896/eslint-flat-configQuick Setup
Copy the code snippet most relevant to your application and paste it in the eslint.config.mjs file in your project root.
Use the ts module only if your code is written in Typescript.
Node.js
import jsConfig from '@nish1896/eslint-flat-config/js';
import tsConfig from '@nish1896/eslint-flat-config/ts';
export default [
...jsConfig,
...tsConfig
];React.js & Vite
Use the ts module only if your code is written in Typescript.
The newer
create-vitetemplates use Oxlint by default. Oxlint does not readeslint.config.mjs. Choose the ESLint option when scaffolding, or installeslintyourself, to use this config.
import jsConfig from '@nish1896/eslint-flat-config/js';
import tsConfig from '@nish1896/eslint-flat-config/ts';
import jsxConfig from '@nish1896/eslint-flat-config/jsx';
export default [
...jsConfig,
...tsConfig,
...jsxConfig,
];Next.js
Update the existing eslint.config.mjs file provided by your Next.js 16 app. Include eslint-config-next/typescript and the next-ts module only if your code is written in Typescript.
import { defineConfig, globalIgnores } from 'eslint/config';
import nextVitals from 'eslint-config-next/core-web-vitals';
import nextTs from 'eslint-config-next/typescript';
import jsConfig from '@nish1896/eslint-flat-config/js';
import nextConfig from '@nish1896/eslint-flat-config/next';
import nextTsConfig from '@nish1896/eslint-flat-config/next-ts';
const eslintConfig = defineConfig([
...nextVitals,
...nextTs,
...jsConfig,
...nextConfig,
...nextTsConfig,
globalIgnores([
'.next/**',
'out/**',
'build/**',
'next-env.d.ts'
])
]);
export default eslintConfig;⚠️ Important Notes
- Do NOT use
jsxConfigwithnextConfig - Next.js 15 and
eslint-config-next@15only support ESLint 9 and below, so use@nish1896/eslint-flat-config@3there - This config complements Next.js ESLint — it does not replace it
- TypeScript configs require a valid tsconfig.json
For comprehensive details on installation, setup, rules, and usage, please refer the Documentation 📖.
If you're a React developer looking to build forms and Material UI interfaces faster, check out my open-source packages: @nish1896/mui-components and @nish1896/rhf-mui-components.
