Skip to content

:octocat: Github action to run ESLint on changed pull request files with support for reporting errors via Github checks.

License

Notifications You must be signed in to change notification settings

notAravind/eslint-changed-files

 
 

Repository files navigation

Ubuntu Mac OS Windows Public workflows that use this action.

Test Update release version.

All Contributors

eslint-changed-files

Run ESLint on either all files or selectively run ESLint on only changed files in a pull request with support for inline annotations of ESLint Warnings & Errors.

Screen Shot 2022-03-04 at 5 01 35 AM

Features

  • Easy to debug
  • Fast execution
  • Fix ESlint errors
  • Glob pattern extension filtering
  • Excludes ignored files from change detection.
  • Inline annotations of ESLint Warnings & Errors.
  • Inline annotations with possible resolutions that can be applied to the Pull Request.
  • Monorepo support.

Example

Screen Shot 2021-09-06 at 1 15 22 PM

Usage

...:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: 20.x

      - name: Install dependencies
        run: npm ci  # OR: yarn 

      - name: Run eslint on changed files
        uses: tj-actions/eslint-changed-files@v23
        with:
          config_path: "/path/to/.eslintrc"
          ignore_path: "/path/to/.eslintignore"
          extra_args: "--max-warnings=0"

For more working examples view the test.yml

If you feel generous and want to show some extra appreciation:

Support this project with a ⭐

Buy me a coffee

Inputs

- uses: tj-actions/eslint-changed-files@v23
  id: eslint-changed-files
  with:
    # Run [ESlint](https://eslint.org) on all matching files.
    # Type: boolean
    # Default: "false"
    all_files: ''

    # [ESlint](https://eslint.org/) [configuration file](https://eslint.org/docs/user-guide/configuring/). Optionally omit this input for Mono repositories. 
    # Type: string
    config_path: ''

    # Extra arguments passed to [ESlint](https://eslint.org/docs/user-guide/command-line-interface)
    # Type: string
    extra_args: ''

    # Exit code for reviewdog when errors are found.
    # Type: boolean
    # Default: "true"
    fail_on_error: ''

    # List of file extensions to watch for changes and 
    # run [ESlint](https://eslint.org/) against. 
    # Type: string
    # Default: **/*.{ts,tsx,js,jsx}
    #          
    file_extensions: ''

    # [Filter mode](https://github.com/reviewdog/reviewdog#filter-mode) for the reviewdog command (added, diff_context, file, nofilter). 
    # Type: string
    # Default: "added"
    filter_mode: ''

    # [ESlint](https://eslint.org/) [ignore file](https://eslint.org/docs/user-guide/configuring/ignoring-code)
    # Type: string
    ignore_path: ''

    # Report level for reviewdog (info,warning,error)
    # Type: string
    # Default: "error"
    level: ''

    # Relative path under GITHUB_WORKSPACE to the repository
    # Type: string
    # Default: "."
    path: ''

    # [Reporter](https://github.com/reviewdog/reviewdog#reporters) of reviewdog command (github-check, github-pr-review). github-pr-review can use Markdown 
    # and add a link to rule page in reviewdog 
    # reports. 
    # Type: string
    # Default: "github-pr-review"
    reporter: ''

    # Skip running reviewdog i.e don't add any annotations.
    # Type: boolean
    # Default: "false"
    skip_annotations: ''

    # [GITHUB TOKEN](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#using-the-github_token-in-a-workflow) or a repo scoped [Personal Access Token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token)
    # Type: string
    # Default: "${{ github.token }}"
    token: ''

Credits

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Clinton Blackburn

💻

Sava Vidakovic

💻 ⚠️ 📖

This project follows the all-contributors specification. Contributions of any kind welcome!

About

:octocat: Github action to run ESLint on changed pull request files with support for reporting errors via Github checks.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 41.3%
  • TypeScript 23.4%
  • HTML 18.7%
  • CSS 10.6%
  • JavaScript 6.0%