π¦ ClawHub
Prettierrc Validator
by @charlie-morrison
Validate and lint Prettier configuration files (.prettierrc, .prettierrc.json, .prettierrc.yaml, .prettierrc.toml, package.json#prettier) for structure, inva...
TERMINAL
clawhub install prettierrc-validatorπ About This Skill
name: prettierrc-validator description: Validate and lint Prettier configuration files (.prettierrc, .prettierrc.json, .prettierrc.yaml, .prettierrc.toml, package.json#prettier) for structure, invalid options, deprecated fields, override conflicts, and best practices. 22 rules across 5 categories.
Prettier Config Validator
Validate .prettierrc config files for correctness, deprecated options, conflicting overrides, and best practices. Supports JSON, YAML, TOML, and package.json#prettier field. JS configs are detected but not statically validated.
Commands
# Full lint (all rules)
python3 scripts/prettierrc_validator.py lint .prettierrc.jsonCheck enum values, ranges, type conflicts only
python3 scripts/prettierrc_validator.py options .prettierrc.jsonCheck deprecated/removed options only
python3 scripts/prettierrc_validator.py deprecated .prettierrc.jsonValidate 'overrides' array only
python3 scripts/prettierrc_validator.py overrides .prettierrc.jsonValidate structure/syntax only
python3 scripts/prettierrc_validator.py validate .prettierrc.jsonJSON output (for CI / tooling)
python3 scripts/prettierrc_validator.py lint .prettierrc.json --format jsonSummary line only
python3 scripts/prettierrc_validator.py lint .prettierrc.json --format summary
Supported files
.prettierrc (JSON or YAML auto-detected).prettierrc.json / .prettierrc.json5.prettierrc.yaml / .prettierrc.yml.prettierrc.tomlpackage.json β validates the "prettier" field.prettierrc.js / prettier.config.js β detected but not validated staticallyRules (22)
Structure (5)
package.json with missing or invalid prettier fieldOptions (7)
printWidth out of reasonable range (< 20 or > 320)tabWidth invalid (0 or negative, > 16 warning)parser name not a known built-in parserrequirePragma + insertPragma both true (conflict)rangeStart > rangeEnd (inverted range)Deprecated (2)
jsxBracketSameLine β use bracketSameLine (Prettier 2.4+)useFlowParser, tabs) with replacement guidanceOverrides (5)
files fieldfiles empty array or wrong typeoptions (no effect)Best Practices (3)
endOfLine setting (cross-platform advice)trailingComma (default changed in Prettier v3)printWidth very short (< 40) β may cause awkward line breaksuseTabs: true without explicit tabWidthOutput Formats
Exit Codes
Requirements
PyYAML (better YAML parsing β falls back to a minimal parser for simple configs)tomli (only for Python 3.10 and below; Python 3.11+ has tomllib built in)Examples
Broken config
{ "printWidth": "100", "trailingComma": "some", "jsxBracketSameLine": true }
β ERROR wrong-type [printWidth] must be an integer
β ERROR invalid-enum-value [trailingComma] invalid value 'some' (valid: all, es5, none)
β WARNING deprecated-option [jsxBracketSameLine] use 'bracketSameLine'
Good CI gate
python3 scripts/prettierrc_validator.py lint .prettierrc.json --format summary
exit 1 on any error β fails the CI step
π‘ Examples
Broken config
{ "printWidth": "100", "trailingComma": "some", "jsxBracketSameLine": true }
β ERROR wrong-type [printWidth] must be an integer
β ERROR invalid-enum-value [trailingComma] invalid value 'some' (valid: all, es5, none)
β WARNING deprecated-option [jsxBracketSameLine] use 'bracketSameLine'
Good CI gate
python3 scripts/prettierrc_validator.py lint .prettierrc.json --format summary
exit 1 on any error β fails the CI step