Skip to content

Commit

Permalink
fix: relax task-listener to not check implementation type
Browse files Browse the repository at this point in the history
This is to not lint a situation which can be achieved via manual XML modification.

Related to #182 (comment)
  • Loading branch information
barmac committed Nov 22, 2024
1 parent 56fb877 commit f6313a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 38 deletions.
11 changes: 2 additions & 9 deletions rules/camunda-cloud/task-listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ const { is } = require('bpmnlint-utils');

const {
findExtensionElement,
hasProperties,
hasExtensionElement
hasProperties
} = require('../utils/element');

const { reportErrors } = require('../utils/reporter');
Expand All @@ -23,14 +22,8 @@ module.exports = skipInNonExecutableProcess(function() {
return;
}

let errors = hasExtensionElement(node, 'zeebe:UserTask');

if (errors && errors.length) {
reportErrors(node, reporter, errors);
}

const listeners = taskListeners.get('listeners');
errors = listeners.flatMap(listener => hasProperties(listener, {
const errors = listeners.flatMap(listener => hasProperties(listener, {
type: {
required: true
}
Expand Down
29 changes: 0 additions & 29 deletions test/camunda-cloud/task-listener.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,35 +34,6 @@ const valid = [
];

const invalid = [
{
name: 'task listener not in zeebe:UserTask',
config: { version: '8.7' },
moddleElement: createModdle(createProcess(`
<bpmn:userTask id="UserTask_1">
<bpmn:extensionElements>
<zeebe:taskListeners>
<zeebe:taskListener eventType="complete" type="complete_listener" />
</zeebe:taskListeners>
</bpmn:extensionElements>
</bpmn:userTask>
`)),
report: {
id: 'UserTask_1',
message: 'Element of type <bpmn:UserTask> must have one extension element of type <zeebe:UserTask>',
path: [
'rootElements',
0,
'flowElements',
0
],
data: {
type: ERROR_TYPES.EXTENSION_ELEMENT_REQUIRED,
node: 'UserTask_1',
parentNode: null,
requiredExtensionElement: 'zeebe:UserTask'
}
}
},
{
name: 'task listener with empty type',
config: { version: '8.7' },
Expand Down

0 comments on commit f6313a1

Please sign in to comment.