bpmnlint 7.8.0 → 8.0.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/bin/bpmnlint.js CHANGED
@@ -28,7 +28,7 @@ const Table = require('cli-table');
28
28
 
29
29
  const pluralize = require('pluralize');
30
30
 
31
- const { pathStringify } = require('@philippfromme/moddle-helpers');
31
+ const { pathStringify } = require('@bpmn-io/moddle-utils');
32
32
 
33
33
  const CONFIG_NAME = '.bpmnlintrc';
34
34
 
@@ -21,19 +21,21 @@ async function compileConfig(config, resolver) {
21
21
  const resolvedRules = await linter.resolveConfiguredRules(config);
22
22
 
23
23
  // only process and serialize enabled rules
24
- const enabledRules = Object.keys(resolvedRules).reduce(function(enabledRules, key) {
24
+ const rules = Object.keys(resolvedRules).reduce(function(rules, key) {
25
25
  const value = resolvedRules[key];
26
26
 
27
27
  const { category } = linter.parseRuleValue(value);
28
28
 
29
- if (category !== 'off') {
30
- enabledRules[key] = value;
29
+ if (category === 'off') {
30
+ rules[key] = 0;
31
+ } else {
32
+ rules[key] = value;
31
33
  }
32
34
 
33
- return enabledRules;
35
+ return rules;
34
36
  }, {});
35
37
 
36
- const serializedRules = JSON.stringify(enabledRules, null, ' ');
38
+ const serializedRules = JSON.stringify(rules, null, ' ');
37
39
 
38
40
  const preambleCode = `
39
41
  const cache = {};
@@ -81,7 +83,11 @@ export { resolver, config };
81
83
  export default bundle;
82
84
  `;
83
85
 
84
- const importCode = Object.keys(enabledRules).map((key, idx) => {
86
+ const importCode = Object.entries(rules).map(([ key, value ], idx) => {
87
+
88
+ if (!value) {
89
+ return null;
90
+ }
85
91
 
86
92
  const {
87
93
  pkg, ruleName
@@ -90,7 +96,7 @@ export default bundle;
90
96
  return `
91
97
  import rule_${idx} from '${resolver.normalizePkg(pkg)}/rules/${ruleName}';
92
98
  cache['${pkg}/${ruleName}'] = rule_${idx};`;
93
- }).join('\n');
99
+ }).filter(e => e).join('\n');
94
100
 
95
101
  return `${preambleCode}\n\n${importCode}`;
96
102
  }
@@ -96,7 +96,7 @@ function verify(ruleName, rule, testCases) {
96
96
  }
97
97
 
98
98
  function getTitle(idx, name) {
99
- return `test case #${ idx + 1 }${ name ? ` ${ name }`: '' }`;
99
+ return `test case #${ idx + 1 }${ name ? ` ${ name }` : '' }`;
100
100
  }
101
101
 
102
102
  function replacer(_, value) {
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.8.0",
4
+ "version": "8.0.0",
5
5
  "main": "lib/index.js",
6
6
  "keywords": [
7
7
  "bpmnlint",
@@ -23,7 +23,7 @@
23
23
  }
24
24
  ],
25
25
  "engines": {
26
- "node": ">= 10"
26
+ "node": ">= 12"
27
27
  },
28
28
  "license": "MIT",
29
29
  "scripts": {
@@ -37,27 +37,33 @@
37
37
  "bpmnlint": "./bin/bpmnlint.js"
38
38
  },
39
39
  "dependencies": {
40
- "@philippfromme/moddle-helpers": "^0.1.0",
41
- "ansi-colors": "^4.1.1",
42
- "bpmn-moddle": "^7.1.2",
40
+ "@bpmn-io/moddle-utils": "^0.1.0",
41
+ "ansi-colors": "^4.1.3",
42
+ "bpmn-moddle": "^7.1.3",
43
43
  "bpmnlint-utils": "^1.0.2",
44
- "cli-table": "^0.3.9",
44
+ "cli-table": "^0.3.11",
45
45
  "color-support": "^1.1.3",
46
- "min-dash": "^3.8.0",
46
+ "min-dash": "^3.8.1",
47
47
  "mri": "^1.2.0",
48
48
  "pluralize": "^7.0.0",
49
49
  "tiny-glob": "^0.2.9"
50
50
  },
51
51
  "devDependencies": {
52
52
  "chai": "^4.3.4",
53
- "eslint": "^7.32.0",
54
- "eslint-plugin-bpmn-io": "^0.11.0",
53
+ "eslint": "^8.23.1",
54
+ "eslint-plugin-bpmn-io": "^0.16.0",
55
55
  "esm": "^3.2.25",
56
- "execa": "^2.1.0",
57
- "install-local": "^1.0.0",
56
+ "execa": "^5.1.1",
57
+ "install-local": "^3.0.1",
58
58
  "mocha": "^8.4.0",
59
59
  "npm-run-all": "^4.1.5",
60
60
  "nyc": "^15.1.0",
61
- "strip-indent": "^2.0.0"
62
- }
61
+ "strip-indent": "^3.0.0"
62
+ },
63
+ "files": [
64
+ "bin",
65
+ "config",
66
+ "lib",
67
+ "rules"
68
+ ]
63
69
  }
@@ -53,7 +53,6 @@ module.exports = function() {
53
53
  */
54
54
  function getAllBpmnElements(rootElements) {
55
55
  return flatten(rootElements.map((rootElement) => {
56
-
57
56
  const laneSet =
58
57
  rootElement.laneSets && rootElement.laneSets[0] || rootElement.childLaneSet;
59
58
 
@@ -66,13 +65,15 @@ function getAllBpmnElements(rootElements) {
66
65
  // * nested laneSets
67
66
  // * childLaneSets
68
67
  // * nested childLaneSets
68
+ // * messageFlows
69
69
  const elements = flatten([].concat(
70
70
  rootElement.flowElements || [],
71
71
  (rootElement.flowElements && getAllBpmnElements(rootElement.flowElements.filter(hasFlowElements))) || [],
72
72
  rootElement.participants || [],
73
73
  rootElement.artifacts || [],
74
74
  laneSet && laneSet.lanes || [],
75
- laneSet && laneSet.lanes && getAllBpmnElements(laneSet.lanes.filter(hasChildLaneSet)) || []
75
+ laneSet && laneSet.lanes && getAllBpmnElements(laneSet.lanes.filter(hasChildLaneSet)) || [],
76
+ rootElement.messageFlows || []
76
77
  ));
77
78
 
78
79
  if (elements.length > 0) {
@@ -115,7 +116,7 @@ function getAllDiBpmnReferences(definitionsNode) {
115
116
  }
116
117
 
117
118
  function hasVisualRepresentation(element) {
118
- const noVisRepresentation = ['bpmn:DataObject'];
119
+ const noVisRepresentation = [ 'bpmn:DataObject' ];
119
120
 
120
121
  return noVisRepresentation.includes(element.$type) ? false : true;
121
122
  }
package/CHANGELOG.md DELETED
@@ -1,210 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to [bpmnlint](https://github.com/bpmn-io/bpmnlint) are documented here. We use [semantic versioning](http://semver.org/) for releases.
4
-
5
- ## Unreleased
6
-
7
- ___Note:__ Yet to be released changes appear here._
8
-
9
- ## 7.8.0
10
-
11
- * `FEAT`: be able to configure rules ([#82](https://github.com/bpmn-io/bpmnlint/pull/82))
12
- * `FEAT`: be able to configure rules when testing ([#83](https://github.com/bpmn-io/bpmnlint/pull/83))
13
-
14
- ## 7.7.0
15
-
16
- * `FEAT`: fuzzy test for equality of nodes when using `RuleTester#verify` ([#79](https://github.com/bpmn-io/bpmnlint/pull/79/files))
17
-
18
- ## 7.6.0
19
-
20
- * `FEAT`: allow passing object as third parameter to `Reporter#report` ([#75](https://github.com/bpmn-io/bpmnlint/pull/75))
21
-
22
-
23
- ## 7.5.0
24
-
25
- * `FEAT`: add optional `path` parameter to `Reporter#report` ([#73](https://github.com/bpmn-io/bpmnlint/pull/73))
26
- * `FEAT`: add optional `name` parameter to `RuleTester#verify` ([#68](https://github.com/bpmn-io/bpmnlint/pull/68))
27
- * `CHORE`: update to `bpmn-moddle@7.1.2`
28
-
29
- ## 7.4.0
30
-
31
- * `FEAT`: resolve local package by name ([#64](https://github.com/bpmn-io/bpmnlint/pull/64))
32
-
33
- ## 7.3.0
34
-
35
- * `FEAT`: support `--version` command line flag ([#65](https://github.com/bpmn-io/bpmnlint/pull/65))
36
- * `FEAT`: allow rule testers to provide custom `it`
37
- * `FIX`: make `no-bpmndi` handle missing `LaneSet#lanes` gracefully ([#63](https://github.com/bpmn-io/bpmnlint/issues/63), [#66](https://github.com/bpmn-io/bpmnlint/pull/66))
38
-
39
- ## 7.2.1
40
-
41
- * `FIX`: exclude compensation boundary and activity in `no-disconnected` check ([#60](https://github.com/bpmn-io/bpmnlint/pull/60))
42
-
43
- ## 7.2.0
44
-
45
- * `FEAT`: add `no-bpmndi` rule ([#55](https://github.com/bpmn-io/bpmnlint/issues/55))
46
-
47
- ## 7.1.0
48
-
49
- * `FEAT`: allow rules to skip sub-tree traversal ([#53](https://github.com/bpmn-io/bpmnlint/issues/53))
50
- * `FEAT`: allow rules to hook into node `enter` and `leave` ([#52](https://github.com/bpmn-io/bpmnlint/issues/52))
51
-
52
- ## 7.0.1
53
-
54
- * `CHORE`: drop debug log statement
55
-
56
- ## 7.0.0
57
-
58
- * `CHORE`: update to `bpmn-moddle@7`
59
- * `CHORE`: reduce library footprint
60
- * `CHORE`: require `NodeJS>=10`
61
-
62
- ## 6.5.0
63
-
64
- * `FEAT`: add globbing support ([#46](https://github.com/bpmn-io/bpmnlint/issues/46))
65
- * `DOCS`: add explaination to `no-inclusive-gateway` rule
66
-
67
- ## 6.4.0
68
-
69
- * `FEAT`: add `superfluous-gateway` check ([#42](https://github.com/bpmn-io/bpmnlint/pull/42/files))
70
-
71
- ## 6.3.0
72
-
73
- * `FEAT`: support rules and configuration provided by scoped packages ([#35](https://github.com/bpmn-io/bpmnlint/issues/35))
74
- * `CHORE`: improve `Node >= 12.20` compatibility ([#37](https://github.com/bpmn-io/bpmnlint/pull/37))
75
-
76
- ## 6.2.0
77
-
78
- * `DOCS`: document existing rules ([#14](https://github.com/bpmn-io/bpmnlint/issues/14))
79
-
80
- ## 6.1.2
81
-
82
- * `FIX`: exclude event-based sub-processes from `no-disconnected` check ([#31](https://github.com/bpmn-io/bpmnlint/issues/31))
83
-
84
- ## 6.1.1
85
-
86
- * `FEAT`: allow tool to be used with `Node >= 8`
87
-
88
- ## 6.1.0
89
-
90
- * `FEAT`: resolve local rules in plug-ins without prefix ([`640e411a`](https://github.com/bpmn-io/bpmnlint/commit/640e411ac8c6045198bd09b79b5c53c6e29e251c))
91
-
92
- ## 6.0.0
93
-
94
- * `FEAT`: resolve plug-in provided rules/configuration local to working directory ([`f1bf331f`](https://github.com/bpmn-io/bpmnlint/commit/f1bf331f4bcece62de16da34bb3f8fda08182fbc))
95
- * `CHORE`: improve errors on rule/plugin resolution failures
96
- * `CHORE`: require `>= node@10.12`
97
-
98
- ## 5.3.0
99
-
100
- * `FEAT`: add `--init` option to create `.bpmnlintrc` in current working directory
101
-
102
- ## 5.2.0
103
-
104
- * `FEAT`: provide help on missing `.bpmnlintrc`
105
-
106
- ## 5.1.2
107
-
108
- * `DOCS`: add package description
109
-
110
- ## 5.1.1
111
-
112
- * `CHORE`: exclude additional development assets from distribution
113
-
114
- ## 5.1.0
115
-
116
- * `FEAT`: add `no-duplicate-sequence-flows` rule ([#22](https://github.com/bpmn-io/bpmnlint/issues/22))
117
- * `FEAT`: catch more BPMN parse errors
118
- * `FEAT`: be able to define multiple expected test results in `RuleTester`
119
- * `FIX`: make `nyc` a development dependency
120
- * `CHORE`: update to `bpmn-moddle@6`
121
-
122
- ## 5.0.0
123
-
124
- * `FEAT`: don't expose utils to rules; use `bpmnlint-utils` instead
125
-
126
- ## 4.1.0
127
-
128
- * `FEAT`: handle and report diagram import errors and warnings via CLI
129
- * `FEAT`: properly handle generic moddle elements during rule checking
130
- * `FEAT`: report rule execution errors
131
-
132
- ## 4.0.0
133
-
134
- * `FEAT`: add ability to batch lint multiple files via CLI
135
- * `FEAT`: don't resolve disabled rules ([`6c45f3f9`](https://github.com/bpmn-io/bpmnlint/commit/6c45f3f952a412dda05deb5c57861a1c76af23bb))
136
- * `CHORE`: unify messages of built-in rules
137
- * `CHORE`: adopt cli output to eslint styling
138
-
139
- ## 3.3.1
140
-
141
- * `FIX`: handle empty flow element containers in rules
142
-
143
- ## 3.3.0
144
-
145
- * `FEAT`: do not expose disabled rules when bundling `.bpmnlintrc`
146
-
147
- ## 3.2.1
148
-
149
- * `DOCS`: fix readme code snippet
150
-
151
- ## 3.2.0
152
-
153
- * `FEAT`: add ability to pass linter configuration via constructor
154
-
155
- ## 3.1.0
156
-
157
- * `FEAT`: add support script to compile `.bpmnlintrc` files to JavaScript ([`cf53a389`](https://github.com/bpmn-io/bpmnlint/commit/cf53a3894b6bd821e18ddfc7bdaa8da857356a37))
158
-
159
- ## 3.0.0
160
-
161
- #### Breaking Changes
162
-
163
- * `FEAT`: treat unprefixed rules as built-in ones
164
-
165
- ## 2.0.0
166
-
167
- #### Breaking Changes
168
-
169
- * `CHORE`: make `NodeResolver` a constructor
170
- * `CHORE`: unify file names to `dashed-case`
171
- * `CHORE`: rework `Resolver` APIs
172
-
173
- #### Other Enhancements
174
-
175
- * `FEAT`: add `StaticResolver` to load cached resources
176
- * `FEAT`: add `{ Linter }` as a library export
177
- * `CHORE`: move rule and config name resolution to linter
178
- * `CHORE`: catch all cli errors and exit accordingly
179
-
180
- ## 1.0.0
181
-
182
- * `FEAT`: add numerous new rules ([#5](https://github.com/bpmn-io/bpmnlint/issues/5))
183
- * `FEAT`: add `bpmnlint:all` configuration
184
- * `FEAT`: improve `label-required` rule ([#11](https://github.com/bpmn-io/bpmnlint/issues/11))
185
- * `FEAT`: group lint results by rule names
186
- * `FEAT`: exit cli with code=1 on lint errors
187
- * `FEAT`: add `isAny(node, [ ... types ])` method to `utils`
188
- * `CHORE`: improve / test cover existing rules
189
- * `CHORE`: include new rules in `bpmnlint:recommended` configuration
190
-
191
- ## 1.0.0-alpha6
192
-
193
- * `DOCS`: documentation simplification / improvements
194
-
195
- ## 1.0.0-alpha5
196
-
197
- _Initial stable release._
198
-
199
- * `FEAT`: configure, resolve and execute local and external rules
200
- * `FEAT`: extend external configuration via `extends`
201
- * `FEAT`: make rule and configuration resolution async
202
- * `FEAT`: provide `bpmnlint:recommended` configuration
203
- * `CHORE`: `linter` is now a constructor, offering a `#lint(moddleElement, config)` method
204
- * `CHORE`: moved library to [bpmn-io/bpmnlint](https://github.com/bpmn-io/bpmnlint)
205
- * `CHORE`: full rewrite of internals
206
- * `CHORE`: `utils` API change
207
-
208
- ## ...
209
-
210
- Check `git log` for earlier history.