11import path from 'node:path'
22import { fileURLToPath } from 'node:url'
33
4- import { fixupPluginRules } from '@eslint/compat'
5- import { FlatCompat } from '@eslint/eslintrc'
64import js from '@eslint/js'
7- import typescriptEslint from '@typescript-eslint/eslint-plugin'
8- import tsParser from '@typescript-eslint/parser'
5+ import eslintConfigPrettier from 'eslint-config-prettier'
96import react from 'eslint-plugin-react'
107import reactHooks from 'eslint-plugin-react-hooks'
118import simpleImportSort from 'eslint-plugin-simple-import-sort'
9+ import globals from 'globals'
10+ import tseslint from 'typescript-eslint'
1211
1312const __filename = fileURLToPath ( import . meta. url )
1413const __dirname = path . dirname ( __filename )
15- const compat = new FlatCompat ( {
16- allConfig : js . configs . all ,
17- baseDirectory : __dirname ,
18- recommendedConfig : js . configs . recommended ,
19- } )
2014
21- export default [
15+ export default tseslint . config (
2216 {
2317 ignores : [ '**/compiled/' , '**/coverage/' , '**/dist/' , '**/node_modules/' ] ,
2418 } ,
25- ...compat . extends (
26- 'plugin:react/recommended' ,
27- 'plugin:@typescript-eslint/recommended' ,
28- 'prettier' ,
29- ) ,
19+ js . configs . recommended ,
20+ ...tseslint . configs . recommended ,
21+ react . configs . flat . recommended ,
22+ eslintConfigPrettier ,
3023 {
3124 languageOptions : {
32- ecmaVersion : 5 ,
33- parser : tsParser ,
3425 parserOptions : {
3526 ecmaFeatures : {
3627 jsx : true ,
3728 } ,
3829 project : path . join ( __dirname , 'tsconfig.eslint.json' ) ,
3930 } ,
40- sourceType : 'module' ,
4131 } ,
4232
4333 plugins : {
44- '@typescript-eslint' : typescriptEslint ,
45- react,
46- 'react-hooks' : fixupPluginRules ( reactHooks ) ,
34+ 'react-hooks' : reactHooks ,
4735 'simple-import-sort' : simpleImportSort ,
4836 } ,
4937
@@ -67,11 +55,24 @@ export default [
6755 } ,
6856 {
6957 files : [ '**/*.js' ] ,
58+ languageOptions : {
59+ globals : {
60+ ...globals . node ,
61+ } ,
62+ } ,
7063 rules : {
7164 '@typescript-eslint/explicit-module-boundary-types' : 'off' ,
7265 '@typescript-eslint/no-require-imports' : 'off' ,
7366 } ,
7467 } ,
68+ {
69+ files : [ 'examples/plain-js/**/*.js' ] ,
70+ languageOptions : {
71+ globals : {
72+ ...globals . browser ,
73+ } ,
74+ } ,
75+ } ,
7576 {
7677 files : [ 'examples/**/*' ] ,
7778 rules : {
@@ -85,4 +86,4 @@ export default [
8586 'react/prop-types' : 'off' ,
8687 } ,
8788 } ,
88- ]
89+ )
0 commit comments