diff --git a/.cursor/33-style.mdc b/.cursor/33-style.mdc index 3dca909..53b3a31 100644 --- a/.cursor/33-style.mdc +++ b/.cursor/33-style.mdc @@ -1,3 +1,42 @@ --- +description: Style rules for Hawk monorepo - always applied alwaysApply: true --- + +1. Write clean, readable code +2. Do not duplicate code blocks, reuse existing code if possible +3. Write simple yet straightforward comments to each logic block, function, class, propert, interface, constant, etc. +4. Always use block-style comments. Even for one liners. +6. Common types that are used across Garage / API / Workers / Catchers should be placed in [@hawk.so/types](../types) package. + +## Classes + +Do not create and export class instance in the same file where class is defined. +Create a separate file for the class instance and export it. + +Do not do like that: + +```typescript +export class MyClass { + constructor() { + // ... + } +} + +export const myClassInstance = new MyClass(); +``` + +Do like that: + +```typescript +export class MyClass { + constructor() { + // ... + } +} +``` + +## TypeScript + +- Do not cast types to `any` and `unknown`. +- Place private methods below public methods in classes. \ No newline at end of file diff --git a/.cursor/45-api-rules.mdc b/.cursor/45-api-rules.mdc new file mode 100644 index 0000000..22283b2 --- /dev/null +++ b/.cursor/45-api-rules.mdc @@ -0,0 +1,12 @@ +--- +alwaysApply: true +globs: ["api/**"] +--- + +- Для отладочных логов в консоль использовать метод `sgr` для цветного вывода важных данных. + +Пример: + +```ts +this.log('warn', 'SSO not enabled for workspace:', sgr(workspaceId, Effect.ForegroundCyan)); +``` \ No newline at end of file diff --git a/.cursor/55-garage.mdc b/.cursor/55-garage.mdc index 625e001..ff6f588 100644 --- a/.cursor/55-garage.mdc +++ b/.cursor/55-garage.mdc @@ -34,11 +34,6 @@ garage/ └── config/ # Configuration ``` -## Components - -- Vue 3 components (`.vue` files) -- Always use `