From c96d31ab30f6237afca7cb6cb0b187c26d4fc88a Mon Sep 17 00:00:00 2001 From: RahiDroid Date: Tue, 26 Apr 2022 15:55:38 +0530 Subject: [PATCH 1/8] Feat: Add JS & CSS lint actions on PR --- .github/workflows/lint-js-css.yml | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/lint-js-css.yml diff --git a/.github/workflows/lint-js-css.yml b/.github/workflows/lint-js-css.yml new file mode 100644 index 00000000..5a9936e0 --- /dev/null +++ b/.github/workflows/lint-js-css.yml @@ -0,0 +1,45 @@ +name: Lint JS, CSS + +on: + branches: + - main + pull_request: + paths: + - '**.js' + - '.eslint*' + - '**.css' + - '.nvmrc' + - '.stylelint*' + - '**/package.json' + - 'package-lock.json' + +jobs: + lint: + name: Lint JS, CSS + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: npm + + - name: Install dependencies + run: npm ci + + - name: JS Lint + run: npm run lint:js + + - name: CSS Lint + run: npm run lint:css + + - name: JS Lint + run: npm run lint:js + + - name: JS Lint Report + run: npm run lint:js:report + continue-on-error: true From ac94a5849cd248040dee484f630b9e3cf7193064 Mon Sep 17 00:00:00 2001 From: RahiDroid Date: Tue, 26 Apr 2022 16:00:14 +0530 Subject: [PATCH 2/8] Fix: Syntax error because of indentation --- .github/workflows/lint-js-css.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint-js-css.yml b/.github/workflows/lint-js-css.yml index 5a9936e0..081243c3 100644 --- a/.github/workflows/lint-js-css.yml +++ b/.github/workflows/lint-js-css.yml @@ -1,8 +1,8 @@ name: Lint JS, CSS on: - branches: - - main + branches: + - main pull_request: paths: - '**.js' From 59d99da1e20e3acb3ad7b1af54a0e6eaebf0c921 Mon Sep 17 00:00:00 2001 From: RahiDroid Date: Tue, 26 Apr 2022 16:01:55 +0530 Subject: [PATCH 3/8] Chore: Remove incorrect value for 'on' --- .github/workflows/lint-js-css.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/lint-js-css.yml b/.github/workflows/lint-js-css.yml index 081243c3..0ec8d895 100644 --- a/.github/workflows/lint-js-css.yml +++ b/.github/workflows/lint-js-css.yml @@ -1,8 +1,6 @@ name: Lint JS, CSS on: - branches: - - main pull_request: paths: - '**.js' From 99dfe3c39bfdf2c64e7e9e6d023f3e88bf2b4069 Mon Sep 17 00:00:00 2001 From: RahiDroid Date: Tue, 26 Apr 2022 16:37:50 +0530 Subject: [PATCH 4/8] Feat: Add concurrency & package.json linting --- .github/workflows/lint-js-css.yml | 18 ++++++++++++++++-- package.json | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint-js-css.yml b/.github/workflows/lint-js-css.yml index 0ec8d895..0f974a7f 100644 --- a/.github/workflows/lint-js-css.yml +++ b/.github/workflows/lint-js-css.yml @@ -1,21 +1,32 @@ -name: Lint JS, CSS +name: Lint JS, CSS, package.json on: pull_request: + types: + - synchronize + - opened + - ready_for_review + paths: - '**.js' - '.eslint*' - '**.css' + - '**.scss' - '.nvmrc' - '.stylelint*' - '**/package.json' - 'package-lock.json' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: lint: - name: Lint JS, CSS + name: Lint JS, CSS, package.json runs-on: ubuntu-latest timeout-minutes: 15 + steps: - name: Checkout uses: actions/checkout@v3 @@ -41,3 +52,6 @@ jobs: - name: JS Lint Report run: npm run lint:js:report continue-on-error: true + + - name: package.json Lint + run: npm run lint:package-json diff --git a/package.json b/package.json index 161a701d..cc263644 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "lint:js:report": "npm run lint:js -- --output-file lint-js-report.json --format json .", "lint:php": "vendor/bin/phpcs", "lint:php:fix": "./bin/phpcbf.sh", - "lint:pkg-json": "wp-scripts lint-pkg-json --ignorePath .gitignore", + "lint:package-json": "wp-scripts lint-pkg-json --ignorePath .gitignore", "lint:staged": "lint-staged", "prepare": "husky install && npm run init", "start": "wp-scripts start", From a740e0d49e9ef5a444a30b8ef413fc842242aae5 Mon Sep 17 00:00:00 2001 From: Rahi Prajapati <59014930+RahiDroid@users.noreply.github.com> Date: Tue, 26 Apr 2022 16:53:11 +0530 Subject: [PATCH 5/8] Chore: Remove duplicate entry Co-authored-by: Lovekesh Kumar --- .github/workflows/lint-js-css.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/lint-js-css.yml b/.github/workflows/lint-js-css.yml index 0f974a7f..2898b024 100644 --- a/.github/workflows/lint-js-css.yml +++ b/.github/workflows/lint-js-css.yml @@ -46,9 +46,6 @@ jobs: - name: CSS Lint run: npm run lint:css - - name: JS Lint - run: npm run lint:js - - name: JS Lint Report run: npm run lint:js:report continue-on-error: true From 57f2d1b7e050a21b93e7bcf02a5414cf9edada11 Mon Sep 17 00:00:00 2001 From: RahiDroid Date: Tue, 26 Apr 2022 16:46:36 +0530 Subject: [PATCH 6/8] Refact: Rename workflow name --- .github/workflows/lint-js-css.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-js-css.yml b/.github/workflows/lint-js-css.yml index 2898b024..c5495104 100644 --- a/.github/workflows/lint-js-css.yml +++ b/.github/workflows/lint-js-css.yml @@ -1,4 +1,4 @@ -name: Lint JS, CSS, package.json +name: Linting on: pull_request: From d26f8fc9b01c3eed9244b0648831c6f7a39f452b Mon Sep 17 00:00:00 2001 From: RahiDroid Date: Tue, 26 Apr 2022 17:15:54 +0530 Subject: [PATCH 7/8] Feat: Add package-json-lint config --- .npmpackagejsonlintrc.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .npmpackagejsonlintrc.json diff --git a/.npmpackagejsonlintrc.json b/.npmpackagejsonlintrc.json new file mode 100644 index 00000000..e7ceb227 --- /dev/null +++ b/.npmpackagejsonlintrc.json @@ -0,0 +1,5 @@ +{ + "rules": { + "valid-values-license": ["error", ["MIT"]] + } +} From e6c355d7689c51252bcb4f0617dce88bb90bd70e Mon Sep 17 00:00:00 2001 From: RahiDroid Date: Tue, 26 Apr 2022 17:16:21 +0530 Subject: [PATCH 8/8] Chore: Remove Git prefix from URL --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cc263644..ca5b95fa 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "homepage": "https://github.com/rtCamp/theme-elementary#readme", "repository": { "type": "git", - "url": "git+https://github.com/rtCamp/theme-elementary.git" + "url": "https://github.com/rtCamp/theme-elementary.git" }, "bugs": { "url": "https://github.com/rtCamp/theme-elementary/issues"