mirkosertic/Megahub / .claude/skills/linting
linting
VerifiedCode formatting and linting context for the Megahub project. Use when writing or reviewing code in C++ or JavaScript, or when running format/lint checks. Describes tool commands, style conventions, and when to apply them.
Linting & Formatting — Megahub
Tools
| Layer | Tool | Config file | Purpose |
|---|---|---|---|
| C++ | clang-format | /.clang-format | Code formatting |
| C++ | cppcheck | — (run manually) | Static analysis |
| JS/CSS | Prettier | /frontend/prettier.config.js | Code formatting |
| JS | ESLint v9 | /frontend/eslint.config.js | Bug detection |
| Pre-commit | lefthook | /lefthook.yml | Runs all checks on staged files |
Running Tools
JavaScript (run from frontend/)
npm run lint # ESLint check (errors and warnings)
npm run lint:fix # ESLint auto-fix where possible
npm run format # Prettier — write formatted output
npm run format:check # Prettier — check only (no writes)
C++ (run from project root)
# Format a single file in-place
clang-format -i lib/megahub/src/megahub.cpp
# Check all lib and src files without modifying
find lib src -name "*.cpp" -o -name "*.h" | xargs clang-format --dry-run --Werror
# Static analysis
cppcheck --enable=warning,performance,portability \
--suppress=missingInclude \
--suppress=unusedFunction \
--suppress=ctuOneDefinitionRuleViolation \
--inline-suppr \
--error-exitcode=1 \
--quiet \
lib/btremote lib/commands lib/configuration lib/hubwebserver \
lib/i2csync lib/imu lib/inputdevices lib/logging lib/lpfuart \
lib/megahub lib/portstatus lib/statusmonitor \
src/
When to Apply
- After writing any JS code: run
npm run formatthennpm run lintfromfrontend/ - After writing any C++ code: run
clang-format -ion the modified files - The pre-commit hook runs automatically on staged files if lefthook is installed
Pre-commit Hook Setup (one-time)
brew install lefthook # macOS
lefthook install # registers the git hooks
After this, every git commit automatically checks:
- C++ staged files → clang-format (fails if unformatted)
- JS staged files → ESLint (fails on errors)
- JS/CSS staged files → Prettier (fails if unformatted)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |