Skip to content

Commit 713ca6d

Browse files
committed
add missing favicon and update README
also: use eslint configuration recommended by vite
1 parent 480a246 commit 713ca6d

File tree

5 files changed

+30
-49
lines changed

5 files changed

+30
-49
lines changed

apps/hightable-demo/README.md

Lines changed: 11 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,18 @@
1-
# React + TypeScript + Vite
1+
# HighTable demo
22

3-
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
3+
This is an example project showing how to use [hightable](https://github.com/hyparam/hightable).
44

5-
Currently, two official plugins are available:
5+
## Build
66

7-
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9-
10-
## Expanding the ESLint configuration
11-
12-
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
13-
14-
- Configure the top-level `parserOptions` property like this:
15-
16-
```js
17-
export default tseslint.config({
18-
languageOptions: {
19-
// other options...
20-
parserOptions: {
21-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
22-
tsconfigRootDir: import.meta.dirname,
23-
},
24-
},
25-
})
7+
```bash
8+
cd apps/hightable-demo
9+
npm i
10+
npm run build
2611
```
2712

28-
- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
29-
- Optionally add `...tseslint.configs.stylisticTypeChecked`
30-
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:
31-
32-
```js
33-
// eslint.config.js
34-
import react from 'eslint-plugin-react'
13+
The build artifacts will be stored in the `dist/` directory and can be served using any static server, eg. `http-server`:
3514

36-
export default tseslint.config({
37-
// Set the react version
38-
settings: { react: { version: '18.3' } },
39-
plugins: {
40-
// Add the react plugin
41-
react,
42-
},
43-
rules: {
44-
// other rules...
45-
// Enable its recommended rules
46-
...react.configs.recommended.rules,
47-
...react.configs['jsx-runtime'].rules,
48-
},
49-
})
15+
```bash
16+
npm i -g http-server
17+
http-server dist/
5018
```
Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
import js from '@eslint/js'
2-
import globals from 'globals'
2+
import react from 'eslint-plugin-react'
33
import reactHooks from 'eslint-plugin-react-hooks'
44
import reactRefresh from 'eslint-plugin-react-refresh'
5+
import globals from 'globals'
56
import tseslint from 'typescript-eslint'
67

78
export default tseslint.config(
89
{ ignores: ['dist'] },
910
{
10-
extends: [js.configs.recommended, ...tseslint.configs.recommended],
11-
files: ['**/*.{ts,tsx}'],
11+
extends: [js.configs.recommended, ...tseslint.configs.strictTypeChecked, ...tseslint.configs.stylisticTypeChecked],
12+
// Set the react version
13+
settings: { react: { version: '18.3' } },
14+
files: ['src/**/*.{ts,tsx}'],
1215
languageOptions: {
1316
ecmaVersion: 2020,
1417
globals: globals.browser,
18+
parserOptions: {
19+
project: './tsconfig.json',
20+
tsconfigRootDir: import.meta.dirname,
21+
},
1522
},
1623
plugins: {
24+
react,
1725
'react-hooks': reactHooks,
1826
'react-refresh': reactRefresh,
1927
},
@@ -23,6 +31,10 @@ export default tseslint.config(
2331
'warn',
2432
{ allowConstantExport: true },
2533
],
34+
...react.configs.recommended.rules,
35+
...react.configs['jsx-runtime'].rules,
36+
37+
'@typescript-eslint/restrict-template-expressions': 'off',
2638
},
2739
},
2840
)

apps/hightable-demo/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"@types/react-dom": "^18.3.1",
2121
"@vitejs/plugin-react": "^4.3.3",
2222
"eslint": "^9.13.0",
23+
"eslint-plugin-react": "^7.37.2",
2324
"eslint-plugin-react-hooks": "^5.0.0",
2425
"eslint-plugin-react-refresh": "^0.4.14",
2526
"globals": "^15.11.0",
1.04 KB
Loading

apps/hightable-demo/src/data.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ function lorem(rand: number, length: number): string {
77
}
88

99
function delay<T>(value: T, ms: number): Promise<T> {
10-
return new Promise(resolve => setTimeout(() => resolve(value), ms))
10+
return new Promise(resolve => setTimeout(() => { resolve(value);}, ms))
1111
}
1212

1313
const header = ['ID', 'Name', 'Age', 'UUID', 'Text', 'JSON']
1414
const mockData = {
1515
header,
1616
numRows: 10000,
1717
rows(start: number, end: number) {
18-
const arr: Array<Record<string, ReturnType<typeof wrapPromise<string | number>>>> = []
18+
const arr: Record<string, ReturnType<typeof wrapPromise<string | number>>>[] = []
1919
for (let i = start; i < end; i++) {
2020
const rand = Math.abs(Math.sin(i + 1))
2121
const uuid = rand.toString(16).substring(2)
2222
const partial = {
2323
ID: i + 1,
24-
Name: 'Name' + i,
24+
Name: `Name${i}`,
2525
Age: 20 + i % 80,
2626
UUID: uuid,
2727
Text: lorem(rand, 100),

0 commit comments

Comments
 (0)