Skip to content
alert-octagon

GitHub Action

No ESLint Disable Directives

v1.2.0 Latest version

No ESLint Disable Directives

alert-octagon

No ESLint Disable Directives

Validates that there are no eslint-disable directives in your code

Installation

Copy and paste the following snippet into your .yml file.

              

- name: No ESLint Disable Directives

uses: naomi-lgbt/[email protected]

Learn more about this action in naomi-lgbt/eslint-disable-action

Choose a version

Eslint Disable Action

This is a basic GitHub Action that checks specified directories for eslint-disable comments and fails the run if any are found.

Usage

To use this action, create a workflow file in your repository's .github/workflows directory. An example workflow file is provided below.

name: Node.js CI
on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  ci:
    name: Lint / Build / Test
    runs-on: ubuntu-20.04

    strategy:
      matrix:
        node-version: [18.x]

    steps:
      - name: Checkout Source Files
        uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3

      - name: Use Node.js v${{ matrix.node-version }}
        uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
        with:
          node-version: ${{ matrix.node-version }}

      - name: Install Dependencies
        run: npm ci

      - name: Check for eslint-disable
        uses: naomi-lgbt/eslint-disable-action@main
        with:
          directories: "src test"

      - name: Lint Source Files
        run: npm run lint

      - name: Verify Build
        run: npm run build

      - name: Run Tests
        run: npm run test

The directories input should be a list of file paths to check for eslint-disable comments. Paths should be space separated.

Fail Mode

By default, the action will log errors and set a failed status if eslint-disable directives are found. If you'd rather see warnings and no failure status, set the fail-mode input to false.

      - name: Check for eslint-disable
        uses: naomi-lgbt/eslint-disable-action@main
        with:
          directories: "src test"
          fail-mode: false

Feedback and Bugs

If you have feedback or a bug report, please feel free to open a GitHub issue!

Contributing

If you would like to contribute to the project, you may create a Pull Request containing your proposed changes and we will review it as soon as we are able! Please review our contributing guidelines first.

Code of Conduct

Before interacting with our community, please read our Code of Conduct.

License

This software is licensed under our global software license.

Copyright held by Naomi Carrigan.

Contact

We may be contacted through our Chat Server or via email at [email protected].