bpmn-io / bpmnlint

Validate BPMN diagrams based on configurable lint rules.
MIT License
121 stars 36 forks source link

feat: resolve local package by name #64

Closed nikku closed 2 years ago

nikku commented 2 years ago

This PR ensures that rules implemented locally are also resolved locally within the package.

To do that we check for a local package.json. If it exists we use the package name to normalize required configs and rules.

Adjustment must be done both when resolving rules as well as when compiling the linter configuration.


Given this enhancements local rules can be safely referenced by name (of the package):

bpmnlint-plugin-foobar
-> index.js
-> .bpmnlintrc = { "extends": "plugins:foobar/recommended" }

How to try out:

git clone https://github.com/bpmn-io/bpmnlint-plugin-example
cd bpmnlint-plugin-example
echo '{ "extends": "plugin:example/recommended" }' > .bpmnlintrc
npx bpmnlint@bpmn-io/bpmnlint#local-package-resolution some-bpmn-diagram.bpmn