Skip to content

Apply linting & formatting globally #1

Apply linting & formatting globally

Apply linting & formatting globally #1

name: Lint and Format Code Base
on:
pull_request:
paths:
- 'src/**/*.js'
jobs:
lint_and_format:
name: runner / eslint and prettier
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Important to fetch all history for diff
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: npm install
- name: Run ESLint with reviewdog
uses: reviewdog/action-eslint@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
eslint_flags: 'src'
filter_mode: 'diff_context'
- name: Run Prettier with reviewdog
uses: EPMatt/reviewdog-action-prettier@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
prettier_flags: '--check src/**/*.js'
filter_mode: 'diff_context'