From 1fba4bacfb4b7f7dea0e2083da84306bceded904 Mon Sep 17 00:00:00 2001
From: Daniel Rainer <daniel.m.rainer@student.uibk.ac.at>
Date: Tue, 1 Mar 2022 20:44:52 +0100
Subject: [PATCH] Add eslint job

---
 .gitlab-ci.yml | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 164d0f9f2..132972569 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -5,7 +5,7 @@ cache:
   paths:
     - .maven/
 stages:
-  - check
+  - lint
   - build
   - test
   - analyze
@@ -17,11 +17,20 @@ before_script:
   - export MAVEN_USER_HOME=`pwd`/.maven
 
 checkstyle:
-  stage: check
+  stage: lint
   script:
     - ./mvnw -ntp checkstyle:check -Dmaven.repo.local=$MAVEN_USER_HOME
   needs: []
 
+eslint:
+  stage: lint
+  script:
+    - npm install
+    # eslint exits 0 on warnings, this is a workaround to exit 1 when warnings are present.
+    - "! npm run lint | grep -qE '✖ [0-9]+ problem'"
+  allow_failure: true
+  needs: []
+
 maven-compile:
   stage: build
   script:
-- 
GitLab