Skip to content

Commit 945ca60

Browse files
committed
feat(examples): add new 'vite-react-dom-with-ts-blank-eslint-parser-app' example
1 parent 170bbef commit 945ca60

File tree

24 files changed

+874
-280
lines changed

24 files changed

+874
-280
lines changed

examples/dual-react-dom-lib/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
},
3131
"devDependencies": {
3232
"@eslint-react/eslint-plugin": "^1.24.1",
33-
"@eslint/js": "^9.18.0",
33+
"@eslint/js": "^9.19.0",
3434
"@tsconfig/node22": "^22.0.0",
3535
"@tsconfig/strictest": "^2.0.5",
3636
"@types/node": "^22.10.10",

examples/next-app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"devDependencies": {
1919
"@eslint-react/eslint-plugin": "^1.24.1",
2020
"@eslint/config-inspector": "^1.0.0",
21-
"@eslint/js": "^9.18.0",
21+
"@eslint/js": "^9.19.0",
2222
"@next/eslint-plugin-next": "^15.1.6",
2323
"@types/negotiator": "^0.6.3",
2424
"@types/node": "^22.10.10",

examples/vite-react-dom-app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"devDependencies": {
1818
"@eslint-react/eslint-plugin": "^1.24.1",
1919
"@eslint/config-inspector": "^1.0.0",
20-
"@eslint/js": "^9.18.0",
20+
"@eslint/js": "^9.19.0",
2121
"@tsconfig/node22": "^22.0.0",
2222
"@tsconfig/strictest": "^2.0.5",
2323
"@types/react": "^19.0.8",

examples/vite-react-dom-js-app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"devDependencies": {
1818
"@eslint-react/eslint-plugin": "^1.24.1",
1919
"@eslint/config-inspector": "^1.0.0",
20-
"@eslint/js": "^9.18.0",
20+
"@eslint/js": "^9.19.0",
2121
"@types/react": "^19.0.8",
2222
"@types/react-dom": "^19.0.3",
2323
"@vitejs/plugin-react": "^4.3.4",

examples/vite-react-dom-js-with-babel-app/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
"react-dom": "^19.0.0"
1616
},
1717
"devDependencies": {
18-
"@babel/core": "^7.26.0",
18+
"@babel/core": "^7.26.7",
1919
"@babel/eslint-parser": "^7.26.5",
20-
"@babel/preset-env": "^7.26.0",
20+
"@babel/preset-env": "^7.26.7",
2121
"@babel/preset-react": "^7.26.3",
2222
"@eslint-react/eslint-plugin": "^1.24.1",
2323
"@eslint/config-inspector": "^1.0.0",
24-
"@eslint/js": "^9.18.0",
24+
"@eslint/js": "^9.19.0",
2525
"@types/babel__core": "~7.20.5",
2626
"@types/babel__preset-env": "~7.9.7",
2727
"@types/react": "^19.0.8",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.idea
17+
.DS_Store
18+
*.suo
19+
*.ntvs*
20+
*.njsproj
21+
*.sln
22+
*.sw?
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint"
4+
]
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
declare module "@eslint/js";
2+
declare module "eslint-plugin-react-hooks";
3+
declare module "eslint-plugin-react-refresh";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// @ts-check
2+
import eslintJs from "@eslint/js";
3+
import eslintReact from "@eslint-react/eslint-plugin";
4+
import eslintPluginReactHooks from "eslint-plugin-react-hooks";
5+
import eslintPluginReactRefresh from "eslint-plugin-react-refresh";
6+
import globals from "globals";
7+
import * as tsBlankEslintParser from "ts-blank-eslint-parser";
8+
9+
import TSCONFIG from "./tsconfig.json" with { type: "json" };
10+
import TSCONFIG_NODE from "./tsconfig.node.json" with { type: "json" };
11+
12+
const GLOB_TS = ["**/*.ts", "**/*.tsx"];
13+
14+
export default [
15+
// base configuration for browser environment source files
16+
{
17+
files: TSCONFIG.include,
18+
languageOptions: {
19+
globals: {
20+
...globals.browser,
21+
},
22+
parser: tsBlankEslintParser,
23+
parserOptions: {
24+
jsxPragma: "React",
25+
sourceType: "module",
26+
},
27+
},
28+
rules: {
29+
...eslintJs.configs.recommended.rules,
30+
},
31+
},
32+
// base configuration for node environment source files (*.config.js, etc.)
33+
{
34+
files: TSCONFIG_NODE.include,
35+
ignores: TSCONFIG_NODE.exclude,
36+
languageOptions: {
37+
globals: {
38+
...globals.node,
39+
},
40+
parser: tsBlankEslintParser,
41+
parserOptions: {
42+
sourceType: "module",
43+
},
44+
},
45+
rules: {
46+
...eslintJs.configs.recommended.rules,
47+
"no-console": "off",
48+
},
49+
},
50+
// React configuration
51+
{
52+
files: TSCONFIG.include,
53+
...eslintReact.configs.recommended,
54+
},
55+
// React Hooks configuration
56+
{
57+
files: TSCONFIG.include,
58+
plugins: {
59+
"react-hooks": eslintPluginReactHooks,
60+
},
61+
rules: eslintPluginReactHooks.configs.recommended.rules,
62+
},
63+
// React Refresh configuration
64+
{
65+
files: TSCONFIG.include,
66+
plugins: {
67+
"react-refresh": eslintPluginReactRefresh,
68+
},
69+
rules: {
70+
"react-refresh/only-export-components": "warn",
71+
},
72+
},
73+
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!doctype html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>eslint-react-example</title>
8+
</head>
9+
10+
<body>
11+
<div id="root"></div>
12+
<script type="module" src="/src/main.ts"></script>
13+
</body>
14+
15+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "@examples/vite-react-dom-with-ts-blank-eslint-parser-app",
3+
"version": "0.0.0",
4+
"private": true,
5+
"type": "module",
6+
"scripts": {
7+
"build": "tsc && vite build",
8+
"dev": "vite",
9+
"inspect:eslint-config": "eslint-config-inspector",
10+
"lint": "eslint .",
11+
"preview": "vite preview"
12+
},
13+
"dependencies": {
14+
"react": "^19.0.0",
15+
"react-dom": "^19.0.0"
16+
},
17+
"devDependencies": {
18+
"@eslint-react/eslint-plugin": "^1.24.1",
19+
"@eslint/config-inspector": "^1.0.0",
20+
"@eslint/js": "^9.19.0",
21+
"@tsconfig/node22": "^22.0.0",
22+
"@tsconfig/strictest": "^2.0.5",
23+
"@types/react": "^19.0.8",
24+
"@types/react-dom": "^19.0.3",
25+
"@vitejs/plugin-react": "^4.3.4",
26+
"eslint": "^9.18.0",
27+
"eslint-plugin-react-hooks": "^5.1.0",
28+
"eslint-plugin-react-refresh": "^0.4.18",
29+
"globals": "^15.14.0",
30+
"ts-blank-eslint-parser": "alpha",
31+
"typescript": "^5.7.3",
32+
"vite": "^6.0.11"
33+
},
34+
"engines": {
35+
"node": ">=18.18.0"
36+
}
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#root {
2+
max-width: 1280px;
3+
margin: 0 auto;
4+
padding: 2rem;
5+
text-align: center;
6+
}
7+
8+
.logo {
9+
height: 8em;
10+
padding: 1.5em;
11+
will-change: filter;
12+
transition: filter 300ms;
13+
}
14+
15+
.logo:hover {
16+
filter: drop-shadow(0 0 2em #646cffaa);
17+
}
18+
19+
.logo.react:hover {
20+
filter: drop-shadow(0 0 2em #61dafbaa);
21+
}
22+
23+
@keyframes logo-spin {
24+
from {
25+
transform: rotate(0deg);
26+
}
27+
28+
to {
29+
transform: rotate(360deg);
30+
}
31+
}
32+
33+
@media (prefers-reduced-motion: no-preference) {
34+
a>.logo {
35+
animation: logo-spin infinite 20s linear;
36+
}
37+
}
38+
39+
.card {
40+
padding: 2em;
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import "./App.css";
2+
3+
import { useState } from "react";
4+
5+
import logo from "./assets/eslint-react.svg";
6+
7+
function App() {
8+
const [count, setCount] = useState(0n);
9+
10+
return (
11+
<div>
12+
<div>
13+
<a href="https://eslint-react.xyz" target="_blank" rel="noopener noreferrer">
14+
<img alt="logo" className="logo" src={logo} />
15+
</a>
16+
</div>
17+
<div className="card">
18+
<button type="button" onClick={() => setCount((count) => count + 1n)}>
19+
count is {count.toString()}
20+
</button>
21+
</div>
22+
</div>
23+
);
24+
}
25+
26+
export default App;
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
:root {
2+
font-family: ui-sans-serif,
3+
system-ui,
4+
-apple-system,
5+
BlinkMacSystemFont,
6+
'Segoe UI',
7+
Roboto,
8+
'Helvetica Neue',
9+
Arial,
10+
'Noto Sans',
11+
sans-serif,
12+
'Apple Color Emoji',
13+
'Segoe UI Emoji',
14+
'Segoe UI Symbol',
15+
'Noto Color Emoji';
16+
17+
line-height: 1.5;
18+
font-weight: 400;
19+
20+
color-scheme: light dark;
21+
color: rgba(255, 255, 255, 0.87);
22+
background-color: #242424;
23+
24+
font-synthesis: none;
25+
text-rendering: optimizeLegibility;
26+
-webkit-font-smoothing: antialiased;
27+
-moz-osx-font-smoothing: grayscale;
28+
-webkit-text-size-adjust: 100%;
29+
}
30+
31+
a {
32+
font-weight: 500;
33+
color: #646cff;
34+
text-decoration: inherit;
35+
}
36+
37+
a:hover {
38+
color: #535bf2;
39+
}
40+
41+
body {
42+
margin: 0;
43+
display: flex;
44+
place-items: center;
45+
min-width: 320px;
46+
min-height: 100vh;
47+
}
48+
49+
h1 {
50+
font-size: 3.2em;
51+
line-height: 1.1;
52+
}
53+
54+
button {
55+
border-radius: 8px;
56+
border: 1px solid transparent;
57+
padding: 0.6em 1.2em;
58+
font-size: 1em;
59+
font-weight: 500;
60+
font-family: inherit;
61+
background-color: #1a1a1a;
62+
cursor: pointer;
63+
transition: border-color 0.25s;
64+
}
65+
66+
button:hover {
67+
border-color: #646cff;
68+
}
69+
70+
button:focus,
71+
button:focus-visible {
72+
outline: 4px auto -webkit-focus-ring-color;
73+
}
74+
75+
@media (prefers-color-scheme: light) {
76+
:root {
77+
color: #213547;
78+
background-color: #ffffff;
79+
}
80+
81+
a:hover {
82+
color: #747bff;
83+
}
84+
85+
button {
86+
background-color: #f9f9f9;
87+
}
88+
}

0 commit comments

Comments
 (0)