From 776ddb5168174108f2d1c01a0bfaddd8e9e293d9 Mon Sep 17 00:00:00 2001
From: yodadado <yodadado@gmail.com>
Date: Wed, 16 Apr 2025 08:01:22 +0000
Subject: [PATCH] fix(pnpm): double dash not supported by pnpm

---
 templates/gitlab-ci-node.yml | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/templates/gitlab-ci-node.yml b/templates/gitlab-ci-node.yml
index b68c5e3..ef56da5 100644
--- a/templates/gitlab-ci-node.yml
+++ b/templates/gitlab-ci-node.yml
@@ -696,7 +696,12 @@ node-lint:
         # generate eslint report for SonarQube
         # shellcheck disable=SC2086
         log_info "SonarQube detected: producing ESLint JSON report..."
-        $NODE_MANAGER $NODE_LINT_ARGS -- --format=json --output-file=reports/node-lint.xslint.json || true
+        if [ "$NODE_MANAGER" = "pnpm" ]
+        then
+          $NODE_MANAGER $NODE_LINT_ARGS --format=json --output-file=reports/node-lint.xslint.json || true
+        else
+          $NODE_MANAGER $NODE_LINT_ARGS -- --format=json --output-file=reports/node-lint.xslint.json || true
+        fi
       fi
     # maybe add eslint-formatter-gitlab
     - |
@@ -707,7 +712,13 @@ node-lint:
       fi
     # run ESLint with console output and GitLab report
     # shellcheck disable=SC2086
-    - ESLINT_CODE_QUALITY_REPORT=reports/node-lint.gitlab.json $NODE_MANAGER $NODE_LINT_ARGS -- --format=gitlab
+    - |
+      if [ "$NODE_MANAGER" = "pnpm" ]
+      then
+        ESLINT_CODE_QUALITY_REPORT=reports/node-lint.gitlab.json $NODE_MANAGER $NODE_LINT_ARGS --format=gitlab
+      else
+        ESLINT_CODE_QUALITY_REPORT=reports/node-lint.gitlab.json $NODE_MANAGER $NODE_LINT_ARGS -- --format=gitlab
+      fi
   artifacts:
     when: always # store artifact even if test Failed
     name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG"
-- 
GitLab