bpmnlint-intl
v1.0.2
Published
BPMN validation via configurable lint rules with multi-language support. (bpmnlint fork)
Downloads
310
Maintainers
Readme
bpmnlint-intl (bpmnlint fork)
Validate your BPMN diagrams based on configurable lint rules with multi-language support. No CLI included, ready for browser usage.
Installation
Install the utility via npm:
npm install bpmnlint-intlExample Usage
Create custom linter class with desired rules:
import {Linter, resolveConfig, setLocale, StaticResolver} from 'bpmnlint-intl';
import correctness from 'bpmnlint-intl/config/correctness';
import {configs} from 'bpmnlint-plugin-camunda-compat';
import historyTTLRule from 'bpmnlint-plugin-camunda-compat/rules/camunda-platform/history-time-to-live.js';
export default class CustomLinter {
constructor({locale = 'en'} = {}) {
setLocale(locale);
const cache = resolveConfig([correctness]);
cache['rule:bpmnlint/history-time-to-live'] = historyTTLRule;
const resolver = new StaticResolver(cache);
this.linter = new Linter({
resolver, config: {
rules: {
...correctness.rules,
...configs['camunda-platform-7-24'].rules
}
}
});
}
async lint(root) {
return this.linter.lint(root);
}
}Use it:
const linter = new CustomLinter({locale: 'ru'});
const {rootElement} = await modeler.get('moddle').fromXML(xml);
const reports = await this.linter.lint(rootElement);
console.log(reports);Rules
Our documentation lists all currenty implemented rules, the ./rules folder contains each rules implementation.
Do you miss a rule that should be included? Propose a new rule.
Locales
Available locales are listed in ./rules/locales folder
Add new locales to the ./rules/i18n.js file.
License
MIT
