From c022f47f077d8ffa41700294e1401cbac6238870 Mon Sep 17 00:00:00 2001 From: sbriat Date: Thu, 30 Mar 2023 10:47:45 +0200 Subject: [PATCH 1/2] lint pretty --check --- .eslintrc.js | 2 +- .gitlab-ci.yml | 19 ++++++++++++++++++- .prettierignore | 7 +++++++ .prettierrc => .prettierrc.json | 0 package.json | 3 +++ 5 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 .prettierignore rename .prettierrc => .prettierrc.json (100%) diff --git a/.eslintrc.js b/.eslintrc.js index 8f5aedb..259de13 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { parser: '@typescript-eslint/parser', parserOptions: { project: 'tsconfig.json', - tsconfigRootDir : __dirname, + tsconfigRootDir: __dirname, sourceType: 'module', }, plugins: ['@typescript-eslint/eslint-plugin'], diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fa2d70f..9408f53 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,25 @@ image: docker:20.10.22 stages: + - test - build +############## +# TEST STAGE # +############## + +test: + stage: test + variables: + DOCKER_TLS_CERTDIR: '' + script: + - npm install + - npm run lint:check + - npm run pretty:check + rules: + - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH || $CI_COMMIT_MESSAGE =~ /--check/ || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' + when: always + ############### # BUILD STAGE # ############### @@ -11,7 +28,7 @@ build: stage: build image: docker:20.10.22 variables: - DOCKER_TLS_CERTDIR: "" + DOCKER_TLS_CERTDIR: '' services: - docker:dind before_script: diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..2ebbbb1 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,7 @@ +node_modules +*.log* +logs +.env +dist +coverage +.prettierrc.json diff --git a/.prettierrc b/.prettierrc.json similarity index 100% rename from .prettierrc rename to .prettierrc.json diff --git a/package.json b/package.json index 1449078..4997d88 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,9 @@ "start:debug": "nest start --debug --watch", "start:prod": "node dist/main", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", + "lint:check": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix-dry-run --ignore-path .gitignore", + "pretty:check": "./node_modules/.bin/prettier --check .", + "pretty": "./node_modules/.bin/prettier --write .", "test": "jest", "test:watch": "jest --watch", "test:cov": "jest --coverage", From e85764a88f21a6118b9716fc2c90290b5204bf8c Mon Sep 17 00:00:00 2001 From: sbriat Date: Thu, 30 Mar 2023 10:48:59 +0200 Subject: [PATCH 2/2] lint pretty --check --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9408f53..ec12685 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: docker:20.10.22 +image: node:18-alpine3.16 stages: - test