Validate babel.config.json, .babelrc, .babelrc.json, and package.json#babel for deprecated presets/plugins, conflicting transforms, ordering issues, and best practices. Supports text, JSON, and summary output formats with CI-friendly exit codes.
bash
# Full validation (all 24+ rules)
python3 scripts/babel_config_validator.py validate babel.config.json
# Quick syntax-only check (structure rules only)
python3 scripts/babel_config_validator.py check .babelrc
# Explain config in human-readable form
python3 scripts/babel_config_validator.py explain babel.config.json
# Suggest improvements
python3 scripts/babel_config_validator.py suggest package.json
# JSON output (CI-friendly)
python3 scripts/babel_config_validator.py validate .babelrc --format json
# Summary only (pass/fail + counts)
python3 scripts/babel_config_validator.py validate .babelrc --format summary
# Strict mode (warnings become errors)
python3 scripts/babel_config_validator.py validate .babelrc --strict
#CategorySeverityRuleS1StructureErrorFile not found or unreadableS2StructureErrorEmpty config or no contentS3StructureWarningBoth babel.config and .babelrc present (conflict)S4StructureWarningUnknown top-level config keysS5StructureErrorInvalid JSON syntaxP1PresetsErrorDeprecated preset (es2015, es2016, es2017, latest, stage-*)P2PresetsWarningPreset ordering matters (@babel/preset-typescript before @babel/preset-env)P3PresetsWarningDuplicate presetsP4PresetsErrorUnknown/misspelled preset nameP5PresetsWarningMissing @babel/preset-env (most configs need it)L1PluginsErrorDeprecated plugin (@babel/plugin-proposal-* → built-in)L2PluginsWarningDuplicate pluginsL3PluginsWarningPlugin ordering conflict (decorators before class-properties)L4PluginsWarningConflicting plugins (transform-runtime + external-helpers)L5PluginsWarningPlugin without @babel/ scope (may be community or typo)M1ModulesWarningmodules: false in preset-env without bundler contextM2ModulesWarningsourceType mismatch with modules settingM3ModulesWarningConflicting module transformsE1Env/OverridesWarningEmpty env config sectionE2Env/OverridesWarningOverride without test patternE3Env/OverridesWarningUnknown env name (not development/production/test)B1Best PracticesWarningloose mode inconsistency across pluginsB2Best PracticesWarningMissing targets/browserslist (unoptimized output)B3Best PracticesWarninguseBuiltIns without corejs versionB4Best PracticesWarningcorejs version outdated (< 3)
text (default): Human-readable with colors and severity iconsjson: Machine-parseable JSON array of findingssummary: Pass/fail with error/warning counts0: No errors (warnings only or clean)1: One or more errors found2: File not found or invalid input