1+ // @ts -check
2+
3+ import react from "@eslint-react/eslint-plugin" ;
14import js from "@eslint/js" ;
2- import tseslint from "typescript-eslint" ;
35import next from "@next/eslint-plugin-next" ;
4- import react from "@eslint-react/eslint-plugin" ;
56import reactHooks from "eslint-plugin-react-hooks" ;
7+ import reactRefresh from "eslint-plugin-react-refresh" ;
8+ import tseslint from "typescript-eslint" ;
69import gitignore from "eslint-config-flat-gitignore" ;
710
8- const GLOB_TS = [ "**/*.{ts,tsx}" ] ;
9- const GLOB_JS = [ "**/*.{js,cjs,mjs}" ] ;
11+ import TSCONFIG from "./tsconfig.json" with { type : "json" } ;
12+
13+ const GLOB_TS = [ "**/*.ts" , "**/*.tsx" ] ;
14+ const GLOB_JS = [ "**/*.js" , "**/*.jsx" ] ;
1015const GLOB_APP = [ "app/**/*.{js,ts,jsx,tsx}" ] ;
11- const GLOB_CONFIG = [ "**/*.config.{js,mjs,cjs, ts,tsx}" ] ;
16+ const GLOB_CONFIG = [ "**/*.config.{js,mjs,ts,tsx}" ] ;
1217
1318export default tseslint . config (
1419 js . configs . recommended ,
1520 {
1621 files : GLOB_TS ,
22+ extends : [
23+ tseslint . configs . recommended ,
24+ ] ,
25+ } ,
26+ {
27+ files : TSCONFIG . include ,
1728 extends : [
1829 tseslint . configs . recommendedTypeChecked ,
1930 ] ,
@@ -26,18 +37,29 @@ export default tseslint.config(
2637 } ,
2738 } ,
2839 {
29- files : GLOB_TS ,
30- ...react . configs . recommended ,
40+ files : TSCONFIG . include ,
41+ ...react . configs [ " recommended-type-checked" ] ,
3142 } ,
3243 {
33- files : GLOB_TS ,
44+ files : TSCONFIG . include ,
3445 plugins : {
46+ // @ts -expect-error - Missing types
3547 "react-hooks" : reactHooks ,
3648 } ,
49+ // @ts -ignore - Missing types
3750 rules : reactHooks . configs . recommended . rules ,
3851 } ,
3952 {
40- files : GLOB_TS ,
53+ files : TSCONFIG . include ,
54+ plugins : {
55+ "react-refresh" : reactRefresh ,
56+ } ,
57+ rules : {
58+ "react-refresh/only-export-components" : "warn" ,
59+ } ,
60+ } ,
61+ {
62+ files : TSCONFIG . include ,
4163 plugins : {
4264 "@next/next" : next ,
4365 } ,
@@ -54,11 +76,10 @@ export default tseslint.config(
5476 } ,
5577 {
5678 files : [ ...GLOB_JS , ...GLOB_CONFIG ] ,
57- extends : [
58- tseslint . configs . disableTypeChecked ,
59- ] ,
6079 rules : {
61- "@typescript-eslint/no-require-imports" : "off" ,
80+ ...tseslint . configs . disableTypeChecked . rules ,
81+ "no-undef" : "off" ,
82+ "no-console" : "off" ,
6283 } ,
6384 } ,
6485 gitignore ( ) ,
0 commit comments