Skip to content
Latchkey

Tests: ESLint (8-) workflow (jsx-eslint/eslint-plugin-react)

The Tests: ESLint (8-) workflow from jsx-eslint/eslint-plugin-react, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: jsx-eslint/eslint-plugin-react.github/workflows/eslint-8-.ymlLicense MITView source

What it does

This is the Tests: ESLint (8-) workflow from the jsx-eslint/eslint-plugin-react repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: 'Tests: ESLint (8-)'

on: [pull_request, push]

jobs:
  matrix:
    runs-on: ubuntu-latest
    outputs:
      latest: ${{ steps.set-matrix.outputs.requireds }}
      minors: ${{ steps.set-matrix.outputs.optionals }}
    steps:
      - uses: ljharb/actions/node/matrix@main
        id: set-matrix
        with:
          versionsAsRoot: true
          type: majors
          preset: '>=18'

  latest:
    needs: [matrix]
    name: 'latest majors'
    runs-on: ubuntu-latest

    strategy:
      fail-fast: false
      matrix:
        node-version: ${{ fromJson(needs.matrix.outputs.latest) }}
        eslint:
          - 8
          - 7
          - 6
          - 5
          - 4
          - 4.14 # last version without messageId
          - 3
        babel-eslint:
          - 10
          - 9
          - 8
        typescript-eslint:
          - 5
          - 6
          - 7
          - 8
        exclude:
          - eslint: 3
            babel-eslint: 10
          - eslint: 3
            typescript-eslint: 5
          - eslint: 4
            typescript-eslint: 5
          - eslint: 4.14
            typescript-eslint: 5
          - eslint: 5
            typescript-eslint: 5
          - eslint: 3
            typescript-eslint: 6
          - eslint: 4
            typescript-eslint: 6
          - eslint: 4.14
            typescript-eslint: 6
          - eslint: 5
            typescript-eslint: 6
          - eslint: 6
            typescript-eslint: 6
          - eslint: 3
            typescript-eslint: 7
          - eslint: 4
            typescript-eslint: 7
          - eslint: 4.14
            typescript-eslint: 7
          - eslint: 5
            typescript-eslint: 7
          - eslint: 6
            typescript-eslint: 7
          - eslint: 7
            typescript-eslint: 7
          - eslint: 3
            typescript-eslint: 8
          - eslint: 4
            typescript-eslint: 8
          - eslint: 4.14
            typescript-eslint: 8
          - eslint: 5
            typescript-eslint: 8
          - eslint: 6
            typescript-eslint: 8
          - eslint: 7
            typescript-eslint: 8
          - node-version: 19
            typescript-eslint: 7

    steps:
      - uses: actions/checkout@v4
      - name: strip eslint-doc-generator to avoid peer conflicts
        if: ${{ matrix.typescript-eslint >= 6 }}
        run: echo "$(jq 'del(.devDependencies["eslint-doc-generator"])' package.json)" > package.json
      - uses: ljharb/actions/node/install@main
        name: 'nvm install ${{ matrix.node-version }} && npm install'
        with:
          node-version: ${{ matrix.node-version }}
          after_install: |
            npm install --no-save "eslint@${{ matrix.eslint }}" "@typescript-eslint/parser@${{ matrix.typescript-eslint == 8 && 8.17 || matrix.typescript-eslint }}" "babel-eslint@${{ matrix.babel-eslint }}"
        env:
          NPM_CONFIG_LEGACY_PEER_DEPS: "${{ matrix.typescript-eslint >= 6 && 'false' || 'true' }}"
      - run: npx ls-engines
      - run: npm run unit-test
      - uses: codecov/codecov-action@v3.1.5

  node:
    name: 'eslint 8-'
    needs: [latest]
    runs-on: ubuntu-latest
    steps:
      - run: true

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: 'Tests: ESLint (8-)'
 
on: [pull_request, push]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  matrix:
    timeout-minutes: 30
    runs-on: latchkey-small
    outputs:
      latest: ${{ steps.set-matrix.outputs.requireds }}
      minors: ${{ steps.set-matrix.outputs.optionals }}
    steps:
      - uses: ljharb/actions/node/matrix@main
        id: set-matrix
        with:
          versionsAsRoot: true
          type: majors
          preset: '>=18'
 
  latest:
    timeout-minutes: 30
    needs: [matrix]
    name: 'latest majors'
    runs-on: latchkey-small
 
    strategy:
      fail-fast: false
      matrix:
        node-version: ${{ fromJson(needs.matrix.outputs.latest) }}
        eslint:
          - 8
          - 7
          - 6
          - 5
          - 4
          - 4.14 # last version without messageId
          - 3
        babel-eslint:
          - 10
          - 9
          - 8
        typescript-eslint:
          - 5
          - 6
          - 7
          - 8
        exclude:
          - eslint: 3
            babel-eslint: 10
          - eslint: 3
            typescript-eslint: 5
          - eslint: 4
            typescript-eslint: 5
          - eslint: 4.14
            typescript-eslint: 5
          - eslint: 5
            typescript-eslint: 5
          - eslint: 3
            typescript-eslint: 6
          - eslint: 4
            typescript-eslint: 6
          - eslint: 4.14
            typescript-eslint: 6
          - eslint: 5
            typescript-eslint: 6
          - eslint: 6
            typescript-eslint: 6
          - eslint: 3
            typescript-eslint: 7
          - eslint: 4
            typescript-eslint: 7
          - eslint: 4.14
            typescript-eslint: 7
          - eslint: 5
            typescript-eslint: 7
          - eslint: 6
            typescript-eslint: 7
          - eslint: 7
            typescript-eslint: 7
          - eslint: 3
            typescript-eslint: 8
          - eslint: 4
            typescript-eslint: 8
          - eslint: 4.14
            typescript-eslint: 8
          - eslint: 5
            typescript-eslint: 8
          - eslint: 6
            typescript-eslint: 8
          - eslint: 7
            typescript-eslint: 8
          - node-version: 19
            typescript-eslint: 7
 
    steps:
      - uses: actions/checkout@v4
      - name: strip eslint-doc-generator to avoid peer conflicts
        if: ${{ matrix.typescript-eslint >= 6 }}
        run: echo "$(jq 'del(.devDependencies["eslint-doc-generator"])' package.json)" > package.json
      - uses: ljharb/actions/node/install@main
        name: 'nvm install ${{ matrix.node-version }} && npm install'
        with:
          node-version: ${{ matrix.node-version }}
          after_install: |
            npm install --no-save "eslint@${{ matrix.eslint }}" "@typescript-eslint/parser@${{ matrix.typescript-eslint == 8 && 8.17 || matrix.typescript-eslint }}" "babel-eslint@${{ matrix.babel-eslint }}"
        env:
          NPM_CONFIG_LEGACY_PEER_DEPS: "${{ matrix.typescript-eslint >= 6 && 'false' || 'true' }}"
      - run: npx ls-engines
      - run: npm run unit-test
      - uses: codecov/codecov-action@v3.1.5
 
  node:
    timeout-minutes: 30
    name: 'eslint 8-'
    needs: [latest]
    runs-on: latchkey-small
    steps:
      - run: true
 

What changed

2 third-party actions are referenced by a movable tag. Pin them to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 3 jobs (86 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow