1- import { defineConfig , globalIgnores } from 'eslint/config' ;
1+ import js from '@eslint/js' ;
2+ import tsParser from '@typescript-eslint/parser' ;
3+ import tsPlugin from '@typescript-eslint/eslint-plugin' ;
24import nx from '@nx/eslint-plugin' ;
35import globals from 'globals' ;
4- import tsParser from '@typescript-eslint/parser' ;
5- import path from 'node:path' ;
6- import { fileURLToPath } from 'node:url' ;
7- import js from '@eslint/js' ;
8- import { FlatCompat } from '@eslint/eslintrc' ;
9-
10- const __filename = fileURLToPath ( import . meta. url ) ;
11- const __dirname = path . dirname ( __filename ) ;
12- const compat = new FlatCompat ( {
13- baseDirectory : __dirname ,
14- recommendedConfig : js . configs . recommended ,
15- allConfig : js . configs . all ,
16- } ) ;
6+ import jsxA11yPlugin from 'eslint-plugin-jsx-a11y' ;
7+ import reactPlugin from 'eslint-plugin-react' ;
8+ import reactHooksPlugin from 'eslint-plugin-react-hooks' ;
9+ import nextPlugin from '@next/eslint-plugin-next' ;
10+ import prettierPlugin from 'eslint-plugin-prettier' ;
1711
18- export default defineConfig ( [
19- globalIgnores ( [
20- '**/node_modules' ,
21- '**/next' ,
22- '**/.next' ,
23- '**/**.config.js' ,
24- '**/**.config.mjs' ,
25- '**/jest.config.ts' ,
26- '**/**.spec.ts' ,
27- '**/**.d.ts' ,
28- '**/**.spec.tsx' ,
29- ] ) ,
12+ export default [
3013 {
31- extends : compat . extends ( 'eslint:recommended' , 'prettier' , 'next' ) ,
32-
33- plugins : {
34- '@nx' : nx ,
35- } ,
36-
14+ ignores : [
15+ '**/node_modules' ,
16+ '**/next' ,
17+ '**/.next' ,
18+ '**/next-env.d.ts' ,
19+ '**/**.config.js' ,
20+ '**/**.config.mjs' ,
21+ '**/jest.config.ts' ,
22+ '**/**.spec.ts' ,
23+ '**/**.spec.tsx' ,
24+ ] ,
25+ } ,
26+ {
27+ files : [ '**/*.{ts,tsx,js,jsx}' ] ,
3728 languageOptions : {
38- globals : {
39- ...globals . node ,
40- } ,
41-
4229 parser : tsParser ,
4330 ecmaVersion : 5 ,
4431 sourceType : 'commonjs' ,
45-
4632 parserOptions : {
4733 project : [ 'tsconfig.*?.json' ] ,
4834 } ,
35+ globals : {
36+ ...globals . browser ,
37+ ...globals . node ,
38+ globalThis : 'readonly' ,
39+ NodeJS : 'readonly' ,
40+ } ,
41+ } ,
42+ plugins : {
43+ '@nx' : nx ,
44+ react : reactPlugin ,
45+ prettier : prettierPlugin ,
46+ '@typescript-eslint' : tsPlugin ,
47+ 'react-hooks' : reactHooksPlugin ,
48+ 'jsx-a11y' : jsxA11yPlugin ,
49+ '@next/next' : nextPlugin ,
4950 } ,
50- } ,
51- {
52- files : [ '**/*.ts' , '**/*.tsx' , '**/*.js' , '**/*.jsx' ] ,
5351 rules : {
52+ ...js . configs . recommended . rules ,
53+ ...tsPlugin . configs . recommended . rules ,
54+ ...nextPlugin . configs . recommended . rules ,
55+ ...prettierPlugin . configs . recommended . rules ,
5456 '@next/next/no-html-link-for-pages' : 'off' ,
57+ 'no-redeclare' : 'off' ,
5558 '@typescript-eslint/triple-slash-reference' : 'off' ,
5659 '@nx/enforce-module-boundaries' : [
5760 'error' ,
@@ -68,16 +71,9 @@ export default defineConfig([
6871 ] ,
6972 } ,
7073 ] ,
71-
74+ 'no-console' : [ 'error' , { allow : [ 'warn' , 'error' , 'info' ] } ] ,
7275 'no-empty' : 'error' ,
7376
74- 'no-console' : [
75- 'error' ,
76- {
77- allow : [ 'warn' , 'error' , 'info' ] ,
78- } ,
79- ] ,
80-
8177 'no-constant-condition' : 'error' ,
8278
8379 'no-multiple-empty-lines' : [
@@ -87,19 +83,6 @@ export default defineConfig([
8783 maxBOF : 0 ,
8884 } ,
8985 ] ,
90- } ,
91- } ,
92- {
93- files : [ '**/*.ts' , '**/*.tsx' ] ,
94-
95- extends : compat . extends (
96- 'plugin:@nx/typescript' ,
97- 'plugin:@typescript-eslint/recommended' ,
98- 'plugin:@typescript-eslint/stylistic' ,
99- 'plugin:prettier/recommended' ,
100- ) ,
101-
102- rules : {
10386 '@typescript-eslint/no-unused-vars' : [
10487 'error' ,
10588 {
@@ -110,11 +93,14 @@ export default defineConfig([
11093
11194 '@typescript-eslint/no-explicit-any' : 'warn' ,
11295 'prettier/prettier' : 'error' ,
96+
97+ 'no-multiple-empty-lines' : [
98+ 'warn' ,
99+ {
100+ max : 1 ,
101+ maxBOF : 0 ,
102+ } ,
103+ ] ,
113104 } ,
114105 } ,
115- {
116- files : [ '**/*.js' , '**/*.jsx' ] ,
117- extends : compat . extends ( 'plugin:@nx/javascript' ) ,
118- rules : { } ,
119- } ,
120- ] ) ;
106+ ] ;
0 commit comments