Awesome-omni-skill code_formatter
Otomatik kod formatlama, Prettier/ESLint entegrasyonu ve kod stil tutarlılığı rehberi.
install
source · Clone the upstream repo
git clone https://github.com/diegosouzapw/awesome-omni-skill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/diegosouzapw/awesome-omni-skill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/development/code_formatter" ~/.claude/skills/diegosouzapw-awesome-omni-skill-code-formatter && rm -rf "$T"
manifest:
skills/development/code_formatter/SKILL.mdsource content
🎨 Code Formatter
Otomatik kod formatlama ve stil tutarlılığı rehberi.
📋 Prettier Yapılandırması
.prettierrc
{ "semi": true, "singleQuote": true, "tabWidth": 2, "trailingComma": "es5", "printWidth": 80, "bracketSpacing": true, "arrowParens": "avoid", "endOfLine": "lf" }
Komutlar
# Format single file npx prettier --write src/file.ts # Format all files npx prettier --write "src/**/*.{ts,tsx,js,jsx,json,css,md}" # Check without writing npx prettier --check "src/**/*"
🔧 ESLint Entegrasyonu
.eslintrc.js
module.exports = { extends: [ 'eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:react/recommended', 'prettier', // Prettier çakışmalarını devre dışı bırakır ], plugins: ['@typescript-eslint', 'react'], rules: { 'no-console': 'warn', 'no-unused-vars': 'error', }, };
Komutlar
# Lint npx eslint src/ # Lint and fix npx eslint src/ --fix # Specific files npx eslint "src/**/*.{ts,tsx}"
🔄 Git Hooks (Husky + lint-staged)
package.json
{ "lint-staged": { "*.{ts,tsx,js,jsx}": [ "eslint --fix", "prettier --write" ], "*.{json,css,md}": [ "prettier --write" ] } }
Setup
npx husky-init && npm install npx husky add .husky/pre-commit "npx lint-staged"
📁 Ignore Files
.prettierignore
node_modules/ dist/ build/ .next/ coverage/ *.min.js
.eslintignore
node_modules/ dist/ build/ *.config.js
Code Formatter v1.1 - Enhanced
🔄 Workflow
Kaynak: Prettier Docs
Aşama 1: Installation
- Packages:
,prettier
ve ilgili pluginleri kur.eslint - Config:
ve.prettierrc
dosyalarını kök dizine ekle..eslintrc - Ignore:
dosyasına.prettierignore
,build/
ekle.dist/
Aşama 2: Automation
- Scripts:
içinepackage.json
veformat
scriptlerini ekle.lint - VS Code:
ile "Format on Save" aç..vscode/settings.json - Hooks: Husky ve lint-staged ile commit öncesi kontrol ekle.
Aşama 3: CI Integration
- Pipeline: CI sürecine
venpm run lint
adımlarını ekle.prettier --check
Kontrol Noktaları
| Aşama | Doğrulama |
|---|---|
| 1 | çalışınca dosyalar değişiyor mu? |
| 2 | Hatalı bir kod commit edilmeye çalışıldığında Husky engelliyor mu? |
| 3 | CI pipeline format hatası olduğunda fail ediyor mu? |