@camunda/linting 3.7.1 → 3.7.2

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/README.md CHANGED
@@ -31,7 +31,8 @@ const modeler = new Modeler({
31
31
 
32
32
  // configure to be used with desktop or web modeler
33
33
  const linter = new Linter({
34
- modeler: 'web'
34
+ modeler: 'web', // `desktop` or `web` modeler, defaults to `desktop`
35
+ type: 'cloud' // `cloud` or `platform` diagrams, defaults to `cloud`
35
36
  });
36
37
 
37
38
  // lint by passing definitions
package/lib/Linter.js CHANGED
@@ -11,6 +11,7 @@ import { resolver as RulesResolver } from './compiled-config';
11
11
 
12
12
  import modelerModdle from 'modeler-moddle/resources/modeler.json';
13
13
  import zeebeModdle from 'zeebe-bpmn-moddle/resources/zeebe.json';
14
+ import camundaModdle from 'camunda-bpmn-moddle/resources/camunda.json';
14
15
 
15
16
  import { getErrorMessage } from './utils/error-messages';
16
17
  import { getEntryIds } from './utils/properties-panel';
@@ -19,18 +20,30 @@ import { toSemverMinor } from './utils/version';
19
20
 
20
21
  import { getDocumentationUrl } from './utils/documentation';
21
22
 
22
- const moddle = new BpmnModdle({
23
- modeler: modelerModdle,
24
- zeebe: zeebeModdle
25
- });
26
-
23
+ /**
24
+ * @param {Object} [options]
25
+ * @param {string} [options.modeler='desktop']
26
+ * @param {Array<Object>} [options.plugins=[]]
27
+ * @param {string} [options.type='cloud']
28
+ */
27
29
  export class Linter {
28
30
  constructor(options = {}) {
29
31
  const {
30
32
  modeler = 'desktop',
31
- plugins = []
33
+ plugins = [],
34
+ type = 'cloud'
32
35
  } = options;
33
36
 
37
+ this._moddle = new BpmnModdle({
38
+ modeler: modelerModdle,
39
+
40
+ // Zeebe and Camunda moddle extensions can't be used together
41
+ // cf. https://github.com/camunda/camunda-modeler/issues/3853#issuecomment-1731145100
42
+ ...(type === 'cloud' ?
43
+ { zeebe: zeebeModdle } :
44
+ { camunda: camundaModdle })
45
+ });
46
+
34
47
  this._modeler = modeler;
35
48
  this._plugins = plugins;
36
49
  }
@@ -39,7 +52,7 @@ export class Linter {
39
52
  let rootElement;
40
53
 
41
54
  if (isString(contents)) {
42
- ({ rootElement } = await moddle.fromXML(contents));
55
+ ({ rootElement } = await this._moddle.fromXML(contents));
43
56
  } else {
44
57
  rootElement = contents;
45
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/linting",
3
- "version": "3.7.1",
3
+ "version": "3.7.2",
4
4
  "description": "Linting for Camunda Platform",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -34,6 +34,7 @@
34
34
  "bpmnlint": "^9.2.0",
35
35
  "bpmnlint-plugin-camunda-compat": "^2.7.1",
36
36
  "bpmnlint-utils": "^1.0.2",
37
+ "camunda-bpmn-moddle": "^7.0.1",
37
38
  "clsx": "^2.0.0",
38
39
  "min-dash": "^4.0.0",
39
40
  "min-dom": "^4.1.0",