Validate Rollup config files (exported JSON or parsed config objects) for output format conflicts, external/bundle mismatches, plugin ordering issues, deprecated options, treeshake settings, and best practices. Supports text, JSON, and summary output formats with CI-friendly exit codes.
bash
# Full validation (all 22+ rules)
python3 scripts/rollup_config_validator.py validate rollup.config.json
# Quick syntax-only check (structure rules only)
python3 scripts/rollup_config_validator.py check rollup.config.json
# Explain config in human-readable form
python3 scripts/rollup_config_validator.py explain rollup.config.json
# Suggest improvements
python3 scripts/rollup_config_validator.py suggest rollup.config.json
# JSON output (CI-friendly)
python3 scripts/rollup_config_validator.py validate rollup.config.json --format json
# Summary only (pass/fail + counts)
python3 scripts/rollup_config_validator.py validate rollup.config.json --format summary
# Strict mode (warnings become errors)
python3 scripts/rollup_config_validator.py validate rollup.config.json --strict
Since Rollup configs are typically JavaScript, this tool validates JSON representations of Rollup config objects. Export your config as JSON or use a wrapper:
bash
# Extract config as JSON from rollup.config.js
node -e "const c = require('./rollup.config.js'); console.log(JSON.stringify(c, null, 2))" > rollup.config.json
python3 scripts/rollup_config_validator.py validate rollup.config.json
Or validate directly from a JSON config file.
#CategorySeverityRuleS1StructureErrorFile not found or unreadableS2StructureErrorEmpty config or no contentS3StructureWarningUnknown top-level config keysS4StructureErrorInvalid JSON syntaxS5StructureErrorMissing input entry pointO1OutputErrorMissing output configurationO2OutputWarningMissing output.format (defaults to 'es')O3OutputWarningoutput.file and output.dir both specifiedO4OutputWarningformat: 'iife' or 'umd' without output.nameO5OutputWarningMultiple outputs with same format and no distinct file/dirO6OutputWarningoutput.sourcemap: true without sourcemapExcludeSources considerationE1ExternalWarningBare module in external should match import patternE2ExternalWarningRegex pattern in external (fragile)E3ExternalWarningNode built-in not in external (path, fs, etc.)P1PluginsWarningPlugin ordering: resolve before commonjsP2PluginsWarningcommonjs plugin without @rollup/plugin-node-resolveP3PluginsWarningjson plugin missing (importing .json files)P4PluginsWarningDeprecated plugin (rollup-plugin-* → @rollup/plugin-*)T1TreeshakeWarningtreeshake: false disables dead code eliminationT2TreeshakeWarningmoduleSideEffects: false may break librariesB1Best PracticesWarningMissing preserveEntrySignatures for library buildsB2Best PracticesWarningLarge number of manual chunks without shared dependenciesB3Best PracticesWarningwatch mode config without clearScreen setting
text (default): Human-readable with 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