diff --git a/skills/engineering-principles/SKILL.md b/skills/engineering-principles/SKILL.md index 25e87cc..deef9bf 100644 --- a/skills/engineering-principles/SKILL.md +++ b/skills/engineering-principles/SKILL.md @@ -246,3 +246,40 @@ Skills harus trigger berdasarkan **konsep**, **konteks kode**, dan **file projec - **Behavioral pattern > keyword.** User bilang "kode ini jelek, rapihin" → trigger clean-code. User bilang "tambahin validasi" → trigger error-handling + security. - **Tanya kalau ragu.** Kalau konteks gak cukup buat nentuin skill mana, tanya 1 pertanyaan pendek. Jangan asumsi. - Hook `detect-project.sh` udah otomatis deteksi dari file project — ini jalur utama activation, bukan cuma keyword matching. + +## 28. Never Suppress Lints — Fix the Code + +Linter, type checker, dan analyzer ada untuk menangkap bug sebelum produksi. **Jangan pernah matiin mereka dengan `#[allow]`, `// @ts-ignore`, `# noqa`, atau `// eslint-disable-next-line`** — itu mengakali alat yang dibuat untuk melindungi kamu. + +### What to do instead: +- **Linter error** → perbaiki kodenya. Kalau kamu bisa suppress, kamu bisa fix. +- **`clippy::too_many_arguments`** → extract parameter struct. Jangan `#[allow]`. +- **`clippy::type_complexity`** → extract type alias. Jangan `#[allow]`. +- **`@ts-ignore` / `@ts-expect-error`** → perbaiki type-nya. TypeScript strict mode harusnya gak perlu ini. +- **`# noqa` (Python)** → perbaiki line length, import, atau kompleksitas. +- **`eslint-disable-next-line`** → perbaiki pelanggarannya. Kalau rule-nya salah, nonaktifkan global dengan alasan. + +### Satu-satunya pengecualian: +- **False positive dari linter** — tapi harus dibuktikan, bukan ditebak. Tambah komentar `// lint false positive: `. +- **Generated code** — kode hasil generate (protobuf, OpenAPI client) bisa di-exclude via config, bukan inline suppress. +- **Migration bertahap** — kalau codebase besar, suppress dulu di level project config, target hapus <30 hari. Bukan inline per-line yang numpuk. + +### Enforce in CI: +```bash +# Rust +cargo clippy -- -D warnings + +# TypeScript +tsc --noEmit --strict + +# Python +ruff check --strict + +# Go +go vet ./... + +# All +git commit --no-verify # only for emergencies, not routine +``` + +Lint yang di-skip adalah bug yang diundang. Kalau kamu bisa `#[allow]` itu, kamu juga bisa perbaiki itu. diff --git a/skills/rust/SKILL.md b/skills/rust/SKILL.md index 0fc62a8..6b3a45f 100644 --- a/skills/rust/SKILL.md +++ b/skills/rust/SKILL.md @@ -194,5 +194,6 @@ pub struct UserResponse { - ❌ `unsafe` without documented safety invariants - ❌ `Rc>` in async contexts — use `Arc>` - ❌ `Box` where generics work — `impl Trait` or generic param -- ❌ Ignoring clippy warnings — run `clippy` before every commit +- ❌ `#[allow(clippy::...)]` — never suppress warnings; fix the code instead. `too_many_arguments` means extract a struct. `type_complexity` means extract a type alias or refactor. +- ❌ Ignoring clippy warnings — run `clippy` before every commit. `cargo clippy -- -D warnings` in CI. - ❌ `#[tokio::main]` on library code — only in binary entry points