Skip to content

chore: setup knip and remove unused exports, files, and dependencies #17608

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a75993a
chore: add knip as dev dep and create config
brettkolodny Apr 29, 2025
d947dc7
chore: update knip config to ignore exported types and interfaces
brettkolodny Apr 29, 2025
a23554c
chore: add unused imports to biome config
brettkolodny Apr 29, 2025
cf48a1b
chore: remove unused imports
brettkolodny Apr 29, 2025
1e2abbf
chore: remove unused exports
brettkolodny Apr 29, 2025
acb2dd3
chore: remove unused exports
brettkolodny Apr 29, 2025
952015b
chore: remove unused exports
brettkolodny Apr 29, 2025
fd1b1a6
chore: remove unused exports
brettkolodny Apr 29, 2025
f45a9c2
chore: remove duplicate exports
brettkolodny Apr 29, 2025
7b66bb4
chore: remove duplicate exports
brettkolodny Apr 29, 2025
4388699
chore: remove duplicate exports
brettkolodny Apr 29, 2025
85e845b
chore: remove unused dependencies
brettkolodny Apr 29, 2025
195a7e6
chore: remove unused script
brettkolodny Apr 29, 2025
28b3394
chore: update knip config to ignore protoc binary
brettkolodny Apr 29, 2025
c0ceb87
chore: remove unused files
brettkolodny Apr 29, 2025
e8b672e
chore: remove unused dev dependencies
brettkolodny Apr 29, 2025
662d812
chore: remove unused dev dependencies
brettkolodny Apr 29, 2025
e50ca41
chore: remove unused dev dependencies
brettkolodny Apr 29, 2025
2619b00
chore: remove unused dev dependencies
brettkolodny Apr 29, 2025
25ccd6c
Merge branch 'main' into brett-i600/add-knip-to-coder-coder-and-remov…
brettkolodny Apr 29, 2025
3c097a4
fix: re-add ts-proto as a dev dep
brettkolodny Apr 29, 2025
db6c7b5
Merge branch 'main' into brett-i600/add-knip-to-coder-coder-and-remov…
brettkolodny Apr 30, 2025
501187e
chore: move serviceWorker.ts to knip entry
brettkolodny Apr 30, 2025
b51d7f8
chore: add e2e files as knip project
brettkolodny Apr 30, 2025
c509697
chore: remove unused exports
brettkolodny Apr 30, 2025
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
17 changes: 17 additions & 0 deletions site/.knip.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://unpkg.com/knip@5/schema.json",
"entry": ["./src/index.tsx", "./src/serviceWorker.ts"],
"project": ["./src/**/*.ts", "./src/**/*.tsx", "./e2e/**/*.ts"],
"ignore": ["**/*Generated.ts"],
"ignoreBinaries": ["protoc"],
"ignoreDependencies": [
"@types/react-virtualized-auto-sizer",
"jest_workaround",
"ts-proto"
],
// Don't report unused exports of types as long as they are used within the file.
"ignoreExportsUsedInFile": {
"interface": true,
"type": true
}
}
3 changes: 3 additions & 0 deletions site/biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"useButtonType": { "level": "off" },
"useSemanticElements": { "level": "off" }
},
"correctness": {
"noUnusedImports": "warn"
},
"style": {
"noNonNullAssertion": { "level": "off" },
"noParameterAssign": { "level": "off" },
Expand Down
8 changes: 0 additions & 8 deletions site/e2e/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,6 @@ export const premiumTestsRequired = Boolean(

export const license = process.env.CODER_E2E_LICENSE ?? "";

/**
* Certain parts of the UI change when organizations are enabled. Organizations
* are enabled by a license entitlement, and license configuration is guaranteed
* to run before any other tests, so having this as a bit of "global state" is
* fine.
*/
export const organizationsEnabled = Boolean(license);

// Disabling terraform tests is optional for environments without Docker + Terraform.
// By default, we opt into these tests.
export const requireTerraformTests = !process.env.CODER_E2E_DISABLE_TERRAFORM;
Expand Down
4 changes: 2 additions & 2 deletions site/e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export async function login(page: Page, options: LoginOptions = users.owner) {
(ctx as any)[Symbol.for("currentUser")] = options;
}

export function currentUser(page: Page): LoginOptions {
function currentUser(page: Page): LoginOptions {
const ctx = page.context();
// biome-ignore lint/suspicious/noExplicitAny: get the current user
const user = (ctx as any)[Symbol.for("currentUser")];
Expand Down Expand Up @@ -875,7 +875,7 @@ export const echoResponsesWithExternalAuth = (
};
};

export const fillParameters = async (
const fillParameters = async (
page: Page,
richParameters: RichParameter[] = [],
buildParameters: WorkspaceBuildParameter[] = [],
Expand Down
1 change: 0 additions & 1 deletion site/e2e/tests/deployment/idpOrgSync.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
deleteOrganization,
setupApiCalls,
} from "../../api";
import { users } from "../../constants";
import { login, randomName, requiresLicense } from "../../helpers";
import { beforeCoderTest } from "../../hooks";

Expand Down
2 changes: 1 addition & 1 deletion site/e2e/tests/organizations/auditLogs.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Page, expect, test } from "@playwright/test";
import { expect, test } from "@playwright/test";
import {
createOrganization,
createOrganizationMember,
Expand Down
14 changes: 4 additions & 10 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
"dev": "vite",
"format": "biome format --write .",
"format:check": "biome format .",
"lint": "pnpm run lint:check && pnpm run lint:types && pnpm run lint:circular-deps",
"lint": "pnpm run lint:check && pnpm run lint:types && pnpm run lint:circular-deps && knip",
"lint:check": " biome lint --error-on-warnings .",
"lint:circular-deps": "dpdm --no-tree --no-warning -T ./src/App.tsx",
"lint:fix": " biome lint --error-on-warnings --write .",
"lint:knip": "knip",
"lint:fix": " biome lint --error-on-warnings --write . && knip --fix",
"lint:types": "tsc -p .",
"playwright:install": "playwright install --with-deps chromium",
"playwright:test": "playwright test --config=e2e/playwright.config.ts",
Expand All @@ -29,7 +30,6 @@
"test:ci": "jest --selectProjects test --silent",
"test:coverage": "jest --selectProjects test --collectCoverage",
"test:watch": "jest --selectProjects test --watch",
"test:storybook": "test-storybook",
"stats": "STATS=true pnpm build && npx http-server ./stats -p 8081 -c-1",
"deadcode": "ts-prune | grep -v \".stories\\|.config\\|e2e\\|__mocks__\\|used in module\\|testHelpers\\|typesGenerated\" || echo \"No deadcode found.\"",
"update-emojis": "cp -rf ./node_modules/emoji-datasource-apple/img/apple/64/* ./static/emojis"
Expand Down Expand Up @@ -68,7 +68,6 @@
"@radix-ui/react-slot": "1.1.1",
"@radix-ui/react-switch": "1.1.1",
"@radix-ui/react-tooltip": "1.1.7",
"@radix-ui/react-visually-hidden": "1.1.0",
"@tanstack/react-query-devtools": "4.35.3",
"@xterm/addon-canvas": "0.7.0",
"@xterm/addon-fit": "0.10.0",
Expand All @@ -78,10 +77,8 @@
"@xterm/xterm": "5.5.0",
"ansi-to-html": "0.7.2",
"axios": "1.8.2",
"canvas": "3.1.0",
"chart.js": "4.4.0",
"chartjs-adapter-date-fns": "3.0.0",
"chartjs-plugin-annotation": "3.0.1",
"chroma-js": "2.4.2",
"class-variance-authority": "0.7.1",
"clsx": "2.1.1",
Expand All @@ -91,7 +88,6 @@
"cronstrue": "2.50.0",
"date-fns": "2.30.0",
"dayjs": "1.11.13",
"emoji-datasource-apple": "15.1.2",
"emoji-mart": "5.6.0",
"file-saver": "2.0.5",
"formik": "2.4.6",
Expand Down Expand Up @@ -149,7 +145,6 @@
"@tailwindcss/typography": "0.5.16",
"@testing-library/jest-dom": "6.6.3",
"@testing-library/react": "14.3.1",
"@testing-library/react-hooks": "8.0.1",
"@testing-library/user-event": "14.6.1",
"@types/chroma-js": "2.4.0",
"@types/color-convert": "2.0.4",
Expand Down Expand Up @@ -181,16 +176,15 @@
"jest-location-mock": "2.0.0",
"jest-websocket-mock": "2.5.0",
"jest_workaround": "0.1.14",
"knip": "5.51.0",
"msw": "2.4.8",
"postcss": "8.5.1",
"protobufjs": "7.4.0",
"rxjs": "7.8.1",
"ssh2": "1.16.0",
"storybook": "8.5.3",
"storybook-addon-remix-react-router": "3.1.0",
"storybook-react-context": "0.7.0",
"tailwindcss": "3.4.17",
"ts-node": "10.9.2",
"ts-proto": "1.164.0",
"ts-prune": "0.10.3",
"typescript": "5.6.3",
Expand Down
Loading
Loading