bpmnlint 11.11.0 → 11.12.1

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.
Files changed (46) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +203 -203
  3. package/bin/bpmnlint.js +437 -437
  4. package/config/all.js +37 -37
  5. package/config/correctness.js +12 -12
  6. package/config/recommended.js +29 -29
  7. package/lib/index.js +4 -4
  8. package/lib/linter.js +542 -542
  9. package/lib/resolver/helper.js +12 -12
  10. package/lib/resolver/node-resolver.js +135 -135
  11. package/lib/resolver/static-resolver.js +47 -47
  12. package/lib/support/compile-config.js +200 -171
  13. package/lib/test-rule.js +107 -107
  14. package/lib/testers/helper.js +72 -72
  15. package/lib/testers/rule-tester.d.ts +36 -36
  16. package/lib/testers/rule-tester.js +146 -146
  17. package/lib/traverse.js +56 -56
  18. package/lib/types.d.ts +80 -80
  19. package/package.json +73 -73
  20. package/rules/ad-hoc-sub-process.js +43 -43
  21. package/rules/conditional-event.js +51 -51
  22. package/rules/conditional-flows.js +57 -57
  23. package/rules/end-event-required.js +45 -45
  24. package/rules/event-based-gateway.js +44 -44
  25. package/rules/event-sub-process-typed-start-event.js +43 -43
  26. package/rules/fake-join.js +40 -40
  27. package/rules/global.js +145 -145
  28. package/rules/helper.js +123 -123
  29. package/rules/label-required.js +75 -75
  30. package/rules/link-event.js +106 -106
  31. package/rules/no-bpmndi.js +157 -157
  32. package/rules/no-complex-gateway.js +2 -2
  33. package/rules/no-disconnected.js +82 -82
  34. package/rules/no-duplicate-sequence-flows.js +69 -69
  35. package/rules/no-gateway-join-fork.js +35 -35
  36. package/rules/no-implicit-end.js +98 -98
  37. package/rules/no-implicit-split.js +55 -55
  38. package/rules/no-implicit-start.js +69 -69
  39. package/rules/no-inclusive-gateway.js +2 -2
  40. package/rules/no-overlapping-elements.js +196 -196
  41. package/rules/single-blank-start-event.js +47 -47
  42. package/rules/single-event-definition.js +33 -33
  43. package/rules/start-event-required.js +45 -45
  44. package/rules/sub-process-blank-start-event.js +43 -43
  45. package/rules/superfluous-gateway.js +36 -36
  46. package/rules/superfluous-termination.js +70 -70
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2018-present bpmn.io Contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018-present bpmn.io Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
21
  THE SOFTWARE.
package/README.md CHANGED
@@ -1,203 +1,203 @@
1
- # bpmnlint
2
-
3
- [![CI](https://github.com/bpmn-io/bpmnlint/actions/workflows/CI.yml/badge.svg)](https://github.com/bpmn-io/bpmnlint/actions/workflows/CI.yml)
4
-
5
- Validate your BPMN diagrams based on configurable lint rules.
6
-
7
-
8
- ## Installation
9
-
10
- Install the utility via [npm](https://www.npmjs.com/package/bpmnlint):
11
-
12
- ```sh
13
- npm install -g bpmnlint
14
- ```
15
-
16
-
17
- ## Usage
18
-
19
- Validate your diagrams via the commandline:
20
-
21
- ```sh
22
- > bpmnlint invoice.bpmn
23
-
24
- /Projects/process-application/resources/invoice.bpmn
25
- Flow_1 error Sequence flow is missing condition conditional-flows
26
- Process error Process is missing end event end-event-required
27
- Task_13 warning Element is missing label/name label-required
28
- Event_12 warning Element is missing label/name label-required
29
- Event_27 warning Element is missing label/name label-required
30
- Process error Process is missing start event start-event-required
31
-
32
- ✖ 6 problems (6 errors, 0 warnings)
33
- ```
34
-
35
-
36
- ## Rules
37
-
38
- Our [documentation](https://github.com/bpmn-io/bpmnlint/tree/main/docs/rules#rules) lists all currenty implemented rules, the [`./rules` folder](https://github.com/bpmn-io/bpmnlint/tree/main/rules) contains each rules implementation.
39
-
40
- Do you miss a rule that should be included? [Propose a new rule](https://github.com/bpmn-io/bpmnlint/issues/new?assignees=&labels=rules&template=NEW_RULE.md).
41
-
42
-
43
- ## Configuration
44
-
45
- Create a `.bpmnlintrc` file in your working directory and inherit from a common configuration using the `extends` block:
46
-
47
- ```json
48
- {
49
- "extends": "bpmnlint:recommended"
50
- }
51
- ```
52
-
53
- Add or customize rules using the `rules` block:
54
-
55
- ```json
56
- {
57
- "extends": "bpmnlint:recommended",
58
- "rules": {
59
- "label-required": "off"
60
- }
61
- }
62
- ```
63
-
64
- You may also extend from multiple configurations, including those provided by [custom plug-ins](#writing-a-plug-in):
65
-
66
- ```json
67
- {
68
- "extends": [
69
- "bpmnlint:recommended",
70
- "plugin:foo/recommended",
71
- "plugin:@bar/bpmnlint-plugin-bar/recommended"
72
- ]
73
- }
74
- ```
75
-
76
- This will amend core `recommended` rules with `recommended` rulesets provided by `bpmnlint-plugin-foo` and `@bar/bpmnlint-plugin-bar`, respectively.
77
-
78
- Plug-ins will be resolved relative to the configuration file location, using [node module resolution](https://nodejs.org/api/modules.html#loading-from-node_modules-folders).
79
-
80
-
81
- ### Available Configurations
82
-
83
- * [`bpmnlint:all`](./config/all.js) - all rules as errors
84
- * [`bpmnlint:recommended`](./config/recommended.js) - opinionated rules ("best practices") and rules enforcing BPMN compliance
85
- * [`bpmnlint:correctness`](./config/correctness.js) - rules enforcing BPMN compliance
86
-
87
- ### Moddle extensions
88
-
89
- To validate your diagrams with custom [moddle](https://github.com/bpmn-io/moddle) extensions, add `moddleExtensions` to the root configuration file:
90
-
91
- ```json
92
- {
93
- "extends": [
94
- "bpmnlint:recommended",
95
- "plugin:custom/recommended"
96
- ],
97
- "moddleExtensions": {
98
- "custom": "custom-bpmn-moddle/resources/custom.json"
99
- }
100
- }
101
- ```
102
-
103
- The extension will be resolved relative to the configuration file location, using [node module resolution](https://nodejs.org/api/modules.html#loading-from-node_modules-folders).
104
-
105
- ## API
106
-
107
- Invoke the tool directly from [NodeJS](https://nodejs.org/en):
108
-
109
- ```javascript
110
- import Linter from 'bpmnlint';
111
- import NodeResolver from 'bpmnlint/lib/resolver/node-resolver';
112
-
113
- import BpmnModdle from 'bpmn-moddle';
114
-
115
- const moddle = new BpmnModdle();
116
-
117
- const linter = new Linter({
118
- config: {
119
- extends: 'bpmnlint:recommended'
120
- },
121
- resolver: new NodeResolver()
122
- });
123
-
124
- const xmlStr = `
125
- <?xml version="1.0" encoding="UTF-8"?>
126
- <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
127
- id="definitions"
128
- targetNamespace="http://bpmn.io/schema/bpmn">
129
- <bpmn:process id="process" />
130
- </bpmn:definitions>
131
- `;
132
-
133
- const {
134
- rootElement: definitions
135
- } = await moddle.fromXML(xmlStr);
136
-
137
- const reports = linter.lint(definitions);
138
-
139
- // {
140
- // "end-event-required": [
141
- // {
142
- // "id": "process",
143
- // "message": "Process is missing end event"
144
- // }
145
- // ],
146
- // ...
147
- // }
148
- ```
149
-
150
-
151
- ## Writing a Plug-in
152
-
153
- Create your first plug-in using the [plugin creator](https://github.com/nikku/create-bpmnlint-plugin):
154
-
155
- ```sh
156
- npm init bpmnlint-plugin {PLUGIN_NAME}
157
- ```
158
-
159
- Checkout the [bpmnlint-plugin-example](https://github.com/bpmn-io/bpmnlint-plugin-example) for details on how to define, test, and consume custom lint rules. Use the [bpmnlint playground](https://github.com/bpmn-io/bpmnlint-playground) to implement new rules with quick visual feedback.
160
-
161
- > [!NOTE]
162
- > Plug-ins must always follow the naming scheme `bpmnlint-plugin-{NAME_OF_YOUR_PLUGIN}` and may contain a namespace prefix.
163
-
164
- When using your custom plug-in, reference its configuration or rules via the shorthand plug-in name, or the full identifier:
165
-
166
- ```json
167
- {
168
- "extends": [
169
- "bpmnlint:recommended",
170
- "plugin:foo/recommended",
171
- "plugin:@bar/bpmnlint-plugin-bar/recommended"
172
- ],
173
- "rules": {
174
- "foo/special-rule": "off",
175
- "@bar/bar/other-rule": "warn"
176
- }
177
- }
178
- ```
179
-
180
-
181
- ## Bundling
182
-
183
- For browser usage include your [linting configuration](#configuration) using your favorite bundler plug-in ([Rollup](https://www.npmjs.com/package/rollup-plugin-bpmnlint), [Webpack](https://www.npmjs.com/package/bpmnlint-loader)).
184
-
185
-
186
- ## Visual Feedback
187
-
188
- Integrate the linter via [bpmn-js-bpmnlint](https://github.com/bpmn-io/bpmn-js-bpmnlint) into [bpmn-js](https://github.com/bpmn-io/bpmn-js) and get direct feedback during modeling.
189
-
190
- To try out visual validation, checkout the [bpmnlint playground](https://github.com/bpmn-io/bpmnlint-playground).
191
-
192
-
193
- ## Related
194
-
195
- * [bpmnlint-plugin-example](https://github.com/bpmn-io/bpmnlint-plugin-example) - an example plug-in
196
- * [bpmnlint-playground](https://github.com/bpmn-io/bpmnlint-playground) - a playground to implement new rules with quick visual feedback
197
- * [bpmnlint-generate-docs-images](https://github.com/bpmn-io/bpmnlint-generate-docs-images) - Generate images for your bpmnlint documentation
198
- * [bpmn-js-bpmnlint](https://github.com/bpmn-io/bpmn-js-bpmnlint) - integration into [bpmn-js](https://github.com/bpmn-io/bpmn-js)
199
-
200
-
201
- ## License
202
-
203
- MIT
1
+ # bpmnlint
2
+
3
+ [![CI](https://github.com/bpmn-io/bpmnlint/actions/workflows/CI.yml/badge.svg)](https://github.com/bpmn-io/bpmnlint/actions/workflows/CI.yml)
4
+
5
+ Validate your BPMN diagrams based on configurable lint rules.
6
+
7
+
8
+ ## Installation
9
+
10
+ Install the utility via [npm](https://www.npmjs.com/package/bpmnlint):
11
+
12
+ ```sh
13
+ npm install -g bpmnlint
14
+ ```
15
+
16
+
17
+ ## Usage
18
+
19
+ Validate your diagrams via the commandline:
20
+
21
+ ```sh
22
+ > bpmnlint invoice.bpmn
23
+
24
+ /Projects/process-application/resources/invoice.bpmn
25
+ Flow_1 error Sequence flow is missing condition conditional-flows
26
+ Process error Process is missing end event end-event-required
27
+ Task_13 warning Element is missing label/name label-required
28
+ Event_12 warning Element is missing label/name label-required
29
+ Event_27 warning Element is missing label/name label-required
30
+ Process error Process is missing start event start-event-required
31
+
32
+ ✖ 6 problems (6 errors, 0 warnings)
33
+ ```
34
+
35
+
36
+ ## Rules
37
+
38
+ Our [documentation](https://github.com/bpmn-io/bpmnlint/tree/main/docs/rules#rules) lists all currenty implemented rules, the [`./rules` folder](https://github.com/bpmn-io/bpmnlint/tree/main/rules) contains each rules implementation.
39
+
40
+ Do you miss a rule that should be included? [Propose a new rule](https://github.com/bpmn-io/bpmnlint/issues/new?assignees=&labels=rules&template=NEW_RULE.md).
41
+
42
+
43
+ ## Configuration
44
+
45
+ Create a `.bpmnlintrc` file in your working directory and inherit from a common configuration using the `extends` block:
46
+
47
+ ```json
48
+ {
49
+ "extends": "bpmnlint:recommended"
50
+ }
51
+ ```
52
+
53
+ Add or customize rules using the `rules` block:
54
+
55
+ ```json
56
+ {
57
+ "extends": "bpmnlint:recommended",
58
+ "rules": {
59
+ "label-required": "off"
60
+ }
61
+ }
62
+ ```
63
+
64
+ You may also extend from multiple configurations, including those provided by [custom plug-ins](#writing-a-plug-in):
65
+
66
+ ```json
67
+ {
68
+ "extends": [
69
+ "bpmnlint:recommended",
70
+ "plugin:foo/recommended",
71
+ "plugin:@bar/bpmnlint-plugin-bar/recommended"
72
+ ]
73
+ }
74
+ ```
75
+
76
+ This will amend core `recommended` rules with `recommended` rulesets provided by `bpmnlint-plugin-foo` and `@bar/bpmnlint-plugin-bar`, respectively.
77
+
78
+ Plug-ins will be resolved relative to the configuration file location, using [node module resolution](https://nodejs.org/api/modules.html#loading-from-node_modules-folders).
79
+
80
+
81
+ ### Available Configurations
82
+
83
+ * [`bpmnlint:all`](./config/all.js) - all rules as errors
84
+ * [`bpmnlint:recommended`](./config/recommended.js) - opinionated rules ("best practices") and rules enforcing BPMN compliance
85
+ * [`bpmnlint:correctness`](./config/correctness.js) - rules enforcing BPMN compliance
86
+
87
+ ### Moddle extensions
88
+
89
+ To validate your diagrams with custom [moddle](https://github.com/bpmn-io/moddle) extensions, add `moddleExtensions` to the root configuration file:
90
+
91
+ ```json
92
+ {
93
+ "extends": [
94
+ "bpmnlint:recommended",
95
+ "plugin:custom/recommended"
96
+ ],
97
+ "moddleExtensions": {
98
+ "custom": "custom-bpmn-moddle/resources/custom.json"
99
+ }
100
+ }
101
+ ```
102
+
103
+ The extension will be resolved relative to the configuration file location, using [node module resolution](https://nodejs.org/api/modules.html#loading-from-node_modules-folders).
104
+
105
+ ## API
106
+
107
+ Invoke the tool directly from [NodeJS](https://nodejs.org/en):
108
+
109
+ ```javascript
110
+ import Linter from 'bpmnlint';
111
+ import NodeResolver from 'bpmnlint/lib/resolver/node-resolver';
112
+
113
+ import BpmnModdle from 'bpmn-moddle';
114
+
115
+ const moddle = new BpmnModdle();
116
+
117
+ const linter = new Linter({
118
+ config: {
119
+ extends: 'bpmnlint:recommended'
120
+ },
121
+ resolver: new NodeResolver()
122
+ });
123
+
124
+ const xmlStr = `
125
+ <?xml version="1.0" encoding="UTF-8"?>
126
+ <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
127
+ id="definitions"
128
+ targetNamespace="http://bpmn.io/schema/bpmn">
129
+ <bpmn:process id="process" />
130
+ </bpmn:definitions>
131
+ `;
132
+
133
+ const {
134
+ rootElement: definitions
135
+ } = await moddle.fromXML(xmlStr);
136
+
137
+ const reports = linter.lint(definitions);
138
+
139
+ // {
140
+ // "end-event-required": [
141
+ // {
142
+ // "id": "process",
143
+ // "message": "Process is missing end event"
144
+ // }
145
+ // ],
146
+ // ...
147
+ // }
148
+ ```
149
+
150
+
151
+ ## Writing a Plug-in
152
+
153
+ Create your first plug-in using the [plugin creator](https://github.com/nikku/create-bpmnlint-plugin):
154
+
155
+ ```sh
156
+ npm init bpmnlint-plugin {PLUGIN_NAME}
157
+ ```
158
+
159
+ Checkout the [bpmnlint-plugin-example](https://github.com/bpmn-io/bpmnlint-plugin-example) for details on how to define, test, and consume custom lint rules. Use the [bpmnlint playground](https://github.com/bpmn-io/bpmnlint-playground) to implement new rules with quick visual feedback.
160
+
161
+ > [!NOTE]
162
+ > Plug-ins must always follow the naming scheme `bpmnlint-plugin-{NAME_OF_YOUR_PLUGIN}` and may contain a namespace prefix.
163
+
164
+ When using your custom plug-in, reference its configuration or rules via the shorthand plug-in name, or the full identifier:
165
+
166
+ ```json
167
+ {
168
+ "extends": [
169
+ "bpmnlint:recommended",
170
+ "plugin:foo/recommended",
171
+ "plugin:@bar/bpmnlint-plugin-bar/recommended"
172
+ ],
173
+ "rules": {
174
+ "foo/special-rule": "off",
175
+ "@bar/bar/other-rule": "warn"
176
+ }
177
+ }
178
+ ```
179
+
180
+
181
+ ## Bundling
182
+
183
+ For browser usage include your [linting configuration](#configuration) using your favorite bundler plug-in ([Rollup](https://www.npmjs.com/package/rollup-plugin-bpmnlint), [Webpack](https://www.npmjs.com/package/bpmnlint-loader)).
184
+
185
+
186
+ ## Visual Feedback
187
+
188
+ Integrate the linter via [bpmn-js-bpmnlint](https://github.com/bpmn-io/bpmn-js-bpmnlint) into [bpmn-js](https://github.com/bpmn-io/bpmn-js) and get direct feedback during modeling.
189
+
190
+ To try out visual validation, checkout the [bpmnlint playground](https://github.com/bpmn-io/bpmnlint-playground).
191
+
192
+
193
+ ## Related
194
+
195
+ * [bpmnlint-plugin-example](https://github.com/bpmn-io/bpmnlint-plugin-example) - an example plug-in
196
+ * [bpmnlint-playground](https://github.com/bpmn-io/bpmnlint-playground) - a playground to implement new rules with quick visual feedback
197
+ * [bpmnlint-generate-docs-images](https://github.com/bpmn-io/bpmnlint-generate-docs-images) - Generate images for your bpmnlint documentation
198
+ * [bpmn-js-bpmnlint](https://github.com/bpmn-io/bpmn-js-bpmnlint) - integration into [bpmn-js](https://github.com/bpmn-io/bpmn-js)
199
+
200
+
201
+ ## License
202
+
203
+ MIT