ramllint

raw JSON →
1.2.6 verified Fri May 01 auth: no javascript maintenance

A static analysis linter for RAML API specifications, enforcing style and consistency rules across API documentation. Version 1.2.6 is the latest stable release, built for Node.js >=0.12.3. It provides both a library and CLI interface to validate RAML files against configurable rules for URLs, naming conventions, and structure. Unlike generic YAML validators, ramllint focuses on RAML-specific patterns and integrates with CI pipelines. The package appears to be in maintenance mode with no recent updates.

error TypeError: Class constructor Linter cannot be invoked without 'new'
cause Calling `Linter()` without `new` in ES6 classes (but the package uses ES5 function constructor; still requires `new`).
fix
Use new Linter() instead of Linter().
error Error: Cannot find module 'ramllint'
cause Package not installed or global install not resolved.
fix
Run npm install ramllint --save or npm install -g ramllint.
gotcha The `lint` callback only returns `error` level results; warning and info entries are excluded.
fix Use `linter.results()` to get all log entries after calling `lint`.
gotcha The `require('ramllint')` returns the Linter constructor, not an instance. Forgetting `new` will cause errors.
fix Always instantiate with `new Linter()`.
npm install ramllint
yarn add ramllint
pnpm add ramllint

Shows how to instantiate the linter and lint a RAML file with the callback API.

var Linter = require('ramllint');
var linter = new Linter();
linter.lint('./api.raml', function (results) {
  if (results.length === 0) {
    console.log('No errors found.');
  } else {
    console.log('Errors:', results);
  }
});