bpmnlint 7.5.0 → 7.6.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/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ All notable changes to [bpmnlint](https://github.com/bpmn-io/bpmnlint) are docum
6
6
 
7
7
  ___Note:__ Yet to be released changes appear here._
8
8
 
9
+ ## 7.6.0
10
+
11
+ * `FEAT`: allow passing object as third parameter to `Reporter#report` ([#75](https://github.com/bpmn-io/bpmnlint/pull/75))
12
+
13
+
9
14
  ## 7.5.0
10
15
 
11
16
  * `FEAT`: add optional `path` parameter to `Reporter#report` ([#73](https://github.com/bpmn-io/bpmnlint/pull/73))
package/lib/test-rule.js CHANGED
@@ -1,5 +1,11 @@
1
1
  const traverse = require('./traverse');
2
2
 
3
+ const {
4
+ isArray,
5
+ isObject
6
+ } = require('min-dash');
7
+
8
+
3
9
  class Reporter {
4
10
  constructor({ moddleRoot, rule }) {
5
11
  this.rule = rule;
@@ -8,19 +14,42 @@ class Reporter {
8
14
  this.report = this.report.bind(this);
9
15
  }
10
16
 
17
+ /**
18
+ * @param {string} id
19
+ * @param {string} message
20
+ * @param {string[]|Object} path
21
+ *
22
+ * @example
23
+ *
24
+ * Reporter.report('foo', 'Foo error', [ 'foo', 'bar', 'baz' ]);
25
+ *
26
+ * @example
27
+ *
28
+ * Reporter.report('foo', 'Foo error', {
29
+ * path: [ 'foo', 'bar', 'baz' ],
30
+ * foo: 'foo'
31
+ * });
32
+ */
11
33
  report(id, message, path) {
12
34
  let report = {
13
35
  id,
14
36
  message
15
37
  };
16
38
 
17
- if (path) {
39
+ if (path && isArray(path)) {
18
40
  report = {
19
41
  ...report,
20
42
  path
21
43
  };
22
44
  }
23
45
 
46
+ if (path && isObject(path)) {
47
+ report = {
48
+ ...report,
49
+ ...path
50
+ };
51
+ }
52
+
24
53
  this.messages.push(report);
25
54
  }
26
55
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bpmnlint",
3
3
  "description": "Validate your BPMN diagrams based on configurable lint rules",
4
- "version": "7.5.0",
4
+ "version": "7.6.0",
5
5
  "main": "lib/index.js",
6
6
  "keywords": [
7
7
  "bpmnlint",