Skip to content

Commit

Permalink
Fix new linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-c committed Oct 21, 2024
1 parent 8424b31 commit 0222527
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion addon/src/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function getCoverage(revPromise, path) {

function disableButton(button, text) {
button.setAttribute("disabled", "disabled");
button.style["cursor"] = "not-allowed";
button.style.cursor = "not-allowed";
button.title = text;
}

Expand Down
4 changes: 2 additions & 2 deletions addon/src/dxr-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ let lineNoMap = (function () {
export async function applyOverlay(revPromise, path) {
let result = await getCoverage(revPromise, path);

if (!result.hasOwnProperty("coverage")) {
if (!Object.prototype.hasOwnProperty.call(result, "coverage")) {
throw new Error("No 'coverage' field");
}
for (var l in result.coverage) {
Expand Down Expand Up @@ -65,7 +65,7 @@ export function removeOverlay() {
export function getPath() {
const breadcrumbs = document.querySelector(".breadcrumbs");
if (!breadcrumbs) {
return;
return null;
}

return breadcrumbs.lastElementChild.href.split("/mozilla-central/source/")[1];
Expand Down
6 changes: 3 additions & 3 deletions addon/src/hgmo.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ document.querySelectorAll("title").forEach((title) => {

async function applyOverlay(revPromise, path) {
let result = await getCoverage(revPromise, path);
if (!result.hasOwnProperty("coverage")) {
if (!Object.prototype.hasOwnProperty.call(result, "coverage")) {
throw new Error("No 'coverage' field");
}
const data = result["coverage"];
const data = result.coverage;
document.querySelectorAll("[id^='l']").forEach((e) => {
const m = e.id.match(linePattern);
if (!m) {
return;
}
const linenum = m[1];
if (data.hasOwnProperty(linenum)) {
if (Object.prototype.hasOwnProperty.call(data, linenum)) {
e.style.backgroundColor = data[linenum] > 0 ? "greenyellow" : "tomato";
}
});
Expand Down
15 changes: 9 additions & 6 deletions addon/src/socorro.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ document
}
const revision = m[1].slice(0, 12); // shorten the revision
const info = {
line: line,
line,
element: a.parentNode,
};
let finfo;
Expand All @@ -47,7 +47,7 @@ document
}
});

if (Object.keys(fileinfo).length != 0) {
if (Object.keys(fileinfo).length) {
const spinnerDiv = document.createElement("div");
spinnerDiv.classList.add(
"gecko_coverage_loader",
Expand All @@ -71,18 +71,21 @@ if (Object.keys(fileinfo).length != 0) {
}
fetchCoverage(revision, filename)
.then((data) => {
if (data !== null && !data.hasOwnProperty("error")) {
if (!data.hasOwnProperty("coverage")) {
if (
data !== null &&
!Object.prototype.hasOwnProperty.call(data, "error")
) {
if (!Object.prototype.hasOwnProperty.call(data, "coverage")) {
throw new Error("No 'data' field");
}
const covData = data["coverage"];
const covData = data.coverage;
for (const le of lineElements) {
const line = le.line;
if (line in covData) {
// line is covered or uncovered
le.element.parentNode.style.backgroundColor =
covData[line] == 0 ? "tomato" : "greenyellow";
const gitBuildChangeset = data["git_build_changeset"];
const gitBuildChangeset = data.git_build_changeset;
const codecovUrl = `https://codecov.io/gh/mozilla/gecko-dev/src/${gitBuildChangeset}/${filename}#L${line}`;
const a = linkToCodecov.cloneNode(true);
a.setAttribute("href", codecovUrl);
Expand Down

0 comments on commit 0222527

Please sign in to comment.