diff --git a/packages/match-sorter-utils/tsconfig.json b/packages/match-sorter-utils/tsconfig.json index b36d1bf924..9b21ee123b 100644 --- a/packages/match-sorter-utils/tsconfig.json +++ b/packages/match-sorter-utils/tsconfig.json @@ -1,4 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src", "vite.config.ts"] + "include": ["src", "vite.config.ts", "tests"] } diff --git a/packages/react-table/eslint.config.js b/packages/react-table/eslint.config.js index 83193e3258..6279d73a95 100644 --- a/packages/react-table/eslint.config.js +++ b/packages/react-table/eslint.config.js @@ -1,7 +1,7 @@ // @ts-check import pluginReact from '@eslint-react/eslint-plugin' -//// @ts-expect-error +// @ts-expect-error // import pluginReactCompiler from 'eslint-plugin-react-compiler' import pluginReactHooks from 'eslint-plugin-react-hooks' import rootConfig from '../../eslint.config.js' diff --git a/packages/react-table/tsconfig.json b/packages/react-table/tsconfig.json index 687dc5540e..84562bb4a7 100644 --- a/packages/react-table/tsconfig.json +++ b/packages/react-table/tsconfig.json @@ -3,5 +3,5 @@ "compilerOptions": { "jsx": "react" }, - "include": ["src"] + "include": ["src", "eslint.config.js", "vite.config.ts", "tests"] } diff --git a/packages/react-table/vite.config.ts b/packages/react-table/vite.config.ts index 75af1b50ba..ee9316fbaa 100644 --- a/packages/react-table/vite.config.ts +++ b/packages/react-table/vite.config.ts @@ -10,7 +10,7 @@ const config = defineConfig({ dir: './tests', watch: false, environment: 'jsdom', - setupFiles: ['./tests/test-setup.ts'], + // setupFiles: ['./tests/test-setup.ts'], globals: true, }, }) diff --git a/packages/table-core/src/utils.ts b/packages/table-core/src/utils.ts index 05e17f56c2..91516edbb1 100755 --- a/packages/table-core/src/utils.ts +++ b/packages/table-core/src/utils.ts @@ -132,29 +132,32 @@ export function tableMemo, TDepArgs, TResult>({ let afterCompareTime: number let startCalcTime: number let endCalcTime: number - let isFirstRun = true + let runCount = 0 function logTime(time: number, depsChanged: boolean) { if (isDev) { - const runType = isFirstRun - ? '(1st run)' - : depsChanged - ? '(rerun)' - : '(cache)' - isFirstRun = false + const runType = + runCount === 0 + ? '(1st run)' + : depsChanged + ? '(rerun #' + runCount + ')' + : '(cache)' + runCount++ - console.info( - `%c⏱ ${pad(`${time.toFixed(time < 1 ? 2 : 1)} ms`, 12)} %c${runType}%c ${fnName}%c ${objectId ?? ''}`, + console.groupCollapsed( + `%c⏱ ${pad(`${time.toFixed(1)} ms`, 12)} %c${runType}%c ${fnName}%c ${objectId ? `(${fnName.split('.')[0]}Id: ${objectId})` : ''}`, `font-size: .6rem; font-weight: bold; ${ depsChanged ? `color: hsl( ${Math.max(0, Math.min(120 - Math.log10(time) * 60, 120))}deg 100% 31%);` : '' } `, - 'color: #FF69B4', - 'color: gray', + `color: ${runCount < 2 ? '#FF00FF' : '#FF1493'}`, + 'color: #666', 'color: #87CEEB', ) + console.trace() + console.groupEnd() } } @@ -169,7 +172,7 @@ export function tableMemo, TDepArgs, TResult>({ if (debugCache) { afterCompareTime = performance.now() const compareTime = - Math.round((afterCompareTime - beforeCompareTime) * 1000) / 1000 + Math.round((afterCompareTime - beforeCompareTime) * 100) / 100 if (!depsChanged) { logTime(compareTime, depsChanged) } @@ -184,7 +187,7 @@ export function tableMemo, TDepArgs, TResult>({ if (debug) { endCalcTime = performance.now() const executionTime = - Math.round((endCalcTime - startCalcTime) * 1000) / 1000 + Math.round((endCalcTime - startCalcTime) * 100) / 100 logTime(executionTime, true) } queueMicrotask(() => onAfterUpdate?.()) diff --git a/packages/vue-table/eslint.config.js b/packages/vue-table/eslint.config.js index 6a00c71f3f..e1b35e2964 100644 --- a/packages/vue-table/eslint.config.js +++ b/packages/vue-table/eslint.config.js @@ -1,6 +1,5 @@ // @ts-check -//@ts-expect-error import pluginVue from 'eslint-plugin-vue' import rootConfig from '../../eslint.config.js' diff --git a/tsconfig.json b/tsconfig.json index a7999981fe..c9b9a98fcb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,7 +24,7 @@ "target": "ES2020" }, "include": [ - "prettier.config.cjs", + "prettier.config.js", "scripts", "eslint.config.js", "vitest.workspace.js"