Skip to content

Commit 228694a

Browse files
authored
Adopt TS projects (#3565)
* Adopt TS projects * fix eslint?
1 parent 193d207 commit 228694a

15 files changed

+92
-30
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ jobs:
3131
run: npm i
3232
- name: Biome
3333
run: node --run biome:ci
34+
- name: Typecheck
35+
run: node --run typecheck
3436
- name: ESLint
3537
run: node --run eslint
3638
- name: Prettier
3739
run: node --run prettier:check
38-
- name: Typecheck
39-
run: node --run typecheck
4040
- name: Bundle
4141
run: |
4242
node --run build

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
/.cache
12
/coverage
23
/dist
34
/lib
45
/node_modules
5-
/tmp
6-
/.eslintcache
76
/package-lock.json
87
__screenshots__
98

api-extractor.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3-
"mainEntryPointFilePath": "<projectFolder>/tmp/index.d.ts",
3+
"mainEntryPointFilePath": "<projectFolder>/.cache/lib/index.d.ts",
44
"apiReport": {
55
"enabled": false
66
},

biome.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
{
22
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
33
"files": {
4-
"ignore": ["./coverage/**/*", "./dist/**/*", "./lib/**/*", "./node_modules/**/*", "./tmp/**/*"]
4+
"ignore": [
5+
"./.cache/**/*",
6+
"./coverage/**/*",
7+
"./dist/**/*",
8+
"./lib/**/*",
9+
"./node_modules/**/*"
10+
]
511
},
612
"formatter": {
713
"ignore": ["*.ts", "*.tsx", "./package.json"],

eslint.config.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import testingLibrary from 'eslint-plugin-testing-library';
1010

1111
export default [
1212
{
13-
ignores: ['coverage', 'dist', 'lib']
13+
ignores: ['.cache', 'coverage', 'dist', 'lib']
1414
},
1515
{
1616
name: 'common',
@@ -29,7 +29,13 @@ export default [
2929
parserOptions: {
3030
ecmaVersion: 'latest',
3131
jsxPragma: null,
32-
project: './tsconfig.json',
32+
project: [
33+
'./tsconfig.js.json',
34+
'./tsconfig.src.json',
35+
'./tsconfig.test.json',
36+
'./tsconfig.vite.json',
37+
'./tsconfig.website.json'
38+
],
3339
warnOnUnsupportedTypeScriptVersion: false
3440
}
3541
},

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@
4343
"format": "biome format --write",
4444
"check": "biome check --error-on-warnings",
4545
"biome:ci": "biome ci --error-on-warnings",
46-
"eslint": "eslint --max-warnings 0 --cache",
46+
"eslint": "eslint --max-warnings 0 --cache --cache-location .cache/eslint --cache-strategy content",
4747
"eslint:fix": "node --run eslint -- --fix",
4848
"prettier:check": "prettier --check .",
4949
"prettier:format": "prettier --write .",
50-
"typecheck": "tsc",
50+
"typecheck": "tsc --build",
5151
"prepublishOnly": "npm install && node --run build && node --run build:types",
5252
"postpublish": "git push --follow-tags origin HEAD"
5353
},
@@ -70,7 +70,6 @@
7070
"@rollup/plugin-babel": "^6.0.3",
7171
"@rollup/plugin-node-resolve": "^15.1.0",
7272
"@testing-library/dom": "^10.1.0",
73-
"@testing-library/jest-dom": "^6.2.0",
7473
"@testing-library/react": "^16.0.0",
7574
"@testing-library/user-event": "^14.5.2",
7675
"@types/node": "^22.0.0",

tsconfig.base.json

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
{
22
"compilerOptions": {
33
"allowSyntheticDefaultImports": true,
4+
"composite": true,
5+
"emitDeclarationOnly": true,
46
"exactOptionalPropertyTypes": true,
7+
"incremental": true,
58
"isolatedModules": true,
69
"jsx": "react-jsx",
10+
"lib": ["ESNext"],
711
"module": "esnext",
12+
"moduleDetection": "force",
813
"moduleResolution": "bundler",
914
"noImplicitReturns": true,
1015
"noUnusedLocals": true,
16+
"outDir": "./.cache/ts",
1117
"pretty": true,
1218
"strict": true,
1319
"target": "esnext",
14-
"skipLibCheck": true,
15-
"useUnknownInCatchVariables": true
20+
"types": [],
21+
"useUnknownInCatchVariables": true,
22+
"verbatimModuleSyntax": true
1623
}
1724
}

tsconfig.js.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "./tsconfig.base.json",
3+
"compilerOptions": {
4+
"allowJs": true,
5+
"module": "NodeNext",
6+
"moduleResolution": "NodeNext",
7+
"skipLibCheck": true
8+
},
9+
"include": ["**/*.js", ".github/**/*.js"],
10+
"exclude": ["./coverage/**/*", "./dist/**/*", "./lib/**/*"]
11+
}

tsconfig.json

+7-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
{
2-
"extends": "./tsconfig.base.json",
3-
"compilerOptions": {
4-
"noEmit": true,
5-
"types": ["vitest/globals", "@vitest/browser/providers/playwright"]
6-
},
7-
"include": [
8-
"eslint.config.js",
9-
"rollup.config.js",
10-
"vite.config.ts",
11-
".github/**/*",
12-
"src/**/*",
13-
"test/**/*",
14-
"website/**/*"
2+
"include": [],
3+
"references": [
4+
{ "path": "tsconfig.js.json" },
5+
{ "path": "tsconfig.src.json" },
6+
{ "path": "tsconfig.test.json" },
7+
{ "path": "tsconfig.vite.json" },
8+
{ "path": "tsconfig.website.json" }
159
]
1610
}

tsconfig.lib.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"extends": "./tsconfig.base.json",
33
"compilerOptions": {
4+
"composite": false,
45
"declaration": true,
5-
"declarationMap": true,
6-
"emitDeclarationOnly": true,
7-
"outDir": "tmp"
6+
"incremental": false,
7+
"lib": ["ESNext", "DOM", "DOM.Iterable", "DOM.AsyncIterable"],
8+
"outDir": "./.cache/lib"
89
},
910
"files": ["src/index.ts"]
1011
}

tsconfig.src.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig.base.json",
3+
"compilerOptions": {
4+
"lib": ["ESNext", "DOM", "DOM.Iterable", "DOM.AsyncIterable"]
5+
},
6+
"include": ["src/**/*"]
7+
}

tsconfig.test.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "./tsconfig.base.json",
3+
"compilerOptions": {
4+
"lib": ["ESNext", "DOM", "DOM.Iterable", "DOM.AsyncIterable"],
5+
"skipLibCheck": true,
6+
"types": ["vitest/globals", "@vitest/browser/providers/playwright"]
7+
},
8+
"include": ["test/**/*"],
9+
"references": [{ "path": "tsconfig.src.json" }]
10+
}

tsconfig.vite.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "./tsconfig.base.json",
3+
"compilerOptions": {
4+
"skipLibCheck": true,
5+
"types": ["@vitest/browser/providers/playwright"]
6+
},
7+
"include": ["vite.config.ts"]
8+
}

tsconfig.website.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.base.json",
3+
"compilerOptions": {
4+
"lib": ["ESNext", "DOM", "DOM.Iterable", "DOM.AsyncIterable"],
5+
"skipLibCheck": true
6+
},
7+
"include": ["website/**/*"],
8+
"references": [{ "path": "tsconfig.src.json" }]
9+
}

vite.config.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,24 @@ const resizeColumn: BrowserCommand<[resizeBy: number]> = async (context, resizeB
2121

2222
export default defineConfig({
2323
base: isCI ? '/react-data-grid/' : '/',
24+
cacheDir: '.cache/vite',
2425
build: {
2526
emptyOutDir: true,
2627
sourcemap: true
2728
},
2829
plugins: [
2930
react({
31+
exclude: ['./.cache/**/*'],
3032
babel: {
3133
babelrc: false,
3234
configFile: false,
3335
plugins: [['optimize-clsx', { functionNames: ['getCellClassname'] }]]
3436
}
3537
}),
36-
wyw({ preprocessor: 'none' })
38+
wyw({
39+
exclude: ['./.cache/**/*'],
40+
preprocessor: 'none'
41+
})
3742
],
3843
server: {
3944
open: true

0 commit comments

Comments
 (0)