From 585aa75525b0d670afe53039fa5c032fc15b3a12 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 10 Jan 2025 09:58:07 +0000 Subject: [PATCH] Remove ts-prune as it has been archived over a year ago (#28954) * Remove ts-prune as it has been archived over a year ago knip replaces it has better configuration Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update knip config Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .github/workflows/static_analysis.yaml | 6 ------ knip.ts | 13 ++++--------- package.json | 2 -- src/Lifecycle.ts | 1 - src/utils/arrays.ts | 2 -- 5 files changed, 4 insertions(+), 20 deletions(-) diff --git a/.github/workflows/static_analysis.yaml b/.github/workflows/static_analysis.yaml index b7c02c3f2e9..ee731b3ac38 100644 --- a/.github/workflows/static_analysis.yaml +++ b/.github/workflows/static_analysis.yaml @@ -132,9 +132,3 @@ jobs: - name: Run linter run: "yarn run lint:knip" - - - name: Install Deps - run: "scripts/layered.sh" - - - name: Dead Code Analysis - run: "yarn run analyse:unused-exports" diff --git a/knip.ts b/knip.ts index 247f9d97894..17ad531332a 100644 --- a/knip.ts +++ b/knip.ts @@ -10,13 +10,13 @@ export default { "playwright/**", "test/**", "res/decoder-ring/**", - ], - project: ["**/*.{js,ts,jsx,tsx}"], - ignore: [ - "docs/**", "res/jitsi_external_api.min.js", + "docs/**", // Used by jest "__mocks__/maplibre-gl.js", + ], + project: ["**/*.{js,ts,jsx,tsx}"], + ignore: [ // Keep for now "src/hooks/useLocalStorageState.ts", "src/components/views/elements/InfoTooltip.tsx", @@ -37,13 +37,8 @@ export default { // False positive "sw.js", // Used by webpack - "buffer", "process", "util", - // Used by workflows - "ts-prune", - // Required due to bug in bloom-filters https://github.com/Callidon/bloom-filters/issues/75 - "@types/seedrandom", ], ignoreBinaries: [ // Used in scripts & workflows diff --git a/package.json b/package.json index 7cda6fa5ace..2b65fa0834f 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,6 @@ "test:playwright:screenshots:build": "docker build playwright -t element-web-playwright", "test:playwright:screenshots:run": "docker run --rm --network host -e BASE_URL -e CI -v $(pwd):/work/ -v $(node -e 'console.log(require(`path`).dirname(require.resolve(`matrix-js-sdk/package.json`)))'):/work/node_modules/matrix-js-sdk -v /var/run/docker.sock:/var/run/docker.sock -v /tmp/:/tmp/ -it element-web-playwright --grep @screenshot --project=Chrome", "coverage": "yarn test --coverage", - "analyse:unused-exports": "ts-node ./scripts/analyse_unused_exports.ts", "analyse:webpack-bundles": "webpack-bundle-analyzer webpack-stats.json webapp", "update:jitsi": "curl -s https://meet.element.io/libs/external_api.min.js > ./res/jitsi_external_api.min.js" }, @@ -287,7 +286,6 @@ "terser-webpack-plugin": "^5.3.9", "testcontainers": "^10.16.0", "ts-node": "^10.9.1", - "ts-prune": "^0.10.3", "typescript": "5.7.2", "util": "^0.12.5", "web-streams-polyfill": "^4.0.0", diff --git a/src/Lifecycle.ts b/src/Lifecycle.ts index 2f6c460afed..cdb7d391151 100644 --- a/src/Lifecycle.ts +++ b/src/Lifecycle.ts @@ -110,7 +110,6 @@ dis.register((payload) => { let sessionLockStolen = false; // this is exposed solely for unit tests. -// ts-prune-ignore-next export function setSessionLockNotStolen(): void { sessionLockStolen = false; } diff --git a/src/utils/arrays.ts b/src/utils/arrays.ts index 25548ef78f0..b54e0949f21 100644 --- a/src/utils/arrays.ts +++ b/src/utils/arrays.ts @@ -49,7 +49,6 @@ export function arrayFastResample(input: number[], points: number): number[] { * @param {number} points The number of samples to end up with. * @returns {number[]} The resampled array. */ -// ts-prune-ignore-next export function arraySmoothingResample(input: number[], points: number): number[] { if (input.length === points) return input; // short-circuit a complicated call @@ -92,7 +91,6 @@ export function arraySmoothingResample(input: number[], points: number): number[ * @param {number} newMax The maximum value to scale to. * @returns {number[]} The rescaled array. */ -// ts-prune-ignore-next export function arrayRescale(input: number[], newMin: number, newMax: number): number[] { const min: number = Math.min(...input); const max: number = Math.max(...input);