Skip to content

Commit

Permalink
feat: add modeler config to rules
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme committed Nov 20, 2023
1 parent db575bc commit a86d712
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions lib/Linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ export class Linter {
};
}

config.rules = addConfig(config.rules, {
modeler: this._modeler
});

const ConfigResolver = new StaticResolver({
[ `config:bpmnlint-plugin-camunda-compat/${ configName }` ]: config
});
Expand All @@ -171,4 +175,24 @@ function getConfigName(executionPlatform, executionPlatformVersion) {

function toLowerCase(string) {
return string.toLowerCase();
}

function addConfig(rules, configToAdd) {
let rulesWithConfig = {};

for (let name in rules) {
let type, config;

if (Array.isArray(rules[ name ])) {
type = rules[ name ][0];
config = rules[ name ][1] || {};
} else {
type = rules[ name ];
config = {};
}

rulesWithConfig[ name ] = [ type, { ...config, ...configToAdd } ];
}

return rulesWithConfig;
}

0 comments on commit a86d712

Please sign in to comment.