From 9d6ea51be113fe40fcf435c8d383546cd2405194 Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Tue, 24 Nov 2020 15:22:00 -0500 Subject: [PATCH 1/4] Add linters to github actions --- .ci/azure-pipelines-lint.yml | 29 ------------------- .ci/azure-pipelines.yml | 1 - .github/workflows/lint.yml | 56 ++++++++++++++++++++++++++++++++++++ package.json | 2 +- 4 files changed, 57 insertions(+), 31 deletions(-) delete mode 100644 .ci/azure-pipelines-lint.yml create mode 100644 .github/workflows/lint.yml diff --git a/.ci/azure-pipelines-lint.yml b/.ci/azure-pipelines-lint.yml deleted file mode 100644 index 8d9efbd73a..0000000000 --- a/.ci/azure-pipelines-lint.yml +++ /dev/null @@ -1,29 +0,0 @@ -jobs: -- job: Lint - displayName: 'Lint' - - pool: - vmImage: 'ubuntu-latest' - - steps: - - task: NodeTool@0 - displayName: 'Install Node' - inputs: - versionSpec: '12.x' - - - task: Cache@2 - displayName: 'Cache node_modules' - inputs: - key: 'yarn | yarn.lock' - path: 'node_modules' - - - script: 'yarn install --frozen-lockfile' - displayName: 'Install Dependencies' - env: - SKIP_PREPARE: 'true' - - - script: 'yarn run lint --quiet' - displayName: 'Run ESLint' - - - script: 'yarn run stylelint' - displayName: 'Run Stylelint' diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index 3d7a5f1cde..d3b77d41bc 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -13,5 +13,4 @@ pr: jobs: - template: azure-pipelines-build.yml -- template: azure-pipelines-lint.yml - template: azure-pipelines-package.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000000..244f14580f --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,56 @@ +name: Lint + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + run-eslint: + name: Run eslint + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v1 + with: + node-version: 12 + + - name: Install Node.js dependencies + run: yarn + env: + SKIP_PREPARE: true + + - name: Run eslint + uses: reviewdog/action-eslint@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + eslint_flags: 'src/' + + run-stylelint: + name: Run stylelint + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v1 + with: + node-version: 12 + + - name: Install Node.js dependencies + run: yarn + env: + SKIP_PREPARE: true + + - name: Run stylelint + uses: reviewdog/action-stylelint@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + stylelint_input: 'src/**/*.css' diff --git a/package.json b/package.json index d36251c10f..25ecb72b43 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "prepare": "./scripts/prepare.sh", "build:development": "webpack --config webpack.dev.js", "build:production": "webpack --config webpack.prod.js", - "lint": "eslint \".\"", + "lint": "eslint \"src/\"", "stylelint": "yarn stylelint:css && yarn stylelint:scss", "stylelint:css": "stylelint \"src/**/*.css\"", "stylelint:scss": "stylelint --config=\".stylelintrc.scss.json\" \"src/**/*.scss\"" From 7ee40d841d0095cc3a7f6f40c8a0c0ac80403283 Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Mon, 30 Nov 2020 09:59:30 -0500 Subject: [PATCH 2/4] Add stylelint task for sass files --- .github/workflows/lint.yml | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 244f14580f..a5832e9ce3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -31,8 +31,8 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} eslint_flags: 'src/' - run-stylelint: - name: Run stylelint + run-stylelint-css: + name: Run stylelint (css) runs-on: ubuntu-latest steps: @@ -54,3 +54,28 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} stylelint_input: 'src/**/*.css' + + run-stylelint-scss: + name: Run stylelint (scss) + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v1 + with: + node-version: 12 + + - name: Install Node.js dependencies + run: yarn + env: + SKIP_PREPARE: true + + - name: Run stylelint + uses: reviewdog/action-stylelint@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + stylelint_config: '.stylelintrc.scss.json' + stylelint_input: 'src/**/*.scss' From 4c0ecba84a5255d6df924415368a1cdbbda4109e Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Mon, 30 Nov 2020 10:11:55 -0500 Subject: [PATCH 3/4] Cache node_modules and use frozen lockfile --- .github/workflows/lint.yml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a5832e9ce3..6bc4190481 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,8 +20,14 @@ jobs: with: node-version: 12 + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + - name: Install Node.js dependencies - run: yarn + run: yarn install --frozen-lockfile env: SKIP_PREPARE: true @@ -44,8 +50,14 @@ jobs: with: node-version: 12 + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + - name: Install Node.js dependencies - run: yarn + run: yarn install --frozen-lockfile env: SKIP_PREPARE: true @@ -68,8 +80,14 @@ jobs: with: node-version: 12 + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + - name: Install Node.js dependencies - run: yarn + run: yarn install --frozen-lockfile env: SKIP_PREPARE: true From e79e9e5f923947f9368514bb66ab7b75f569010c Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Mon, 30 Nov 2020 10:30:45 -0500 Subject: [PATCH 4/4] Use matchers instead of custom actions --- .github/workflows/lint.yml | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6bc4190481..8b9ca0b2f0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -32,10 +32,7 @@ jobs: SKIP_PREPARE: true - name: Run eslint - uses: reviewdog/action-eslint@v1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - eslint_flags: 'src/' + run: yarn lint run-stylelint-css: name: Run stylelint (css) @@ -50,6 +47,9 @@ jobs: with: node-version: 12 + - name: Set up stylelint matcher + uses: xt0rted/stylelint-problem-matcher@v1 + - name: Cache dependencies uses: actions/cache@v2 with: @@ -62,10 +62,7 @@ jobs: SKIP_PREPARE: true - name: Run stylelint - uses: reviewdog/action-stylelint@v1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - stylelint_input: 'src/**/*.css' + run: yarn stylelint:css run-stylelint-scss: name: Run stylelint (scss) @@ -80,6 +77,9 @@ jobs: with: node-version: 12 + - name: Set up stylelint matcher + uses: xt0rted/stylelint-problem-matcher@v1 + - name: Cache dependencies uses: actions/cache@v2 with: @@ -92,8 +92,4 @@ jobs: SKIP_PREPARE: true - name: Run stylelint - uses: reviewdog/action-stylelint@v1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - stylelint_config: '.stylelintrc.scss.json' - stylelint_input: 'src/**/*.scss' + run: yarn stylelint:scss