Skip to content

cannot make linter ignore specific rules #3333

Open

Description

@aspiers

Even though addons-linter supports disabling specific rules, it seems that there is no way to use this feature when invoking web-ext lint. Based on a very quick glance at the code, maybe fixing this is as simple as adding disableLinterRules here?

web-ext/src/cmd/lint.js

Lines 32 to 48 in 61464c8

const config = {
logLevel: verbose ? 'debug' : 'fatal',
stack: Boolean(verbose),
pretty,
privileged,
warningsAsErrors,
metadata,
output,
boring,
selfHosted,
shouldScanFile: (fileName) => fileFilter.wantFile(fileName),
minManifestVersion: 2,
maxManifestVersion: 3,
// This mimics the first command line argument from yargs, which should be
// the directory to the extension.
_: [sourceDir],
};

The only workaround seems to be to ignore whole files, but this is undesirable for the same reason it's undesirable in other linters like eslint: it runs the risk of missing other rule violations in the ignored file.

Activity

  1. Rob--W commented on Jan 30, 2025

    @Rob--W
    Member

    We're supportive of a way to ignore specific rules. Patches are welcome!

  2. aspiers commented on Jan 30, 2025

    @aspiers
    Author

    Thanks. Do you happen to know if my surface-deep assessment above is along the right lines?

  3. Rob--W commented on Jan 30, 2025

    @Rob--W
    Member

    Thanks. Do you happen to know if my surface-deep assessment above is along the right lines?

    Looks reasonable. The config will be read and forwarded internally by https://github.com/mozilla/addons-linter/blob/c5a1c2c73a44935451628bba5e3d1249cbdfad27/src/linter.js#L430

  4. giri256 commented on Jul 24, 2026

    @giri256

    I’m working on exposing disableLinterRules through web-ext configuration/CLI and forwarding it to addons-linter, with unit tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions