From bced86dc6b4b16c7c168752192b328c78a4815bd Mon Sep 17 00:00:00 2001 From: Akshat Patel <38994122+Akshat55@users.noreply.github.com> Date: Fri, 3 May 2024 14:08:56 -0400 Subject: [PATCH] ci: add lint job for build flow (#306) * ci: add lint job for build flow Signed-off-by: Akshat Patel * chore: add 'application' and 'library' tags to respective projects Signed-off-by: Akshat Patel * chore: run lint command on all apps and libs Signed-off-by: Akshat Patel --------- Signed-off-by: Akshat Patel --- .editorconfig | 5 +++++ .github/workflows/build.yml | 25 +++++++++++++++++++++++++ app/project.json | 2 +- package.json | 4 ++-- player/react/project.json | 2 +- sdk/react/project.json | 2 +- 6 files changed, 35 insertions(+), 5 deletions(-) diff --git a/.editorconfig b/.editorconfig index 507f1bc4f..d574f122c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,3 +12,8 @@ trim_trailing_whitespace = true [*.md] max_line_length = off trim_trailing_whitespace = false + + +[*.yml] +indent_style = space +indent_size = 2 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 80cf7bb7a..4df033949 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,6 +11,31 @@ on: workflow_dispatch: jobs: + lint: + runs-on: ubuntu-latest + steps: + # Checkout to branch + - name: Checkout + uses: actions/checkout@v3 + + # Set up node to use v16 & cache node modules + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: "20" + cache: "npm" + cache-dependency-path: "package-lock.json" + + # Install dependencies + - name: Install dependencies + run: npm install + + # Check files are linted + - name: Run nx lint + run: npm run lint + env: + CI: true + build: runs-on: ubuntu-latest steps: diff --git a/app/project.json b/app/project.json index f2a776297..ebd76334b 100644 --- a/app/project.json +++ b/app/project.json @@ -3,7 +3,7 @@ "$schema": "../node_modules/nx/schemas/project-schema.json", "sourceRoot": "app/src", "projectType": "application", - "tags": [], + "tags": ["application"], "targets": { "build": { "executor": "@nx/vite:build", diff --git a/package.json b/package.json index 76e852c85..089b0f68a 100644 --- a/package.json +++ b/package.json @@ -91,8 +91,8 @@ "version": "nx release version", "start": "nx serve app", "build": "nx build app", - "lint": "nx lint app", - "lint:fix": "nx lint app --fix", + "lint": "nx run-many --projects=tag:library,tag:application --target=lint", + "lint:fix": "nx run-many --projects=tag:library,tag:application --target=lint --fix", "prepare": "husky install" }, "browserslist": [ diff --git a/player/react/project.json b/player/react/project.json index 893ff20ee..3f345f761 100644 --- a/player/react/project.json +++ b/player/react/project.json @@ -3,7 +3,7 @@ "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "player/react/src", "projectType": "library", - "tags": [], + "tags": ["library"], "targets": { "lint": { "executor": "@nx/eslint:lint", diff --git a/sdk/react/project.json b/sdk/react/project.json index dd097f511..c53156600 100644 --- a/sdk/react/project.json +++ b/sdk/react/project.json @@ -3,7 +3,7 @@ "$schema": "../node_modules/nx/schemas/project-schema.json", "sourceRoot": "sdk/react/src", "projectType": "library", - "tags": [], + "tags": ["library"], "targets": { "lint": { "executor": "@nx/eslint:lint",