Skip to content

Commit

Permalink
Ignore invalid manifest version lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
frigus02 committed Mar 19, 2023
1 parent 7b40461 commit f500ec6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions .addonslinterignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
# Setting innerHTML in rester-dom-purify-frame.html should be fine because HTML
# is sanitized with DOMPurify.
site/scripts/bundle.js UNSAFE_VAR_ASSIGNMENT
<no_file> JSON_INVALID "/manifest_version" must be <= 2
13 changes: 7 additions & 6 deletions tools/scripts/lint-firefox-addon.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import chalk from 'chalk';
import logSymbols from 'log-symbols';

const ignoreFileName = '.addonslinterignore';
const noFileToken = '<no_file>';

/**
* Lints a Firefox addon.
Expand Down Expand Up @@ -47,8 +48,7 @@ async function lintFirefoxAddon(options) {
result.count = 0;
for (let list of lists) {
result[list] = result[list].filter((message) => {
const file = message.file ? resolvePath(message.file) : '<no file>';

const file = message.file ? resolvePath(message.file) : noFileToken;
const ignoreEntry = ignoreList.find(
(ignore) => ignore.file === file && ignore.code === message.code
);
Expand Down Expand Up @@ -100,17 +100,18 @@ function getIgnoreList() {
// <file> <code>
let [file, code] = line.split(' ');

if (file !== noFileToken) {
file = resolvePath(file);
}

// Some codes sentences instead of short, uppercase names. In
// this case the code should start with "_" in the ignore file
// and all spaces should be replaced by "_".
if (code.startsWith('_')) {
code = code.substr(1).replace(/_/g, ' ');
}

ignore.push({
file: resolvePath(file),
code,
});
ignore.push({ file, code });
});

lineReader.on('close', () => {
Expand Down

0 comments on commit f500ec6

Please sign in to comment.