Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot make linter ignore specific rules #3333

Open
aspiers opened this issue Jan 18, 2025 · 3 comments
Open

cannot make linter ignore specific rules #3333

aspiers opened this issue Jan 18, 2025 · 3 comments

Comments

@aspiers
Copy link

aspiers commented Jan 18, 2025

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.

@Rob--W
Copy link
Member

Rob--W commented Jan 30, 2025

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

@aspiers
Copy link
Author

aspiers commented Jan 30, 2025

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

@Rob--W
Copy link
Member

Rob--W commented Jan 30, 2025

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

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

No branches or pull requests

2 participants