actions / actions/setup-node

How to use the ESLint annotations?

Open
#96 8 comments 13 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
5k
Forks
1.7k
Avg merge
3d 12h
Merged PRs (30d)
2

Description

It's my first time using the annotations feature, so please forgive me if this issue is irrelevant.

I'm trying to have annotations in the PR, however all I can get is a simple annotation in the actions screen with irrelevant information. I'm guessing that's a problem of mine, and since there's not a lot documentation (that I could find) about this might as well ask.

Screenshot 2019-12-18 at 09 39 49

That's the output of a failing eslint job. The current configuration is:

  quality:
    needs: [build]

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1

      - uses: actions/setup-node@v1
        with:
          node-version: "12.x"

      - name: Cache node modules
        id: cache
        uses: actions/cache@v1
        with:
          path: node_modules # npm cache files are stored in `~/.npm` on Linux/macOS
          key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-build-${{ env.cache-name }}-
            ${{ runner.os }}-build-
            ${{ runner.os }}-

      - name: Install Dependencies
        if: steps.cache.outputs.cache-hit != 'true'
        run: npm ci

      - name: Prettier
        run: npm run fmt:check

      - name: ESlint
        run: npm run eslint:github-action

where my package.json looks like:

  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^2.12.0",
    "@typescript-eslint/parser": "^2.12.0",
    "eslint": "^6.7.2",
    "eslint-config-prettier": "^6.7.0",
    "prettier": "^1.19.1",
    "serverless-dynamodb-local": "^0.2.38",
    "serverless-offline": "^5.12.1",
    "serverless-plugin-typescript": "^1.1.9",
    "typescript": "^3.7.3"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "lint": "eslint functions/**.ts",
    "eslint:github-action": "eslint functions/**",
    "fmt": "prettier --write ./**.{json,js,ts,yml,md}",
    "fmt:check": "prettier --check ./**.{json,js,ts,yml,md}"
  },

I expected that the following error would actually appear in the annotation, and hopefully in the PR too.

 /home/runner/work/utom.is/utom.is/functions/a.ts
  1:0  error  Parsing error: Declaration or statement expected

but as you can get the from screenshot, all I have is that the process completed with error 1.

Is my expectation wrong? Or do I have something misconfigured?

Thanks

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the workflow YAML and package.json scripts shown in the issue, especially the eslint:github-action command and its output. Check the repository's existing documentation or action behavior for ESLint annotations, then document whether this setup should produce pull-request annotations and what configuration is required.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, github-actions, node.js, typescript
Domain
ci-cd, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.