{"id":26393,"library":"sirenlint","title":"sirenlint","description":"A lint tool for validating Siren hypermedia documents against the Siren specification (sirenspec.org). Version 0.5.0 is the latest stable release, but the project appears to be in maintenance mode with infrequent updates. It provides both a CLI for piping/reading Siren JSON files and a programmatic API. Key differentiators: focused solely on Siren validation (no generic JSON/HAL/Collection+JSON support), outputs structured error/warning objects with JSON path information. Alternatives include custom Siren validators or generic JSON schema validators.","status":"maintenance","version":"0.5.0","language":"javascript","source_language":"en","source_url":"https://github.com/kevinswiber/sirenlint","tags":["javascript","siren","lint","validate"],"install":[{"cmd":"npm install sirenlint","lang":"bash","label":"npm"},{"cmd":"yarn add sirenlint","lang":"bash","label":"yarn"},{"cmd":"pnpm add sirenlint","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"CLI argument parsing","package":"nomnom","optional":false}],"imports":[{"note":"Package uses CommonJS (require) and has no default export for ESM import. Use require or dynamic import().","wrong":"import validate from 'sirenlint';","symbol":"validate","correct":"const validate = require('sirenlint');"},{"note":"ESM import does not work directly; must use destructuring from require.","wrong":"import { ValidationError } from 'sirenlint';","symbol":"ValidationError","correct":"const { ValidationError } = require('sirenlint');"},{"note":"Same as ValidationError; no ESM support.","wrong":"import { ValidationWarning } from 'sirenlint';","symbol":"ValidationWarning","correct":"const { ValidationWarning } = require('sirenlint');"}],"quickstart":{"code":"const fs = require('fs');\nconst validate = require('sirenlint');\n\nconst sirenJson = `{ \"class\": [\"order\"], \"properties\": { \"orderNumber\": 42 }, \"entities\": [], \"links\": [] }`;\nconst results = validate(sirenJson);\n\nresults.forEach(r => {\n  if (r instanceof validate.ValidationError) {\n    console.error('ERROR:', r.path, r.message);\n  } else if (r instanceof validate.ValidationWarning) {\n    console.warn('WARNING:', r.path, r.message);\n  }\n});","lang":"javascript","description":"Demonstrates programmatic validation of a Siren document, iterating over errors and warnings."},"warnings":[{"fix":"Always pass JSON string (e.g., JSON.stringify(yourObject)) to validate().","message":"Input must be a string, not a parsed object. If you pass an object, validation may fail or produce unexpected results.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Check output string for error count or parse the result programmatically; consider using library API for error handling.","message":"CLI always outputs to stdout regardless of errors; exit code is always 0 even with warnings/errors.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use library API instead of CLI, or fork and replace nomnom with a modern alternative like yargs.","message":"Package uses nomnom for CLI parsing; nomnom is deprecated and may have security issues.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Accept the default validation set or use an alternative validator that supports rule customization.","message":"Validation rules are hardcoded and not configurable; no way to suppress specific warnings or add custom rules.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use const validate = require('sirenlint'); instead of import.","cause":"Using import or expecting a default export; sirenlint is a function via require, not a named export.","error":"TypeError: sirenlint is not a function"},{"fix":"Run npm install sirenlint --save-dev (local) or npm install -g sirenlint (global).","cause":"Package not installed globally or locally; or using global CLI without installation.","error":"Cannot find module 'sirenlint'"},{"fix":"Ensure input is a valid JSON string before calling validate().","cause":"Passing undefined or null to validate().","error":"undefined is not a valid Siren JSON"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}