Reviewdog : configure reviewdog for eslint using github actions

22 Oct 2022

To make the eslint issues more visible on pull requests, especially the warnings, we used to add comments on PR as part of our review process.

This manual process is error-prone and slows down our review process. To make it streamlined, I was looking for a tool which can report the eslint errors/warnings as PR review annotations on the exact line where eslint finds the problems. Thus I came to know about reviewdog. Luckily reviewdog has GitHub actions for eslint which is perfect for us.

Below is the sample GitHub action file we use in our projects.

# .github/workflows/reviewdog.yml

name: reviewdog
on: [pull_request]
    name: runner / eslint
    runs-on: ubuntu-latest
      contents: read
      pull-requests: write
      - uses: actions/checkout@v2
      - uses: reviewdog/action-eslint@v1
          github_token: ${{ secrets.GITHUB_TOKEN }}
          reporter: github-pr-review # Change reporter.
          eslint_flags: 'src/'

The permission block in reviewdog.yml will give the required permissions for the GITHUB_TOKEN generated for the action.

Here is the reviewdog in action,

reviewdog comment in action

I hope you will find it helpful and try it in one of your projects.

If you find my work helpful, You can buy me a coffee.