Skip to content

Commit a1e78b5

Browse files
authored
Use Vite to build the lib (#63)
* fix lint * add missing dev dependency * fix types * small optimizations * weird indentation * revert change from || to ??, making it a bit clearer * ensure hightable/src/HighTable.css can be accessed for now * update CHANGELOG * no umd build * update CHANGELOG * give details about the build process * no need for deprecated key * no need for deprecated key * revert unnecessary change in imports * revert weird change
1 parent 8a4dbed commit a1e78b5

21 files changed

+333
-223
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## [Unreleased](https://github.com/hyparam/hightable/compare/v0.11.0...HEAD)
44

5+
### Refactored
6+
7+
- Build the library with Vite instead of Rollup ([#63](https://github.com/hyparam/hightable/pull/63)).
8+
- Harmonize the ESLint and Typescript rules with the other hyparam projects ([#63](https://github.com/hyparam/hightable/pull/63)).
9+
510
## [0.11.0](https://github.com/hyparam/hightable/compare/v0.10.0...v0.11.0) - 2025-02-27
611

712
### Added

eslint.config.js

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,32 @@
11
import javascript from '@eslint/js'
2-
import typescriptParser from '@typescript-eslint/parser'
32
import react from 'eslint-plugin-react'
43
import reactHooks from 'eslint-plugin-react-hooks'
54
import globals from 'globals'
65
import typescript from 'typescript-eslint'
76

8-
export default [
7+
export default typescript.config(
8+
{ ignores: ['coverage/', 'dist/'] },
99
{
10-
ignores: ['coverage/', 'dist/'],
11-
},
12-
{
13-
files: ['**/*.ts', '**/*.tsx'],
14-
plugins: {
15-
react,
16-
'react-hooks': reactHooks,
17-
typescript,
18-
},
19-
10+
extends: [javascript.configs.recommended, ...typescript.configs.strictTypeChecked, ...typescript.configs.stylisticTypeChecked],
11+
files: ['**/*.{ts,tsx,js}'],
2012
languageOptions: {
21-
globals: {
22-
...globals.browser,
23-
Babel: 'readonly',
24-
React: 'readonly',
25-
ReactDOM: 'readonly',
26-
},
27-
parser: typescriptParser,
13+
globals: globals.browser,
2814
parserOptions: {
29-
ecmaFeatures: {
30-
jsx: true,
31-
},
15+
project: ['./tsconfig.json', './tsconfig.eslint.json'],
16+
tsconfigRootDir: import.meta.dirname,
3217
},
3318
},
34-
settings: {
35-
react: {
36-
version: 'detect',
37-
},
19+
plugins: {
20+
react,
21+
'react-hooks': reactHooks,
3822
},
39-
4023
rules: {
41-
...javascript.configs.recommended.rules,
4224
...react.configs.recommended.rules,
25+
...react.configs['jsx-runtime'].rules,
4326
...reactHooks.configs.recommended.rules,
44-
...typescript.configs.eslintRecommended.rules,
27+
...javascript.configs.recommended.rules,
4528
...typescript.configs.recommended.rules,
29+
// javascript
4630
'arrow-spacing': 'error',
4731
camelcase: 'off',
4832
'comma-spacing': 'error',
@@ -60,6 +44,7 @@ export default [
6044
'no-constant-condition': 'off',
6145
'no-extra-parens': 'error',
6246
'no-multi-spaces': 'error',
47+
'no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0 }],
6348
'no-trailing-spaces': 'error',
6449
'no-undef': 'error',
6550
'no-unused-vars': 'off',
@@ -77,14 +62,39 @@ export default [
7762
quotes: ['error', 'single'],
7863
'require-await': 'warn',
7964
semi: ['error', 'never'],
80-
8165
'sort-imports': ['error', {
8266
ignoreDeclarationSort: true,
8367
ignoreMemberSort: false,
8468
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
8569
}],
86-
8770
'space-infix-ops': 'error',
71+
// typescript
72+
'@typescript-eslint/restrict-template-expressions': 'off',
73+
'@typescript-eslint/no-unused-vars': 'warn',
74+
'@typescript-eslint/require-await': 'warn',
75+
// allow using any - see row.ts - it's not easy to replace with unknown for example
76+
'@typescript-eslint/no-explicit-any': 'off',
77+
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'off',
78+
'@typescript-eslint/prefer-promise-reject-errors': 'off',
79+
'@typescript-eslint/no-unsafe-assignment': 'off',
80+
'@typescript-eslint/no-unsafe-return': 'off',
81+
// fix an issue with vi.fn in an object (localStorage mock in our tests): see https://github.com/vitest-dev/eslint-plugin-vitest/issues/591
82+
'@typescript-eslint/unbound-method': 'off',
83+
},
84+
settings: { react: { version: 'detect' } },
85+
},
86+
{
87+
files: ['test/**/*.{ts,tsx}', '*.{js,ts}'],
88+
languageOptions: {
89+
ecmaVersion: 2020,
90+
globals: {
91+
...globals.node,
92+
...globals.browser,
93+
},
8894
},
8995
},
90-
]
96+
{
97+
files: ['**/*.js'],
98+
...typescript.configs.disableTypeChecked,
99+
}
100+
)

package.json

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,42 +20,46 @@
2020
"type": "git",
2121
"url": "git+https://github.com/hyparam/hightable.git"
2222
},
23-
"main": "dist/HighTable.min.js",
23+
"type": "module",
24+
"exports": {
25+
".": {
26+
"types": "./dist/types/HighTable.d.ts",
27+
"import": "./dist/HighTable.js"
28+
},
29+
"./src/HighTable.css": "./dist/HighTable.css"
30+
},
2431
"files": [
25-
"src",
2632
"dist"
2733
],
28-
"type": "module",
29-
"types": "dist/HighTable.d.ts",
3034
"scripts": {
31-
"build": "rollup -c",
35+
"build:bundle": "vite build",
36+
"build:css": "cp src/HighTable.css dist/HighTable.css",
37+
"build:types": "tsc -b",
38+
"build": "npm run build:bundle && npm run build:types && npm run build:css",
3239
"coverage": "vitest run --coverage --coverage.include=src",
3340
"lint": "eslint",
3441
"prepublishOnly": "npm run build",
3542
"test": "vitest run",
3643
"typecheck": "tsc --noEmit"
3744
},
3845
"devDependencies": {
39-
"@rollup/plugin-commonjs": "28.0.2",
40-
"@rollup/plugin-node-resolve": "16.0.0",
41-
"@rollup/plugin-replace": "6.0.2",
42-
"@rollup/plugin-terser": "0.4.4",
43-
"@rollup/plugin-typescript": "12.1.2",
4446
"@testing-library/react": "16.2.0",
4547
"@testing-library/user-event": "14.6.1",
4648
"@types/node": "22.13.5",
4749
"@types/react": "18.3.18",
4850
"@types/react-dom": "18.3.5",
51+
"@vitejs/plugin-react": "4.3.4",
4952
"@vitest/coverage-v8": "3.0.6",
5053
"eslint": "9.21.0",
5154
"eslint-plugin-react": "7.37.4",
5255
"eslint-plugin-react-hooks": "5.1.0",
56+
"globals": "15.14.0",
5357
"jsdom": "26.0.0",
5458
"react": "18.2.0",
5559
"react-dom": "18.2.0",
56-
"tslib": "2.8.1",
5760
"typescript": "5.7.3",
5861
"typescript-eslint": "8.23.0",
62+
"vite": "6.2.0",
5963
"vitest": "3.0.6"
6064
},
6165
"peerDependencies": {

rollup.config.js

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

0 commit comments

Comments
 (0)