Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt TS projects #3565

Merged
merged 3 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/.cache
/coverage
/dist
/lib
/node_modules
/tmp
/.eslintcache
/package-lock.json
__screenshots__

Expand Down
2 changes: 1 addition & 1 deletion api-extractor.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "<projectFolder>/tmp/index.d.ts",
"mainEntryPointFilePath": "<projectFolder>/.cache/lib/index.d.ts",
"apiReport": {
"enabled": false
},
Expand Down
8 changes: 7 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"files": {
"ignore": ["./coverage/**/*", "./dist/**/*", "./lib/**/*", "./node_modules/**/*", "./tmp/**/*"]
"ignore": [
"./.cache/**/*",
"./coverage/**/*",
"./dist/**/*",
"./lib/**/*",
"./node_modules/**/*"
]
},
"formatter": {
"ignore": ["*.ts", "*.tsx", "./package.json"],
Expand Down
10 changes: 8 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import testingLibrary from 'eslint-plugin-testing-library';

export default [
{
ignores: ['coverage', 'dist', 'lib']
ignores: ['.cache', 'coverage', 'dist', 'lib']
},
{
name: 'common',
Expand All @@ -29,7 +29,13 @@ export default [
parserOptions: {
ecmaVersion: 'latest',
jsxPragma: null,
project: './tsconfig.json',
project: [
'./tsconfig.js.json',
'./tsconfig.src.json',
'./tsconfig.test.json',
'./tsconfig.vite.json',
'./tsconfig.website.json'
],
warnOnUnsupportedTypeScriptVersion: false
}
},
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
"format": "biome format --write",
"check": "biome check --error-on-warnings",
"biome:ci": "biome ci --error-on-warnings",
"eslint": "eslint --max-warnings 0 --cache",
"eslint": "eslint --max-warnings 0 --cache --cache-location .cache/eslint --cache-strategy content",
"eslint:fix": "node --run eslint -- --fix",
"prettier:check": "prettier --check .",
"prettier:format": "prettier --write .",
"typecheck": "tsc",
"typecheck": "tsc --build",
"prepublishOnly": "npm install && node --run build && node --run build:types",
"postpublish": "git push --follow-tags origin HEAD"
},
Expand All @@ -70,7 +70,6 @@
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-node-resolve": "^15.1.0",
"@testing-library/dom": "^10.1.0",
"@testing-library/jest-dom": "^6.2.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was unused, looks like the browser integration implements the same features.

"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^14.5.2",
"@types/node": "^22.0.0",
Expand Down
11 changes: 9 additions & 2 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"composite": true,
"emitDeclarationOnly": true,
"exactOptionalPropertyTypes": true,
"incremental": true,
"isolatedModules": true,
"jsx": "react-jsx",
"lib": ["ESNext"],
"module": "esnext",
"moduleDetection": "force",
"moduleResolution": "bundler",
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "./.cache/ts",
"pretty": true,
"strict": true,
"target": "esnext",
"skipLibCheck": true,
"useUnknownInCatchVariables": true
"types": [],
"useUnknownInCatchVariables": true,
"verbatimModuleSyntax": true
}
}
10 changes: 10 additions & 0 deletions tsconfig.js.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"allowJs": true,
"module": "NodeNext",
"moduleResolution": "NodeNext",
"skipLibCheck": true
},
"include": ["**/*.js", ".github/**/*.js"]
}
20 changes: 7 additions & 13 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"noEmit": true,
"types": ["vitest/globals", "@vitest/browser/providers/playwright"]
},
"include": [
"eslint.config.js",
"rollup.config.js",
"vite.config.ts",
".github/**/*",
"src/**/*",
"test/**/*",
"website/**/*"
"include": [],
"references": [
{ "path": "tsconfig.js.json" },
{ "path": "tsconfig.src.json" },
{ "path": "tsconfig.test.json" },
{ "path": "tsconfig.vite.json" },
{ "path": "tsconfig.website.json" }
]
}
7 changes: 4 additions & 3 deletions tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"composite": false,
"declaration": true,
"declarationMap": true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why we had declarationMap enabled, we don't ship them.

"emitDeclarationOnly": true,
"outDir": "tmp"
"incremental": false,
"lib": ["ESNext", "DOM", "DOM.Iterable", "DOM.AsyncIterable"],
"outDir": "./.cache/lib"
},
"files": ["src/index.ts"]
}
7 changes: 7 additions & 0 deletions tsconfig.src.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"lib": ["ESNext", "DOM", "DOM.Iterable", "DOM.AsyncIterable"]
},
"include": ["src/**/*"]
}
10 changes: 10 additions & 0 deletions tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"lib": ["ESNext", "DOM", "DOM.Iterable", "DOM.AsyncIterable"],
"skipLibCheck": true,
"types": ["vitest/globals", "@vitest/browser/providers/playwright"]
},
"include": ["test/**/*"],
"references": [{ "path": "tsconfig.src.json" }]
}
8 changes: 8 additions & 0 deletions tsconfig.vite.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"skipLibCheck": true,
"types": ["@vitest/browser/providers/playwright"]
},
"include": ["vite.config.ts"]
}
9 changes: 9 additions & 0 deletions tsconfig.website.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"lib": ["ESNext", "DOM", "DOM.Iterable", "DOM.AsyncIterable"],
"skipLibCheck": true
},
"include": ["website/**/*"],
"references": [{ "path": "tsconfig.src.json" }]
}
7 changes: 6 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,24 @@ const resizeColumn: BrowserCommand<[resizeBy: number]> = async (context, resizeB

export default defineConfig({
base: isCI ? '/react-data-grid/' : '/',
cacheDir: '.cache/vite',
build: {
emptyOutDir: true,
sourcemap: true
},
plugins: [
react({
exclude: ['./.cache/**/*'],
babel: {
babelrc: false,
configFile: false,
plugins: [['optimize-clsx', { functionNames: ['getCellClassname'] }]]
}
}),
wyw({ preprocessor: 'none' })
wyw({
exclude: ['./.cache/**/*'],
preprocessor: 'none'
})
],
server: {
open: true
Expand Down
Loading