dmnlint

raw JSON →
0.2.0 verified Fri May 01 auth: no javascript

A configurable linter for DMN (Decision Model and Notation) diagrams that checks against a set of rules to ensure quality and consistency. Version 0.2.0 is the current stable release, with ongoing development on GitHub. It provides CLI usage and supports integration with dmn-js for visual feedback during modeling. Key differentiators: based on bpmnlint architecture, supports custom rules via plugins and configuration through .dmnlintrc files.

error Error: No such file or directory: .dmnlintrc
cause Missing configuration file at working directory.
fix
Create a .dmnlintrc file or use programmatic config.
error Error: Could not find rule: label-required
cause Rule name misspelled or not installed/loaded.
fix
Check rule name; ensure rules are available via extends or plugin.
error TypeError: Linter is not a constructor
cause Using import incorrectly (e.g., destructuring default import).
fix
Use: import Linter from 'dmnlint';
error SyntaxError: Unexpected token } in JSON at position 20
cause Invalid JSON in .dmnlintrc file.
fix
Fix JSON syntax with a linter or validator.
gotcha The linter expects valid DMN XML; any parse error will throw a synchronous exception before the async lint operation.
fix Wrap in try-catch for synchronous parsing errors.
gotcha Configuration file (.dmnlintrc) must be in JSON format; other formats are not supported.
fix Convert configuration to JSON.
gotcha Custom rules must be exported as a function that returns an object with rule definitions; see documentation.
fix Follow the plugin example structure.
deprecated Using 'require' with default import may lead to CommonJS/ESM interop issues.
fix Use import syntax or dynamic import() if needed.
npm install dmnlint
yarn add dmnlint
pnpm add dmnlint

Shows how to import and use dmnlint programmatically, including loading a DMN file, linting with default rules, and passing custom configuration.

import Linter from 'dmnlint';
import { readFileSync } from 'fs';

const dmnXml = readFileSync('invoice.dmn', 'utf-8');
const linter = new Linter();

// Simple usage with default rules
linter.lint(dmnXml).then(results => {
  console.log(JSON.stringify(results, null, 2));
});

// With configuration
const config = {
  extends: 'dmnlint:recommended',
  rules: {
    'label-required': 'off',
  },
};
linter.lint(dmnXml, config).then(results => {
  if (results.length > 0) {
    results.forEach(r => console.error(`${r.id} - ${r.message}`));
  }
});