Skip to content

Commit 0119497

Browse files
committed
refactor(examples): improve eslint configs
1 parent 9177b7c commit 0119497

37 files changed

+163
-1396
lines changed

examples/next-app/eslint.config.mjs

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
1+
// @ts-check
2+
3+
import react from "@eslint-react/eslint-plugin";
14
import js from "@eslint/js";
2-
import tseslint from "typescript-eslint";
35
import next from "@next/eslint-plugin-next";
4-
import react from "@eslint-react/eslint-plugin";
56
import reactHooks from "eslint-plugin-react-hooks";
7+
import reactRefresh from "eslint-plugin-react-refresh";
8+
import tseslint from "typescript-eslint";
69
import 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"];
1015
const 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

1318
export 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(),

examples/next-app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"scripts": {
55
"build": "next build",
66
"dev": "next dev",
7+
"lint": "eslint .",
78
"start": "next start"
89
},
910
"dependencies": {

examples/react-router-app/.dockerignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

examples/react-router-app/.gitignore

Lines changed: 0 additions & 6 deletions
This file was deleted.

examples/react-router-app/.vscode/extensions.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

examples/react-router-app/Dockerfile

Lines changed: 0 additions & 22 deletions
This file was deleted.

examples/react-router-app/Dockerfile.bun

Lines changed: 0 additions & 25 deletions
This file was deleted.

examples/react-router-app/Dockerfile.pnpm

Lines changed: 0 additions & 26 deletions
This file was deleted.

examples/react-router-app/README.md

Lines changed: 0 additions & 100 deletions
This file was deleted.

examples/react-router-app/app/app.css

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)