-
Notifications
You must be signed in to change notification settings - Fork 2
add knip and improve cursor rules #23
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,4 +98,4 @@ jobs: | |
| run: pnpm install | ||
|
|
||
| - name: Run linter | ||
| run: pnpm lint | ||
| run: pnpm lint | ||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import type { RawConfigurationOrFn } from "knip/dist/types/config.js"; | ||
|
|
||
| const config: RawConfigurationOrFn = { | ||
| workspaces: { | ||
| ".": { | ||
| entry: ["caido.config.ts", "eslint.config.mjs"], | ||
| }, | ||
| "packages/backend": { | ||
| entry: ["src/index.ts"], | ||
| project: ["src/**/*.ts"], | ||
| ignoreDependencies: ["caido"], | ||
| }, | ||
| "packages/frontend": { | ||
| entry: ["src/index.ts"], | ||
| project: ["src/**/*.{ts,tsx,vue}"], | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default config; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import type { RawConfigurationOrFn } from "knip/dist/types/config.js"; | ||
|
|
||
| const config: RawConfigurationOrFn = { | ||
| workspaces: { | ||
| ".": { | ||
| entry: ["caido.config.ts", "eslint.config.mjs"], | ||
| }, | ||
| "packages/backend": { | ||
| entry: ["src/index.ts"], | ||
| project: ["src/**/*.ts"], | ||
| ignoreDependencies: ["caido"], | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default config; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,12 +5,15 @@ | |
| "scripts": { | ||
| "typecheck": "pnpm -r typecheck", | ||
| "lint": "eslint ./packages/**/src --fix", | ||
| "knip": "knip", | ||
| "build": "caido-dev build", | ||
| "watch": "caido-dev watch" | ||
| }, | ||
| "devDependencies": { | ||
| "@caido-community/dev": "^0.1.3", | ||
| "@caido/eslint-config": "^0.5.0", | ||
| "typescript": "5.5.4" | ||
| "eslint": "9.29.0", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question regarding eslint.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing here as in the last comment |
||
| "typescript": "5.5.4", | ||
| "knip": "5.70.2" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
| "build": "vite build" | ||
| }, | ||
| "devDependencies": { | ||
| "@caido/sdk-backend": "^0.46.0" | ||
| "@caido/sdk-backend": "^0.46.0", | ||
| "vite": "6.0.11" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you know why we need to add vite? Has the templates always been broken before?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this because Knip would return this warning without the vite dep |
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| --- | ||
| globs: | ||
| alwaysApply: true | ||
| description: Code Quality Best Practices | ||
| --- | ||
|
|
||
| ## TypeScript and Code Quality | ||
|
|
||
| - Use TypeScript for all files. | ||
| - Only use types, not interfaces. | ||
| - Do not use `any` type. | ||
| - Use `undefined` over `null`. | ||
| - Do not add any comments to the code that you generate. | ||
| - Don’t cast to `any`. | ||
| - Don’t unnecessarily add `try`/`catch`. | ||
| - Use `computed` for derived state instead of reactive variables when possible. | ||
| - Use `knip` to remove unused code if making large changes. | ||
| - When refactoring, avoid creating alias types like this: | ||
| ``` | ||
| export type Options = ScanConfig; | ||
| ``` | ||
| Instead, actually rename the type and fix all occurrences if needed. | ||
|
|
||
| ## Structure, Naming, and Organization | ||
|
|
||
| - Follow consistent naming conventions: | ||
| - Folders: camelCase (`intercept`, `replay`, `httpHistory`). | ||
| - Component folders: PascalCase (`PassiveFormCreate`, `PassiveTable`). | ||
| - All other files: camelCase (`useForm.ts`, `assistant.graphql`). | ||
| - Avoid massive template blocks; compose smaller components. | ||
| - Colocate code that changes together. | ||
| - Declare variables close to their usage: | ||
| - Avoid declaring all variables at the top of functions/files. | ||
| - Place variable declarations as close as possible to where they are first used. | ||
| - Group related variables together (e.g., event bus declarations next to their corresponding listeners). | ||
|
|
||
| ## Simplicity and Readability | ||
|
|
||
| - Only create an abstraction if it is actually needed. | ||
| - Prefer clear function and variable names over inline comments. | ||
| - Avoid helper functions when a simple inline expression would suffice. | ||
| - Use built-in Tailwind values, occasionally allow dynamic values, rarely globals. |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question regarding eslint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar thing here, added this because Knip would return this warning without it