@camunda/linting 3.10.0 → 3.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Linter.js CHANGED
@@ -20,6 +20,8 @@ import { toSemverMinor } from './utils/version';
20
20
 
21
21
  import { getDocumentationUrl } from './utils/documentation';
22
22
 
23
+ const NoopResolver = new StaticResolver({});
24
+
23
25
  /**
24
26
  * @param {Object} [options]
25
27
  * @param {string} [options.modeler='desktop']
@@ -113,7 +115,7 @@ export class Linter {
113
115
  {
114
116
  extends: `plugin:bpmnlint-plugin-camunda-compat/${ configName }`
115
117
  },
116
- ...this._plugins.map(({ config }) => config)
118
+ ...this._plugins.map(({ config = {} }) => config)
117
119
  ];
118
120
 
119
121
  return configs.reduce(
@@ -150,6 +152,10 @@ export class Linter {
150
152
  };
151
153
  }
152
154
 
155
+ config.rules = addConfig(config.rules, {
156
+ modeler: this._modeler
157
+ });
158
+
153
159
  const ConfigResolver = new StaticResolver({
154
160
  [ `config:bpmnlint-plugin-camunda-compat/${ configName }` ]: config
155
161
  });
@@ -157,7 +163,7 @@ export class Linter {
157
163
  return new Resolver([
158
164
  ConfigResolver,
159
165
  RulesResolver,
160
- ...this._plugins.map(({ resolver }) => resolver)
166
+ ...this._plugins.map(({ resolver = NoopResolver }) => resolver)
161
167
  ]);
162
168
  }
163
169
  }
@@ -171,4 +177,24 @@ function getConfigName(executionPlatform, executionPlatformVersion) {
171
177
 
172
178
  function toLowerCase(string) {
173
179
  return string.toLowerCase();
180
+ }
181
+
182
+ function addConfig(rules, configToAdd) {
183
+ let rulesWithConfig = {};
184
+
185
+ for (let name in rules) {
186
+ let type, config;
187
+
188
+ if (Array.isArray(rules[ name ])) {
189
+ type = rules[ name ][0];
190
+ config = rules[ name ][1] || {};
191
+ } else {
192
+ type = rules[ name ];
193
+ config = {};
194
+ }
195
+
196
+ rulesWithConfig[ name ] = [ type, { ...config, ...configToAdd } ];
197
+ }
198
+
199
+ return rulesWithConfig;
174
200
  }
@@ -57,7 +57,7 @@ const rules = {
57
57
  "camunda-compat/secrets": "error",
58
58
  "camunda-compat/sequence-flow-condition": "error",
59
59
  "camunda-compat/signal-reference": "error",
60
- "camunda-compat/start-form": "error",
60
+ "camunda-compat/start-event-form": "error",
61
61
  "camunda-compat/subscription": "error",
62
62
  "camunda-compat/task-schedule": "error",
63
63
  "camunda-compat/timer": "error",
@@ -189,9 +189,9 @@ import rule_27 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/signal-r
189
189
 
190
190
  cache['bpmnlint-plugin-camunda-compat/signal-reference'] = rule_27;
191
191
 
192
- import rule_28 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/start-form';
192
+ import rule_28 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/start-event-form';
193
193
 
194
- cache['bpmnlint-plugin-camunda-compat/start-form'] = rule_28;
194
+ cache['bpmnlint-plugin-camunda-compat/start-event-form'] = rule_28;
195
195
 
196
196
  import rule_29 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/subscription';
197
197
 
@@ -86,7 +86,7 @@ export function getErrorMessage(report, executionPlatform, executionPlatformVers
86
86
  }
87
87
 
88
88
  if (type === ERROR_TYPES.ELEMENT_COLLAPSED_NOT_ALLOWED) {
89
- return getElementCollapsedNotAllowedErrorMessage(report);
89
+ return getElementCollapsedNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion);
90
90
  }
91
91
 
92
92
  if (type === ERROR_TYPES.ELEMENT_PROPERTY_VALUE_DUPLICATED) {
@@ -176,18 +176,18 @@ function getChildElementTypeNotAllowedErrorMessage(report, executionPlatform, ex
176
176
  );
177
177
  }
178
178
 
179
- function getElementCollapsedNotAllowedErrorMessage(report) {
179
+ function getElementCollapsedNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion) {
180
180
  const {
181
181
  data,
182
182
  message
183
183
  } = report;
184
184
 
185
- const { node } = data;
185
+ const { allowedVersion, node } = data;
186
186
 
187
187
  const typeString = getTypeString(node);
188
188
 
189
189
  if (is(node, 'bpmn:SubProcess')) {
190
- return `${ getIndefiniteArticle(typeString) } <${ typeString }> must be expanded`;
190
+ return getSupportedMessage(`A collapsed <${typeString}>`, executionPlatform, executionPlatformVersion, allowedVersion);
191
191
  }
192
192
 
193
193
  return message;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/linting",
3
- "version": "3.10.0",
3
+ "version": "3.12.0",
4
4
  "description": "Linting for Camunda",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -32,7 +32,7 @@
32
32
  "@bpmn-io/diagram-js-ui": "^0.2.2",
33
33
  "bpmn-moddle": "^8.0.0",
34
34
  "bpmnlint": "^9.2.0",
35
- "bpmnlint-plugin-camunda-compat": "^2.11.1",
35
+ "bpmnlint-plugin-camunda-compat": "^2.13.0",
36
36
  "bpmnlint-utils": "^1.0.2",
37
37
  "camunda-bpmn-moddle": "^7.0.1",
38
38
  "clsx": "^2.0.0",