replicated-lint
raw JSON → 0.19.3 verified Fri May 01 auth: no javascript
YAML linting tools for Replicated application manifests. Current stable version 0.19.3, released irregularly. Validates Replicated YAML files for common mistakes and best practices. Ships TypeScript types. Supports custom rules via JSON/YAML files and CLI options for threshold, reporters (console, junit), and extra rule sets. Key differentiator: specialized for Replicated application schema rather than generic YAML linting. Provides position-aware results for easy debugging.
Common errors
error Error: Cannot find module 'replicated-lint' ↓
cause Package not installed or not in node_modules.
fix
Run 'npm install replicated-lint' or 'npm install -g replicated-lint' for CLI.
error TypeError: validate is not a function ↓
cause Importing incorrectly, e.g., using default import when validate is named export.
fix
Use 'import { validate } from 'replicated-lint' instead of default import.
error Validation failed: unexpected rule format in extraRules file ↓
cause Extra rules file is malformed YAML/JSON or not an array.
fix
Ensure extraRules file contains a YAML/JSON array of rule objects.
error Error: ENOENT: no such file or directory, open '...' ↓
cause File path to --extraRules or --infile is incorrect.
fix
Check that the file path exists and is correct.
Warnings
gotcha The validate function expects a string, but will silently coerce Buffer to string if passed. ↓
fix Always call .toString() on file contents before passing.
breaking In version 0.12.0, the CLI argument --infile was changed to -f and the positional argument was removed. ↓
fix Use -f or --infile instead of positional file path.
deprecated The programmatic API function 'lint' is deprecated in favor of 'validate'. ↓
fix Replace lint() calls with validate().
gotcha Custom rule files must be valid YAML/JSON with an array of rule objects, but errors in these files cause silent failure. ↓
fix Validate your extra rules file by running it through a YAML parser first.
gotcha The --extraRules option expects a file path relative to the current working directory, not the input file. ↓
fix Provide absolute paths or paths relative to CWD.
Install
npm install replicated-lint yarn add replicated-lint pnpm add replicated-lint Imports
- replicatedLint
import replicatedLint from 'replicated-lint' - validate
import { validate } from 'replicated-lint' - LintResult wrong
const LintResult = require('replicated-lint').LintResultcorrectimport type { LintResult } from 'replicated-lint'
Quickstart
import { validate } from 'replicated-lint';
import { readFileSync } from 'fs';
const yamlContent = readFileSync('my-app.yml', 'utf8');
const results = validate(yamlContent, {
threshold: 'error',
extraRules: [],
});
if (results.length > 0) {
console.log('Lint issues found:');
results.forEach(r => console.log(`${r.type}: ${r.message}`));
} else {
console.log('No issues found.');
}