@camunda/linting 3.1.0 → 3.2.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/LICENSE +21 -0
- package/assets/linting.css +23 -23
- package/lib/Linter.js +19 -34
- package/lib/compiled-config.js +180 -0
- package/lib/modeler/Linting.js +2 -0
- package/lib/modeler/LintingAnnotations.js +41 -28
- package/lib/modeler/OverlayComponent.js +61 -0
- package/lib/utils/error-messages.js +11 -4
- package/lib/utils/properties-panel.js +15 -2
- package/lib/utils/version.js +6 -0
- package/package.json +17 -11
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022-present Camunda Services GmbH
|
|
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 all
|
|
13
|
+
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 THE
|
|
21
|
+
SOFTWARE.
|
package/assets/linting.css
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
--color-
|
|
2
|
+
--cl-color-white: hsl(0, 0%, 100%);
|
|
3
3
|
|
|
4
|
-
--color-
|
|
5
|
-
|
|
6
|
-
--color-
|
|
7
|
-
|
|
8
|
-
--color-yellow-47-88-53: hsl(47, 88%, 53%);
|
|
9
|
-
|
|
10
|
-
--linting-annotation-error-background-color: var(--color-red-360-100-45);
|
|
11
|
-
--linting-annotation-error-fill-color: var(--color-white);
|
|
12
|
-
|
|
13
|
-
--linting-annotation-warning-background-color: var(--color-yellow-47-88-53);
|
|
14
|
-
--linting-annotation-warning-fill-color: var(--color-white);
|
|
15
|
-
--linting-annotation-warning-stroke-color: var(--color-grey-225-10-15);
|
|
4
|
+
--cl-color-info: #0f62fe;
|
|
5
|
+
--cl-color-warning: #ff832b;
|
|
6
|
+
--cl-color-error: #da1e26;
|
|
7
|
+
--cl-color-success: #52b415;
|
|
16
8
|
}
|
|
17
9
|
|
|
18
|
-
.
|
|
10
|
+
.cl-icon {
|
|
11
|
+
--icon-color: white;
|
|
12
|
+
--icon-bg-color: #333;
|
|
13
|
+
background: var(--icon-bg-color);
|
|
14
|
+
color: var(--icon-color);
|
|
15
|
+
border-radius: 100%;
|
|
16
|
+
height: .75em;
|
|
17
|
+
width: .75em;
|
|
18
|
+
border: solid 4px var(--icon-bg-color);
|
|
19
19
|
display: flex;
|
|
20
|
-
flex-direction: row;
|
|
21
20
|
align-items: center;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
justify-content: center;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.cl-icon-error {
|
|
25
|
+
--icon-bg-color: var(--cl-color-error);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.
|
|
29
|
-
|
|
28
|
+
.cl-icon-warn {
|
|
29
|
+
--icon-bg-color: var(--cl-color-warning);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
.
|
|
33
|
-
|
|
32
|
+
.cl-icon-info {
|
|
33
|
+
--icon-bg-color: var(--cl-color-info);
|
|
34
34
|
}
|
package/lib/Linter.js
CHANGED
|
@@ -7,6 +7,8 @@ import Resolver from './Resolver';
|
|
|
7
7
|
|
|
8
8
|
import { isString } from 'min-dash';
|
|
9
9
|
|
|
10
|
+
import { resolver as RulesResolver } from './compiled-config';
|
|
11
|
+
|
|
10
12
|
import modelerModdle from 'modeler-moddle/resources/modeler.json';
|
|
11
13
|
import zeebeModdle from 'zeebe-bpmn-moddle/resources/zeebe.json';
|
|
12
14
|
|
|
@@ -70,6 +72,8 @@ export class Linter {
|
|
|
70
72
|
|
|
71
73
|
return {
|
|
72
74
|
...report,
|
|
75
|
+
executionPlatform,
|
|
76
|
+
executionPlatformVersion,
|
|
73
77
|
message: getErrorMessage(
|
|
74
78
|
report,
|
|
75
79
|
executionPlatform,
|
|
@@ -118,10 +122,23 @@ export class Linter {
|
|
|
118
122
|
}
|
|
119
123
|
|
|
120
124
|
async _createResolver(configName) {
|
|
121
|
-
const
|
|
125
|
+
const { configs } = await import('bpmnlint-plugin-camunda-compat');
|
|
126
|
+
|
|
127
|
+
let { [ configName ]: config } = configs;
|
|
128
|
+
|
|
129
|
+
if (!config) {
|
|
130
|
+
config = {
|
|
131
|
+
rules: {}
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const ConfigResolver = new StaticResolver({
|
|
136
|
+
[ `config:bpmnlint-plugin-camunda-compat/${ configName }` ]: config
|
|
137
|
+
});
|
|
122
138
|
|
|
123
139
|
return new Resolver([
|
|
124
|
-
|
|
140
|
+
ConfigResolver,
|
|
141
|
+
RulesResolver,
|
|
125
142
|
...this._plugins.map(({ resolver }) => resolver)
|
|
126
143
|
]);
|
|
127
144
|
}
|
|
@@ -136,36 +153,4 @@ function getConfigName(executionPlatform, executionPlatformVersion) {
|
|
|
136
153
|
|
|
137
154
|
function toLowerCase(string) {
|
|
138
155
|
return string.toLowerCase();
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
async function createCache(configName) {
|
|
142
|
-
let config = require('bpmnlint-plugin-camunda-compat').configs[ configName ];
|
|
143
|
-
|
|
144
|
-
if (!config) {
|
|
145
|
-
config = {
|
|
146
|
-
rules: {}
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
const rules = await requireRules(config);
|
|
151
|
-
|
|
152
|
-
return {
|
|
153
|
-
[ `config:bpmnlint-plugin-camunda-compat/${ configName }` ]: config,
|
|
154
|
-
...rules
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function requireRules({ rules }) {
|
|
159
|
-
let requiredRules = {};
|
|
160
|
-
|
|
161
|
-
for (let ruleName of Object.keys(rules)) {
|
|
162
|
-
const requiredRule = require(`bpmnlint-plugin-camunda-compat/rules/${ ruleName }`);
|
|
163
|
-
|
|
164
|
-
requiredRules = {
|
|
165
|
-
...requiredRules,
|
|
166
|
-
[ `rule:bpmnlint-plugin-camunda-compat/${ ruleName }` ]: requiredRule
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return requiredRules;
|
|
171
156
|
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
|
|
2
|
+
const cache = {};
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A resolver that caches rules and configuration as part of the bundle,
|
|
6
|
+
* making them accessible in the browser.
|
|
7
|
+
*
|
|
8
|
+
* @param {Object} cache
|
|
9
|
+
*/
|
|
10
|
+
function Resolver() {}
|
|
11
|
+
|
|
12
|
+
Resolver.prototype.resolveRule = function(pkg, ruleName) {
|
|
13
|
+
|
|
14
|
+
const rule = cache[pkg + '/' + ruleName];
|
|
15
|
+
|
|
16
|
+
if (!rule) {
|
|
17
|
+
throw new Error('cannot resolve rule <' + pkg + '/' + ruleName + '>: not bundled');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return rule;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
Resolver.prototype.resolveConfig = function(pkg, configName) {
|
|
24
|
+
throw new Error(
|
|
25
|
+
'cannot resolve config <' + configName + '> in <' + pkg +'>: not bundled'
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const resolver = new Resolver();
|
|
30
|
+
|
|
31
|
+
const rules = {
|
|
32
|
+
"camunda-compat/element-type": "error",
|
|
33
|
+
"camunda-compat/called-element": "error",
|
|
34
|
+
"camunda-compat/collapsed-subprocess": "error",
|
|
35
|
+
"camunda-compat/duplicate-task-headers": "error",
|
|
36
|
+
"camunda-compat/error-reference": "error",
|
|
37
|
+
"camunda-compat/escalation-reference": "error",
|
|
38
|
+
"camunda-compat/event-based-gateway-target": "error",
|
|
39
|
+
"camunda-compat/executable-process": "error",
|
|
40
|
+
"camunda-compat/feel": "error",
|
|
41
|
+
"camunda-compat/history-time-to-live": "error",
|
|
42
|
+
"camunda-compat/implementation": "error",
|
|
43
|
+
"camunda-compat/inclusive-gateway": "error",
|
|
44
|
+
"camunda-compat/loop-characteristics": "error",
|
|
45
|
+
"camunda-compat/message-reference": "error",
|
|
46
|
+
"camunda-compat/no-candidate-users": "error",
|
|
47
|
+
"camunda-compat/no-expression": "error",
|
|
48
|
+
"camunda-compat/no-multiple-none-start-events": "error",
|
|
49
|
+
"camunda-compat/no-signal-event-sub-process": "error",
|
|
50
|
+
"camunda-compat/no-task-schedule": "error",
|
|
51
|
+
"camunda-compat/no-template": "error",
|
|
52
|
+
"camunda-compat/no-zeebe-properties": "error",
|
|
53
|
+
"camunda-compat/sequence-flow-condition": "error",
|
|
54
|
+
"camunda-compat/signal-reference": "error",
|
|
55
|
+
"camunda-compat/subscription": "error",
|
|
56
|
+
"camunda-compat/task-schedule": "error",
|
|
57
|
+
"camunda-compat/timer": "error",
|
|
58
|
+
"camunda-compat/user-task-form": "error"
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const config = {
|
|
62
|
+
rules: rules
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const bundle = {
|
|
66
|
+
resolver: resolver,
|
|
67
|
+
config: config
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export { resolver, config };
|
|
71
|
+
|
|
72
|
+
export default bundle;
|
|
73
|
+
|
|
74
|
+
import rule_0 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/element-type';
|
|
75
|
+
|
|
76
|
+
cache['bpmnlint-plugin-camunda-compat/element-type'] = rule_0;
|
|
77
|
+
|
|
78
|
+
import rule_1 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/called-element';
|
|
79
|
+
|
|
80
|
+
cache['bpmnlint-plugin-camunda-compat/called-element'] = rule_1;
|
|
81
|
+
|
|
82
|
+
import rule_2 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/collapsed-subprocess';
|
|
83
|
+
|
|
84
|
+
cache['bpmnlint-plugin-camunda-compat/collapsed-subprocess'] = rule_2;
|
|
85
|
+
|
|
86
|
+
import rule_3 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/duplicate-task-headers';
|
|
87
|
+
|
|
88
|
+
cache['bpmnlint-plugin-camunda-compat/duplicate-task-headers'] = rule_3;
|
|
89
|
+
|
|
90
|
+
import rule_4 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/error-reference';
|
|
91
|
+
|
|
92
|
+
cache['bpmnlint-plugin-camunda-compat/error-reference'] = rule_4;
|
|
93
|
+
|
|
94
|
+
import rule_5 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/escalation-reference';
|
|
95
|
+
|
|
96
|
+
cache['bpmnlint-plugin-camunda-compat/escalation-reference'] = rule_5;
|
|
97
|
+
|
|
98
|
+
import rule_6 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/event-based-gateway-target';
|
|
99
|
+
|
|
100
|
+
cache['bpmnlint-plugin-camunda-compat/event-based-gateway-target'] = rule_6;
|
|
101
|
+
|
|
102
|
+
import rule_7 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/executable-process';
|
|
103
|
+
|
|
104
|
+
cache['bpmnlint-plugin-camunda-compat/executable-process'] = rule_7;
|
|
105
|
+
|
|
106
|
+
import rule_8 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/feel';
|
|
107
|
+
|
|
108
|
+
cache['bpmnlint-plugin-camunda-compat/feel'] = rule_8;
|
|
109
|
+
|
|
110
|
+
import rule_9 from 'bpmnlint-plugin-camunda-compat/rules/camunda-platform/history-time-to-live';
|
|
111
|
+
|
|
112
|
+
cache['bpmnlint-plugin-camunda-compat/history-time-to-live'] = rule_9;
|
|
113
|
+
|
|
114
|
+
import rule_10 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/implementation';
|
|
115
|
+
|
|
116
|
+
cache['bpmnlint-plugin-camunda-compat/implementation'] = rule_10;
|
|
117
|
+
|
|
118
|
+
import rule_11 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/inclusive-gateway';
|
|
119
|
+
|
|
120
|
+
cache['bpmnlint-plugin-camunda-compat/inclusive-gateway'] = rule_11;
|
|
121
|
+
|
|
122
|
+
import rule_12 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/loop-characteristics';
|
|
123
|
+
|
|
124
|
+
cache['bpmnlint-plugin-camunda-compat/loop-characteristics'] = rule_12;
|
|
125
|
+
|
|
126
|
+
import rule_13 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/message-reference';
|
|
127
|
+
|
|
128
|
+
cache['bpmnlint-plugin-camunda-compat/message-reference'] = rule_13;
|
|
129
|
+
|
|
130
|
+
import rule_14 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-candidate-users';
|
|
131
|
+
|
|
132
|
+
cache['bpmnlint-plugin-camunda-compat/no-candidate-users'] = rule_14;
|
|
133
|
+
|
|
134
|
+
import rule_15 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-expression';
|
|
135
|
+
|
|
136
|
+
cache['bpmnlint-plugin-camunda-compat/no-expression'] = rule_15;
|
|
137
|
+
|
|
138
|
+
import rule_16 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-multiple-none-start-events';
|
|
139
|
+
|
|
140
|
+
cache['bpmnlint-plugin-camunda-compat/no-multiple-none-start-events'] = rule_16;
|
|
141
|
+
|
|
142
|
+
import rule_17 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-signal-event-sub-process';
|
|
143
|
+
|
|
144
|
+
cache['bpmnlint-plugin-camunda-compat/no-signal-event-sub-process'] = rule_17;
|
|
145
|
+
|
|
146
|
+
import rule_18 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-task-schedule';
|
|
147
|
+
|
|
148
|
+
cache['bpmnlint-plugin-camunda-compat/no-task-schedule'] = rule_18;
|
|
149
|
+
|
|
150
|
+
import rule_19 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-template';
|
|
151
|
+
|
|
152
|
+
cache['bpmnlint-plugin-camunda-compat/no-template'] = rule_19;
|
|
153
|
+
|
|
154
|
+
import rule_20 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-zeebe-properties';
|
|
155
|
+
|
|
156
|
+
cache['bpmnlint-plugin-camunda-compat/no-zeebe-properties'] = rule_20;
|
|
157
|
+
|
|
158
|
+
import rule_21 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/sequence-flow-condition';
|
|
159
|
+
|
|
160
|
+
cache['bpmnlint-plugin-camunda-compat/sequence-flow-condition'] = rule_21;
|
|
161
|
+
|
|
162
|
+
import rule_22 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/signal-reference';
|
|
163
|
+
|
|
164
|
+
cache['bpmnlint-plugin-camunda-compat/signal-reference'] = rule_22;
|
|
165
|
+
|
|
166
|
+
import rule_23 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/subscription';
|
|
167
|
+
|
|
168
|
+
cache['bpmnlint-plugin-camunda-compat/subscription'] = rule_23;
|
|
169
|
+
|
|
170
|
+
import rule_24 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-schedule';
|
|
171
|
+
|
|
172
|
+
cache['bpmnlint-plugin-camunda-compat/task-schedule'] = rule_24;
|
|
173
|
+
|
|
174
|
+
import rule_25 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/timer';
|
|
175
|
+
|
|
176
|
+
cache['bpmnlint-plugin-camunda-compat/timer'] = rule_25;
|
|
177
|
+
|
|
178
|
+
import rule_26 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-form';
|
|
179
|
+
|
|
180
|
+
cache['bpmnlint-plugin-camunda-compat/user-task-form'] = rule_26;
|
package/lib/modeler/Linting.js
CHANGED
|
@@ -2,18 +2,9 @@ import { groupBy } from 'min-dash';
|
|
|
2
2
|
|
|
3
3
|
import { domify } from 'min-dom';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
</svg>
|
|
9
|
-
`;
|
|
10
|
-
|
|
11
|
-
const warningSvg = `
|
|
12
|
-
<svg width="16" height="16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
13
|
-
<path d="M12 3H4v10h8V3Z" fill="var(--linting-annotation-warning-stroke-color, black)"/>
|
|
14
|
-
<path d="M8 1C4.15 1 1 4.15 1 8s3.15 7 7 7 7-3.15 7-7-3.15-7-7-7Zm-.55 3h1.1v5.5h-1.1V4ZM8 12.5c-.4 0-.75-.35-.75-.75S7.6 11 8 11s.75.35.75.75-.35.75-.75.75Z" fill="var(--linting-annotation-warning-fill-color, white)"/>
|
|
15
|
-
</svg>
|
|
16
|
-
`;
|
|
5
|
+
import { renderOverlay } from './OverlayComponent';
|
|
6
|
+
import { is } from 'bpmn-js/lib/util/ModelUtil';
|
|
7
|
+
|
|
17
8
|
|
|
18
9
|
export default class LintingAnnotations {
|
|
19
10
|
constructor(canvas, elementRegistry, eventBus, overlays) {
|
|
@@ -47,26 +38,24 @@ export default class LintingAnnotations {
|
|
|
47
38
|
return;
|
|
48
39
|
}
|
|
49
40
|
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
const overlay = domify(`
|
|
53
|
-
<div class="bjs-linting-annotation ${ hasErrors ? 'bjs-linting-annotation--error' : 'bjs-linting-annotation--warning' }" title="Click to show">
|
|
54
|
-
${ hasErrors ? errorSvg : warningSvg }
|
|
55
|
-
</div>
|
|
41
|
+
const html = domify(`
|
|
42
|
+
<div class="cl-overlay-root"></div>
|
|
56
43
|
`);
|
|
57
44
|
|
|
58
|
-
|
|
59
|
-
|
|
45
|
+
renderOverlay(html, {
|
|
46
|
+
reports,
|
|
47
|
+
onClick: () => {
|
|
48
|
+
this._eventBus.fire('lintingAnnotations.click', { report: reports[ 0 ] });
|
|
49
|
+
}
|
|
60
50
|
});
|
|
61
51
|
|
|
52
|
+
const position = getAnnotationPosition(element);
|
|
53
|
+
|
|
62
54
|
const overlayId = this._overlays.add(element, 'linting', {
|
|
63
|
-
position
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
html: overlay,
|
|
68
|
-
show: {
|
|
69
|
-
minZoom: 0.5
|
|
55
|
+
position,
|
|
56
|
+
html,
|
|
57
|
+
scale: {
|
|
58
|
+
min: .7
|
|
70
59
|
}
|
|
71
60
|
});
|
|
72
61
|
|
|
@@ -80,4 +69,28 @@ LintingAnnotations.$inject = [
|
|
|
80
69
|
'elementRegistry',
|
|
81
70
|
'eventBus',
|
|
82
71
|
'overlays'
|
|
83
|
-
];
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
function getAnnotationPosition(element) {
|
|
76
|
+
|
|
77
|
+
if (!element.parent) {
|
|
78
|
+
|
|
79
|
+
if (is(element, 'bpmn:SubProcess')) {
|
|
80
|
+
return {
|
|
81
|
+
top: 50,
|
|
82
|
+
left: 150
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
top: 20,
|
|
88
|
+
left: 150
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
bottom: 13,
|
|
94
|
+
left: -6
|
|
95
|
+
};
|
|
96
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
render as renderComponent,
|
|
3
|
+
html
|
|
4
|
+
} from '@bpmn-io/diagram-js-ui';
|
|
5
|
+
|
|
6
|
+
import classNames from 'clsx';
|
|
7
|
+
|
|
8
|
+
const errorSvg = html`
|
|
9
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
|
10
|
+
<path d="M16,2C8.3,2,2,8.3,2,16s6.3,14,14,14s14-6.3,14-14S23.7,2,16,2z M21.4,23L16,17.6L10.6,23L9,21.4l5.4-5.4L9,10.6L10.6,9
|
|
11
|
+
l5.4,5.4L21.4,9l1.6,1.6L17.6,16l5.4,5.4L21.4,23z" fill="currentColor" />
|
|
12
|
+
</svg>
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
const warningSvg = html`
|
|
16
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
|
17
|
+
<path d="M16,2C8.3,2,2,8.3,2,16s6.3,14,14,14s14-6.3,14-14C30,8.3,23.7,2,16,2z M14.9,8h2.2v11h-2.2V8z M16,25
|
|
18
|
+
c-0.8,0-1.5-0.7-1.5-1.5S15.2,22,16,22c0.8,0,1.5,0.7,1.5,1.5S16.8,25,16,25z" fill="currentColor" />
|
|
19
|
+
</svg>
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
const infoSvg = html`
|
|
23
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
|
24
|
+
<path d="M16,2A14,14,0,1,0,30,16,14,14,0,0,0,16,2Zm0,6a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,16,8Zm4,16.125H12v-2.25h2.875v-5.75H13v-2.25h4.125v8H20Z" fill="currentColor" />
|
|
25
|
+
</svg>
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
const icons = {
|
|
29
|
+
error: errorSvg,
|
|
30
|
+
warn: warningSvg,
|
|
31
|
+
info: infoSvg
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export function OverlayComponent(props) {
|
|
35
|
+
|
|
36
|
+
const {
|
|
37
|
+
onClick = () => {},
|
|
38
|
+
reports
|
|
39
|
+
} = props;
|
|
40
|
+
|
|
41
|
+
const category =
|
|
42
|
+
reports.find(({ category }) => category === 'error')
|
|
43
|
+
? 'error'
|
|
44
|
+
: reports.find(({ category }) => category === 'warn')
|
|
45
|
+
? 'warn'
|
|
46
|
+
: 'info';
|
|
47
|
+
|
|
48
|
+
return html`
|
|
49
|
+
<div
|
|
50
|
+
class=${ classNames('cl-icon',`cl-icon-${category}`) }
|
|
51
|
+
onClick=${ onClick }
|
|
52
|
+
title="Click to show issue"
|
|
53
|
+
>
|
|
54
|
+
${ icons[category] }
|
|
55
|
+
</div>
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function renderOverlay(el, props) {
|
|
60
|
+
return renderComponent(html`<${OverlayComponent} ...${props} />`, el);
|
|
61
|
+
}
|
|
@@ -9,7 +9,10 @@ import {
|
|
|
9
9
|
|
|
10
10
|
import { getTypeString } from './types';
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
greaterOrEqual,
|
|
14
|
+
toSemverMinor
|
|
15
|
+
} from './version';
|
|
13
16
|
|
|
14
17
|
const TIMER_PROPERTIES = [
|
|
15
18
|
'timeCycle',
|
|
@@ -122,7 +125,7 @@ export function getErrorMessage(report, executionPlatform, executionPlatformVers
|
|
|
122
125
|
}
|
|
123
126
|
|
|
124
127
|
if (type === ERROR_TYPES.EXPRESSION_VALUE_NOT_ALLOWED) {
|
|
125
|
-
return getExpressionValueNotAllowedErrorMessage(report);
|
|
128
|
+
return getExpressionValueNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion);
|
|
126
129
|
}
|
|
127
130
|
|
|
128
131
|
if (type === ERROR_TYPES.EXPRESSION_NOT_ALLOWED) {
|
|
@@ -507,7 +510,7 @@ function getExpressionRequiredErrorMessage(report) {
|
|
|
507
510
|
return message;
|
|
508
511
|
}
|
|
509
512
|
|
|
510
|
-
function getExpressionValueNotAllowedErrorMessage(report) {
|
|
513
|
+
function getExpressionValueNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion) {
|
|
511
514
|
const {
|
|
512
515
|
data,
|
|
513
516
|
message
|
|
@@ -522,7 +525,11 @@ function getExpressionValueNotAllowedErrorMessage(report) {
|
|
|
522
525
|
const typeString = getTypeString(parentNode || node);
|
|
523
526
|
|
|
524
527
|
if (is(node, 'bpmn:FormalExpression') && property === 'timeCycle') {
|
|
525
|
-
|
|
528
|
+
if (!greaterOrEqual(executionPlatformVersion, '8.1')) {
|
|
529
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Time cycle> must be an expression, an ISO 8601 repeating interval, or a cron expression (cron only supported by Camunda Platform 8.1 or newer)`;
|
|
530
|
+
} else {
|
|
531
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Time cycle> must be an expression, an ISO 8601 repeating interval, or a cron expression`;
|
|
532
|
+
}
|
|
526
533
|
}
|
|
527
534
|
|
|
528
535
|
if (is(node, 'bpmn:FormalExpression') && property === 'timeDate') {
|
|
@@ -4,6 +4,8 @@ import { is } from 'bpmnlint-utils';
|
|
|
4
4
|
|
|
5
5
|
import { ERROR_TYPES } from 'bpmnlint-plugin-camunda-compat/rules/utils/error-types';
|
|
6
6
|
|
|
7
|
+
import { greaterOrEqual } from './version';
|
|
8
|
+
|
|
7
9
|
const TIMER_PROPERTIES = [
|
|
8
10
|
'timeDate',
|
|
9
11
|
'timeDuration',
|
|
@@ -85,6 +87,10 @@ export function getEntryIds(report) {
|
|
|
85
87
|
return [ 'signalRef' ];
|
|
86
88
|
}
|
|
87
89
|
|
|
90
|
+
if (isPropertyError(data, 'historyTimeToLive')) {
|
|
91
|
+
return [ 'historyTimeToLive' ];
|
|
92
|
+
}
|
|
93
|
+
|
|
88
94
|
if (isPropertyError(data, 'decisionId', 'zeebe:CalledDecision')) {
|
|
89
95
|
return [ 'decisionId' ];
|
|
90
96
|
}
|
|
@@ -264,7 +270,10 @@ export function getEntryIds(report) {
|
|
|
264
270
|
}
|
|
265
271
|
|
|
266
272
|
export function getErrorMessage(id, report) {
|
|
267
|
-
const {
|
|
273
|
+
const {
|
|
274
|
+
data = {},
|
|
275
|
+
executionPlatformVersion
|
|
276
|
+
} = report;
|
|
268
277
|
|
|
269
278
|
// do not override FEEL message
|
|
270
279
|
if (data.type === ERROR_TYPES.FEEL_EXPRESSION_INVALID) {
|
|
@@ -393,7 +402,11 @@ export function getErrorMessage(id, report) {
|
|
|
393
402
|
const { property } = data;
|
|
394
403
|
|
|
395
404
|
if (property === 'timeCycle') {
|
|
396
|
-
|
|
405
|
+
if (!greaterOrEqual(executionPlatformVersion, '8.1')) {
|
|
406
|
+
return 'Must be an expression, an ISO 8601 repeating interval, or a cron expression (cron only supported by Camunda Platform 8.1 or newer).';
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
return 'Must be an expression, an ISO 8601 repeating interval, or a cron expression.';
|
|
397
410
|
}
|
|
398
411
|
|
|
399
412
|
if (property === 'timeDate') {
|
package/lib/utils/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camunda/linting",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Linting for Camunda Platform",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
"start": "npm run start:cloud",
|
|
11
11
|
"start:platform": "cross-env SINGLE_START=platform npm run test:watch",
|
|
12
12
|
"start:cloud": "cross-env SINGLE_START=cloud npm run test:watch",
|
|
13
|
-
"test": "karma start",
|
|
14
|
-
"test:watch": "npm test -- --auto-watch --no-single-run"
|
|
13
|
+
"test": "npm run compile-config && karma start",
|
|
14
|
+
"test:watch": "npm test -- --auto-watch --no-single-run",
|
|
15
|
+
"compile-config": "node tasks/compile-config.js",
|
|
16
|
+
"prepublish": "npm run compile-config"
|
|
15
17
|
},
|
|
16
18
|
"keywords": [
|
|
17
19
|
"bpmnlint",
|
|
@@ -27,25 +29,29 @@
|
|
|
27
29
|
},
|
|
28
30
|
"license": "MIT",
|
|
29
31
|
"dependencies": {
|
|
32
|
+
"@bpmn-io/diagram-js-ui": "^0.2.2",
|
|
30
33
|
"bpmn-moddle": "^8.0.0",
|
|
31
|
-
"bpmnlint": "^9.
|
|
32
|
-
"bpmnlint-plugin-camunda-compat": "^1.
|
|
34
|
+
"bpmnlint": "^9.2.0",
|
|
35
|
+
"bpmnlint-plugin-camunda-compat": "^2.1.0",
|
|
33
36
|
"bpmnlint-utils": "^1.0.2",
|
|
37
|
+
"clsx": "^2.0.0",
|
|
34
38
|
"min-dash": "^4.0.0",
|
|
35
39
|
"min-dom": "^4.1.0",
|
|
36
40
|
"modeler-moddle": "^0.2.0",
|
|
41
|
+
"semver-compare": "^1.0.0",
|
|
37
42
|
"zeebe-bpmn-moddle": "^0.18.0"
|
|
38
43
|
},
|
|
39
44
|
"devDependencies": {
|
|
40
|
-
"bpmn-js": "^
|
|
41
|
-
"bpmn-js-
|
|
45
|
+
"bpmn-js": "^13.2.2",
|
|
46
|
+
"bpmn-js-element-templates": "^1.2.0",
|
|
47
|
+
"bpmn-js-properties-panel": "^3.0.0",
|
|
42
48
|
"camunda-bpmn-js-behaviors": "^0.6.0",
|
|
43
49
|
"chai": "^4.3.7",
|
|
44
50
|
"cross-env": "^7.0.3",
|
|
45
|
-
"eslint": "^8.
|
|
51
|
+
"eslint": "^8.45.0",
|
|
46
52
|
"eslint-plugin-bpmn-io": "^1.0.0",
|
|
47
|
-
"karma": "^6.4.
|
|
48
|
-
"karma-chrome-launcher": "^3.
|
|
53
|
+
"karma": "^6.4.2",
|
|
54
|
+
"karma-chrome-launcher": "^3.2.0",
|
|
49
55
|
"karma-debug-launcher": "0.0.5",
|
|
50
56
|
"karma-env-preprocessor": "^0.1.1",
|
|
51
57
|
"karma-mocha": "^2.0.1",
|
|
@@ -53,7 +59,7 @@
|
|
|
53
59
|
"karma-webpack": "^5.0.0",
|
|
54
60
|
"mocha": "^10.2.0",
|
|
55
61
|
"mocha-test-container-support": "^0.2.0",
|
|
56
|
-
"puppeteer": "^
|
|
62
|
+
"puppeteer": "^20.9.0",
|
|
57
63
|
"sinon": "^15.0.1",
|
|
58
64
|
"sinon-chai": "^3.7.0",
|
|
59
65
|
"webpack": "^5.75.0"
|