-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(examples): add new 'vite-react-dom-with-ts-blank-eslint-parser-a…
…pp' example
- Loading branch information
Showing
24 changed files
with
874 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
examples/vite-react-dom-with-ts-blank-eslint-parser-app/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
5 changes: 5 additions & 0 deletions
5
examples/vite-react-dom-with-ts-blank-eslint-parser-app/.vscode/extensions.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"recommendations": [ | ||
"dbaeumer.vscode-eslint" | ||
] | ||
} |
3 changes: 3 additions & 0 deletions
3
examples/vite-react-dom-with-ts-blank-eslint-parser-app/eslint.config.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
declare module "@eslint/js"; | ||
declare module "eslint-plugin-react-hooks"; | ||
declare module "eslint-plugin-react-refresh"; |
73 changes: 73 additions & 0 deletions
73
examples/vite-react-dom-with-ts-blank-eslint-parser-app/eslint.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// @ts-check | ||
import eslintJs from "@eslint/js"; | ||
import eslintReact from "@eslint-react/eslint-plugin"; | ||
import eslintPluginReactHooks from "eslint-plugin-react-hooks"; | ||
import eslintPluginReactRefresh from "eslint-plugin-react-refresh"; | ||
import globals from "globals"; | ||
import * as tsBlankEslintParser from "ts-blank-eslint-parser"; | ||
|
||
import TSCONFIG from "./tsconfig.json" with { type: "json" }; | ||
import TSCONFIG_NODE from "./tsconfig.node.json" with { type: "json" }; | ||
|
||
const GLOB_TS = ["**/*.ts", "**/*.tsx"]; | ||
|
||
export default [ | ||
// base configuration for browser environment source files | ||
{ | ||
files: TSCONFIG.include, | ||
languageOptions: { | ||
globals: { | ||
...globals.browser, | ||
}, | ||
parser: tsBlankEslintParser, | ||
parserOptions: { | ||
jsxPragma: "React", | ||
sourceType: "module", | ||
}, | ||
}, | ||
rules: { | ||
...eslintJs.configs.recommended.rules, | ||
}, | ||
}, | ||
// base configuration for node environment source files (*.config.js, etc.) | ||
{ | ||
files: TSCONFIG_NODE.include, | ||
ignores: TSCONFIG_NODE.exclude, | ||
languageOptions: { | ||
globals: { | ||
...globals.node, | ||
}, | ||
parser: tsBlankEslintParser, | ||
parserOptions: { | ||
sourceType: "module", | ||
}, | ||
}, | ||
rules: { | ||
...eslintJs.configs.recommended.rules, | ||
"no-console": "off", | ||
}, | ||
}, | ||
// React configuration | ||
{ | ||
files: TSCONFIG.include, | ||
...eslintReact.configs.recommended, | ||
}, | ||
// React Hooks configuration | ||
{ | ||
files: TSCONFIG.include, | ||
plugins: { | ||
"react-hooks": eslintPluginReactHooks, | ||
}, | ||
rules: eslintPluginReactHooks.configs.recommended.rules, | ||
}, | ||
// React Refresh configuration | ||
{ | ||
files: TSCONFIG.include, | ||
plugins: { | ||
"react-refresh": eslintPluginReactRefresh, | ||
}, | ||
rules: { | ||
"react-refresh/only-export-components": "warn", | ||
}, | ||
}, | ||
]; |
15 changes: 15 additions & 0 deletions
15
examples/vite-react-dom-with-ts-blank-eslint-parser-app/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>eslint-react-example</title> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.ts"></script> | ||
</body> | ||
|
||
</html> |
37 changes: 37 additions & 0 deletions
37
examples/vite-react-dom-with-ts-blank-eslint-parser-app/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"name": "@examples/vite-react-dom-with-ts-blank-eslint-parser-app", | ||
"version": "0.0.0", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"build": "tsc && vite build", | ||
"dev": "vite", | ||
"inspect:eslint-config": "eslint-config-inspector", | ||
"lint": "eslint .", | ||
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"react": "^19.0.0", | ||
"react-dom": "^19.0.0" | ||
}, | ||
"devDependencies": { | ||
"@eslint-react/eslint-plugin": "^1.24.1", | ||
"@eslint/config-inspector": "^1.0.0", | ||
"@eslint/js": "^9.19.0", | ||
"@tsconfig/node22": "^22.0.0", | ||
"@tsconfig/strictest": "^2.0.5", | ||
"@types/react": "^19.0.8", | ||
"@types/react-dom": "^19.0.3", | ||
"@vitejs/plugin-react": "^4.3.4", | ||
"eslint": "^9.18.0", | ||
"eslint-plugin-react-hooks": "^5.1.0", | ||
"eslint-plugin-react-refresh": "^0.4.18", | ||
"globals": "^15.14.0", | ||
"ts-blank-eslint-parser": "alpha", | ||
"typescript": "^5.7.3", | ||
"vite": "^6.0.11" | ||
}, | ||
"engines": { | ||
"node": ">=18.18.0" | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
examples/vite-react-dom-with-ts-blank-eslint-parser-app/src/App.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#root { | ||
max-width: 1280px; | ||
margin: 0 auto; | ||
padding: 2rem; | ||
text-align: center; | ||
} | ||
|
||
.logo { | ||
height: 8em; | ||
padding: 1.5em; | ||
will-change: filter; | ||
transition: filter 300ms; | ||
} | ||
|
||
.logo:hover { | ||
filter: drop-shadow(0 0 2em #646cffaa); | ||
} | ||
|
||
.logo.react:hover { | ||
filter: drop-shadow(0 0 2em #61dafbaa); | ||
} | ||
|
||
@keyframes logo-spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
|
||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
|
||
@media (prefers-reduced-motion: no-preference) { | ||
a>.logo { | ||
animation: logo-spin infinite 20s linear; | ||
} | ||
} | ||
|
||
.card { | ||
padding: 2em; | ||
} |
26 changes: 26 additions & 0 deletions
26
examples/vite-react-dom-with-ts-blank-eslint-parser-app/src/App.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import "./App.css"; | ||
|
||
import { useState } from "react"; | ||
|
||
import logo from "./assets/eslint-react.svg"; | ||
|
||
function App() { | ||
const [count, setCount] = useState(0n); | ||
|
||
return ( | ||
<div> | ||
<div> | ||
<a href="https://eslint-react.xyz" target="_blank" rel="noopener noreferrer"> | ||
<img alt="logo" className="logo" src={logo} /> | ||
</a> | ||
</div> | ||
<div className="card"> | ||
<button type="button" onClick={() => setCount((count) => count + 1n)}> | ||
count is {count.toString()} | ||
</button> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; |
13 changes: 13 additions & 0 deletions
13
...ples/vite-react-dom-with-ts-blank-eslint-parser-app/src/assets/eslint-react.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions
6
examples/vite-react-dom-with-ts-blank-eslint-parser-app/src/assets/react.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 88 additions & 0 deletions
88
examples/vite-react-dom-with-ts-blank-eslint-parser-app/src/index.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
:root { | ||
font-family: ui-sans-serif, | ||
system-ui, | ||
-apple-system, | ||
BlinkMacSystemFont, | ||
'Segoe UI', | ||
Roboto, | ||
'Helvetica Neue', | ||
Arial, | ||
'Noto Sans', | ||
sans-serif, | ||
'Apple Color Emoji', | ||
'Segoe UI Emoji', | ||
'Segoe UI Symbol', | ||
'Noto Color Emoji'; | ||
|
||
line-height: 1.5; | ||
font-weight: 400; | ||
|
||
color-scheme: light dark; | ||
color: rgba(255, 255, 255, 0.87); | ||
background-color: #242424; | ||
|
||
font-synthesis: none; | ||
text-rendering: optimizeLegibility; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
-webkit-text-size-adjust: 100%; | ||
} | ||
|
||
a { | ||
font-weight: 500; | ||
color: #646cff; | ||
text-decoration: inherit; | ||
} | ||
|
||
a:hover { | ||
color: #535bf2; | ||
} | ||
|
||
body { | ||
margin: 0; | ||
display: flex; | ||
place-items: center; | ||
min-width: 320px; | ||
min-height: 100vh; | ||
} | ||
|
||
h1 { | ||
font-size: 3.2em; | ||
line-height: 1.1; | ||
} | ||
|
||
button { | ||
border-radius: 8px; | ||
border: 1px solid transparent; | ||
padding: 0.6em 1.2em; | ||
font-size: 1em; | ||
font-weight: 500; | ||
font-family: inherit; | ||
background-color: #1a1a1a; | ||
cursor: pointer; | ||
transition: border-color 0.25s; | ||
} | ||
|
||
button:hover { | ||
border-color: #646cff; | ||
} | ||
|
||
button:focus, | ||
button:focus-visible { | ||
outline: 4px auto -webkit-focus-ring-color; | ||
} | ||
|
||
@media (prefers-color-scheme: light) { | ||
:root { | ||
color: #213547; | ||
background-color: #ffffff; | ||
} | ||
|
||
a:hover { | ||
color: #747bff; | ||
} | ||
|
||
button { | ||
background-color: #f9f9f9; | ||
} | ||
} |
Oops, something went wrong.