actions-linter icon indicating copy to clipboard operation
actions-linter copied to clipboard

Workaround feature: add magic inline comments to disable validating (or specific rules) for a line or block

Open JamesMGreene opened this issue 4 years ago • 2 comments

When I ran into #48, it hit me that maybe it is time for this linter to support a common feature from other linters: the ability to add a magic comment to ignore validating the next line (or block, or whatever), e.g.:

# actions-linter-ignore-next-line
runs-on: ${{ fromJSON('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }}

Prior art: pretty much every linter I've used.

ESLint has a pretty verbose set of options available here: https://eslint.org/docs/2.13.1/user-guide/configuring#disabling-rules-with-inline-comments

Basically:

  • disable for blocks with a disable + enable pair of comments on their own lines
  • disable for the current line with a trailing inline comment
  • disable for the next line with an inline comment on its own line

Disabling for the next line would meet my current needs, though I imagine disabling blocks delivers the most versatile usage patterns that anyone might need.

JamesMGreene avatar Jan 29 '21 15:01 JamesMGreene

Plus one. I ran into the same issue, while trying to use an action that uses the query keyword.

image

image

mjacobus avatar Dec 10 '21 19:12 mjacobus

Plus one. I ran into the same issue, while trying to use an action that uses the query keyword.

Update: For this action I actually misconfigured the query param by accidentally removing 2 leading spaces, making query a sibling of with instead of a child.

steps:
  - uses: lee-dohm/close-matching-issues@v2
    with:
    query: 'label:weekly-issue' # mistake, bad indentation
      token: ${{ secrets.GITHUB_TOKEN }}

mjacobus avatar Dec 14 '21 10:12 mjacobus