From df3d36366e052e0615318ef48676e436092d3c82 Mon Sep 17 00:00:00 2001
From: Maciej Barelkowski <maciej.barelkowski@camunda.com>
Date: Fri, 22 Nov 2024 16:29:14 +0100
Subject: [PATCH] fix: relax `task-listener` to not check implementation type

This is to not lint a situation which can be achieved via manual XML modification.

Related to https://github.com/camunda/bpmnlint-plugin-camunda-compat/pull/182#discussion_r1854107263
---
 rules/camunda-cloud/task-listener.js     | 11 ++-------
 test/camunda-cloud/task-listener.spec.js | 29 ------------------------
 2 files changed, 2 insertions(+), 38 deletions(-)

diff --git a/rules/camunda-cloud/task-listener.js b/rules/camunda-cloud/task-listener.js
index 6fa2fd0..e04bd32 100644
--- a/rules/camunda-cloud/task-listener.js
+++ b/rules/camunda-cloud/task-listener.js
@@ -2,8 +2,7 @@ const { is } = require('bpmnlint-utils');
 
 const {
   findExtensionElement,
-  hasProperties,
-  hasExtensionElement
+  hasProperties
 } = require('../utils/element');
 
 const { reportErrors } = require('../utils/reporter');
@@ -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
       }
diff --git a/test/camunda-cloud/task-listener.spec.js b/test/camunda-cloud/task-listener.spec.js
index be1b7e3..5eea42f 100644
--- a/test/camunda-cloud/task-listener.spec.js
+++ b/test/camunda-cloud/task-listener.spec.js
@@ -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' },