Rome is a toolchain for the web: formatter, linter and more for JavaScript, TypeScript, JSON, HTML, Markdown, and CSS
—
Rome's CI command provides combined formatting and linting checks optimized for continuous integration environments. It performs both format checking and linting in a single command, making it ideal for build pipelines and automated quality gates.
The comprehensive CI command that runs both formatter and linter checks.
/**
* Run the linter and formatter check on a set of files
*
* Usage: rome ci [OPTIONS] <INPUTS...>
*
* INPUTS can be one or more filesystem paths, each pointing to a single file
* or an entire directory to be searched recursively for supported files
*/
rome ci <INPUTS...>Core Options:
--formatter-enabled # Allow to enable or disable the formatter check (default: true)
--linter-enabled # Allow to enable or disable the linter check (default: true)
--max-diagnostics <number> # Cap the amount of diagnostics displayed (default: 50)
--verbose # Print additional verbose advice on diagnosticsAll formatting options are also available (see Formatting for complete list):
--indent-style <tabs|space> # Change indentation character (default: tabs)
--indent-size <number> # Spaces for indentation when using space style (default: 2)
--line-width <number> # Maximum characters per line (default: 80)
--quote-style <single|double> # Quotation character for strings (default: double)
--quote-properties <as-needed|preserve> # When properties should be quoted (default: as-needed)
--trailing-comma <all|es5|none> # Trailing commas in multi-line structures (default: all)
--semicolons <always|as-needed> # When to print semicolons (default: always)Selectively enable or disable parts of the CI check:
# Run only formatter check
rome ci src/ --linter-enabled=false
# Run only linter check
rome ci src/ --formatter-enabled=false
# Run both (default behavior)
rome ci src/# Standard CI check with both formatter and linter
rome ci src/
# Check specific files
rome ci src/index.js src/utils.ts
# Check with custom formatting rules
rome ci src/ --indent-style=space --line-width=120
# Verbose output for debugging
rome ci src/ --verbose# Only check formatting (skip linting)
rome ci src/ --linter-enabled=false
# Only check linting (skip formatting)
rome ci src/ --formatter-enabled=false
# Custom diagnostic limits for CI logs
rome ci src/ --max-diagnostics=20# GitHub Actions example
- name: Run Rome CI
run: rome ci src/
# With custom settings
- name: Run Rome CI with custom rules
run: rome ci src/ --line-width=100 --max-diagnostics=30CI behavior can be configured in rome.json:
{
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentSize": 2,
"lineWidth": 100
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"files": {
"ignore": [
"dist/**",
"build/**",
"node_modules/**"
]
}
}The CI command is optimized for build environments:
--max-diagnostics <number> # Cap diagnostics to prevent log overflow (default: 50)
--verbose # Enable detailed diagnostic output when neededThe CI command uses standard exit codes for integration:
0: All checks passed1: Formatting or linting issues found2: Configuration or runtime errorname: Code Quality
on: [push, pull_request]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: npm ci
- run: rome ci src/code_quality:
stage: test
script:
- npm ci
- rome ci src/
only:
- merge_requests
- mainpipeline {
agent any
stages {
stage('Code Quality') {
steps {
sh 'npm ci'
sh 'rome ci src/'
}
}
}
}steps:
- task: NodeTool@0
inputs:
versionSpec: '18'
- script: npm ci
- script: rome ci src/
displayName: 'Run Rome CI'Standard terminal output with colors and formatting:
rome ci src/Structured output for tooling integration:
rome ci src/ --jsonJSON output includes:
# Fail build on any issues
rome ci src/ || exit 1
# Allow warnings but fail on errors (requires configuration)
rome ci src/
# Generate reports for analysis
rome ci src/ --json > rome-report.json# Limit file size to avoid processing large generated files
rome ci src/ --files-max-size=1048576
# Use file ignoring for performance
# Configure in rome.json:
{
"files": {
"ignore": ["**/*.min.js", "dist/**", "coverage/**"]
}
}Rome automatically uses multiple CPU cores for processing, but you can influence performance:
--use-server for repeated runsFor memory-constrained environments:
# Process smaller batches
rome ci src/components/
rome ci src/utils/
rome ci src/pages/
# Use daemon mode to amortize startup costs
rome start
rome ci src/ --use-server
rome stopInstall with Tessl CLI
npx tessl i tessl/npm-rome