This commit is contained in:
@@ -1,39 +1,37 @@
|
||||
// @ts-check
|
||||
import { FlatCompat } from '@eslint/eslintrc';
|
||||
import { defineConfig, globalIgnores } from 'eslint/config';
|
||||
import nextVitals from 'eslint-config-next/core-web-vitals';
|
||||
import nextTs from 'eslint-config-next/typescript';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: import.meta.dirname,
|
||||
});
|
||||
|
||||
export default [
|
||||
// Global ignores
|
||||
{
|
||||
ignores: [
|
||||
'node_modules/**',
|
||||
'.next/**',
|
||||
'out/**',
|
||||
'build/**',
|
||||
'next-env.d.ts',
|
||||
'*.mjs',
|
||||
'tailwind.config.ts',
|
||||
],
|
||||
},
|
||||
|
||||
// 1. Next.js core rules (includes react, react-hooks, and next)
|
||||
...compat.extends('next/core-web-vitals', 'prettier'),
|
||||
|
||||
// 2. Your strict, type-aware TypeScript rules
|
||||
const eslintConfig = defineConfig([
|
||||
// Next.js core-web-vitals and TypeScript configs
|
||||
...nextVitals,
|
||||
...nextTs,
|
||||
// Add strict TypeScript rules on top
|
||||
...tseslint.configs.strictTypeChecked,
|
||||
...tseslint.configs.stylisticTypeChecked,
|
||||
|
||||
// 3. Configuration for type-aware rules
|
||||
// Configure TypeScript parser options
|
||||
{
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: true,
|
||||
projectService: true,
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
// Override default ignores of eslint-config-next
|
||||
globalIgnores([
|
||||
// Default ignores of eslint-config-next:
|
||||
'.next/**',
|
||||
'out/**',
|
||||
'build/**',
|
||||
'next-env.d.ts',
|
||||
// Additional ignores:
|
||||
'*.mjs',
|
||||
'tailwind.config.ts',
|
||||
]),
|
||||
]);
|
||||
|
||||
export default eslintConfig;
|
||||
|
||||
Reference in New Issue
Block a user