Created
October 29, 2024 21:46
-
-
Save ixahmedxi/a2ef874b9cb9a612837e70403da611c0 to your computer and use it in GitHub Desktop.
Next.js 15 ESLint v9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable import-x/no-named-as-default-member */ | |
import comments from '@eslint-community/eslint-plugin-eslint-comments/configs' | |
import react from '@eslint-react/eslint-plugin' | |
import { FlatCompat } from '@eslint/eslintrc' | |
import js from '@eslint/js' | |
import prettierConfig from 'eslint-config-prettier' | |
import eslintPluginImportX from 'eslint-plugin-import-x' | |
import regexPlugin from 'eslint-plugin-regexp' | |
import security from 'eslint-plugin-security' | |
import globals from 'globals' | |
import tseslint from 'typescript-eslint' | |
import tailwind from 'eslint-plugin-tailwindcss' | |
const compat = new FlatCompat({ | |
baseDirectory: import.meta.dirname, | |
}) | |
const config = tseslint.config( | |
{ | |
ignores: ['.next', 'node_modules'], | |
}, | |
// Base | |
js.configs.recommended, | |
...tseslint.configs.strictTypeChecked, | |
...tseslint.configs.stylisticTypeChecked, | |
eslintPluginImportX.flatConfigs.recommended, | |
eslintPluginImportX.flatConfigs.typescript, | |
comments.recommended, | |
regexPlugin.configs['flat/recommended'], | |
security.configs.recommended, | |
// Next.js / React | |
...compat.extends('plugin:@next/next/recommended'), | |
...compat.extends('plugin:react-hooks/recommended'), | |
...compat.plugins('react-compiler'), | |
react.configs['recommended-type-checked'], | |
// Tailwind | |
...tailwind.configs['flat/recommended'], | |
{ | |
linterOptions: { | |
reportUnusedDisableDirectives: true, | |
}, | |
languageOptions: { | |
ecmaVersion: 'latest', | |
sourceType: 'module', | |
parserOptions: { | |
projectService: true, | |
tsconfigRootDir: import.meta.dirname, | |
ecmaFeatures: { | |
jsx: true, | |
}, | |
}, | |
globals: { | |
...globals.browser, | |
...globals.node, | |
}, | |
}, | |
settings: { | |
tailwindcss: { | |
callees: ['classnames', 'clsx', 'ctl', 'cn', 'cva'], | |
}, | |
}, | |
rules: { | |
'@typescript-eslint/no-unused-vars': [ | |
'error', | |
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' }, | |
], | |
'@typescript-eslint/consistent-type-imports': [ | |
'warn', | |
{ prefer: 'type-imports', fixStyle: 'separate-type-imports' }, | |
], | |
'@typescript-eslint/no-misused-promises': [ | |
'error', | |
{ checksVoidReturn: { attributes: false } }, | |
], | |
'@typescript-eslint/no-unnecessary-condition': [ | |
'error', | |
{ | |
allowConstantLoopConditions: true, | |
}, | |
], | |
'@typescript-eslint/consistent-type-exports': [ | |
'error', | |
{ fixMixedExportsWithInlineTypeSpecifier: true }, | |
], | |
'import-x/no-unresolved': ['error', { ignore: ['geist'] }], | |
'react-compiler/react-compiler': 'error', | |
}, | |
}, | |
{ | |
files: ['**/*.cjs', '**/*.cts'], | |
languageOptions: { | |
sourceType: 'commonjs', | |
}, | |
}, | |
prettierConfig, | |
) | |
export default config | |
/* eslint-enable import-x/no-named-as-default-member */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module '@eslint-community/eslint-plugin-eslint-comments/configs' { | |
import type { Linter } from 'eslint' | |
export const recommended: { | |
rules: Linter.RulesRecord | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"devDependencies": { | |
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1", | |
"@eslint-react/eslint-plugin": "^1.15.2", | |
"@eslint/eslintrc": "^3.1.0", | |
"@eslint/js": "^9.13.0", | |
"@next/eslint-plugin-next": "^15.0.2", | |
"@types/eslint-config-prettier": "^6.11.3", | |
"@types/eslint-plugin-security": "^3.0.0", | |
"@types/eslint-plugin-tailwindcss": "^3.17.0", | |
"@types/eslint__eslintrc": "^2.1.2", | |
"@types/eslint__js": "^8.42.3", | |
"eslint": "^9.13.0", | |
"eslint-config-prettier": "^9.1.0", | |
"eslint-import-resolver-typescript": "^3.6.3", | |
"eslint-plugin-import-x": "^4.3.1", | |
"eslint-plugin-react-compiler": "19.0.0-beta-6fc168f-20241025", | |
"eslint-plugin-react-hooks": "^5.0.0", | |
"eslint-plugin-regexp": "^2.6.0", | |
"eslint-plugin-security": "^3.0.1", | |
"eslint-plugin-tailwindcss": "^3.17.5", | |
"globals": "^15.11.0", | |
"typescript": "^5.6.3", | |
"typescript-eslint": "^8.12.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment