Giter Site home page Giter Site logo

jparkrr / eslint-annotate-action Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ataylorme/eslint-annotate-action

0.0 0.0 0.0 1.38 MB

A GitHub action that takes ESLint results from a JSON file and adds them as annotated pull request comments

License: MIT License

JavaScript 0.60% TypeScript 99.40%

eslint-annotate-action's Introduction

ESLint Annotate from Report JSON

Version 2.2.0

Description

Analyzes an ESLint a report JSON file and posts the results.

On pull_request annotates the pull request diff with warnings and errors

image

On push creates a ESLint Report Analysis with a summary of errors and warnings, including links to the line numbers of the violations.

image

Why another ESLint action?

The others I tried to use ran ESLint in NodeJS themselves. With this action, I can take an ESLint report generated from the command line and process the results.

This allows for more flexibility on how ESLint is run. This action is agnostic enough to handle different configurations, extensions, etc. across projects without making assumptions on how ESLint should be run.

Inputs

Name Description Required Default Value
repo-token The GITHUB_TOKEN secret No ${{ github.token }}
report-json Path or glob pattern to locate the ESLint report JSON file. Use multiple lines to specify multiple glob patterns. No eslint_report.json
only-pr-files Only annotate files changed when run on the pull_request event No true
fail-on-warning Fail the GitHub Action when ESLint warnings are detected. Set to true to enable. No false
fail-on-error Whether to fail the Github action when ESLint errors are detected. If set to false, the check that is created will still fail on ESLint errors. No true
check-name The name of the GitHub status check created. No ESLint Report Analysis
markdown-report-on-step-summary Whether to show a markdown report in the step summary. No false

Outputs

Name Description
summary A short description of the error and warning count
errorCount The amount of errors ESLint reported on
warningCount The amount of warnings ESLint reported on

Usage Example

In .github/workflows/nodejs.yml:

name: Example NodeJS Workflow

on: [pull_request]

jobs:
  node_test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
      - name: Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: 16
          cache: 'npm'
      - name: Install Node Dependencies
        run: npm ci
        env:
          CI: TRUE
      - name: Test Code Linting
        run: npm run lint
      - name: Save Code Linting Report JSON
        # npm script for ESLint
        # eslint --output-file eslint_report.json --format json src
        # See https://eslint.org/docs/user-guide/command-line-interface#options
        run: npm run lint:report
        # Continue to the next step even if this fails
        continue-on-error: true
      - name: Annotate Code Linting Results
        uses: ataylorme/eslint-annotate-action@v2
        with:
          report-json: "eslint_report.json"
      # OPTIONAL: save a copy of the usage report for download or use in another job
      # - name: Upload ESLint report
      #   uses: actions/upload-artifact@v3
      #   with:
      #     name: eslint_report.json
      #     path: eslint_report.json
      #     retention-days: 5

eslint-annotate-action's People

Contributors

ataylorme avatar dependabot[bot] avatar imgbot[bot] avatar jmfrancois avatar jparkrr avatar krijnl avatar mskelton avatar velocibear avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.