Skip to content

Commit f5222c8

Browse files
committed
linting fixes
1 parent 88fec36 commit f5222c8

8 files changed

Lines changed: 9 additions & 21 deletions

File tree

src/count-words-in-textarea/plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
let dismissed = false;
66

7-
LSI.on("beforeSaveAnnotation", (store, annotation) => {
7+
LSI.on("beforeSaveAnnotation", (_store, annotation) => {
88
const textAreaResult = annotation.results.find((r) => r.type === "textarea" && r.from_name.name === "textarea");
99

1010
if (textAreaResult) {

src/llm-backend/plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async function fetchLLM(prompt) {
2323
},
2424
});
2525

26-
const data = await response.json();
26+
return await response.json();
2727
}
2828

2929
/**

src/ner-text-span-overlap-validation/plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Validates there are no NER text spans overlap before submitting an annotation
33
*/
44

5-
LSI.on("beforeSaveAnnotation", (store, annotation) => {
5+
LSI.on("beforeSaveAnnotation", () => {
66
const existingEntities = Htx.annotationStore.selected.regions;
77

88
const textRegions = existingEntities.filter(

src/pausing-annotator/plugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function calcDeviation(data) {
9292
const mid = n / 2;
9393
const mean = data.reduce((a, b) => a + b) / n;
9494

95-
const k = data.reduce((a, b, i) => a + (b - mean) * (i - mid), 0) / data.reduce((a, b, i) => a + (i - mid) ** 2, 0);
95+
const k = data.reduce((a, b, i) => a + (b - mean) * (i - mid), 0) / data.reduce((a, _b, i) => a + (i - mid) ** 2, 0);
9696
const mse = data.reduce((a, b, i) => a + (b - (k * (i - mid) + mean)) ** 2, 0) / n;
9797

9898
return Math.abs(mse);
@@ -113,7 +113,7 @@ LSI.on("submitAnnotation", async (_store, annotation) => {
113113
let stats = [];
114114
try {
115115
stats = JSON.parse(localStorage.getItem(key)) ?? [];
116-
} catch (e) {
116+
} catch (_e) {
117117
// Ignore parse errors
118118
}
119119
stats.push({ values, created_at: Date.now() / 1000 });

src/redact-pii/plugin.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,6 @@ async function fetchUserInfo() {
2424
return data;
2525
}
2626

27-
/**
28-
* Give visibility to the given selector
29-
*/
30-
function displayEl(sel) {
31-
const els = document.querySelectorAll(sel);
32-
if (els) {
33-
els.forEach((el, idx) => {
34-
el.style.display = "block";
35-
});
36-
}
37-
}
38-
3927
/**
4028
* If the logged in user is an Admin, remove the styling added to the view that hides
4129
* the annotator identity

src/simple-content-moderation/plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
let dismissed = false;
1515

16-
LSI.on("beforeSaveAnnotation", (store, ann) => {
16+
LSI.on("beforeSaveAnnotation", (_store, ann) => {
1717
// text in TextArea is always an array
1818
const obscene = ann.results.find((r) => r.type === "textarea" && r.value.text.some((t) => t.includes("hate")));
1919
if (!obscene || dismissed) return true;

src/spellcheck/plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const dictionary = new Typo("en_US", false, false, {
1111
});
1212
const WORD_REGEX = /\w+/g;
1313

14-
LSI.on("beforeSaveAnnotation", async (store, annotation) => {
14+
LSI.on("beforeSaveAnnotation", async (_store, annotation) => {
1515
// Find all textareas with misspellings
1616
const misspelledAreas = annotation.results.filter(
1717
(r) =>

src/validate-json-in-textarea/plugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
* Validate the JSON data introduced in the textarea is valid.
33
*/
44

5-
LSI.on("beforeSaveAnnotation", (store, annotation) => {
5+
LSI.on("beforeSaveAnnotation", (_store, annotation) => {
66
const textAreaResult = annotation.results.find((r) => r.type === "textarea" && r.from_name.name === "textarea");
77
if (textAreaResult) {
88
try {
99
JSON.parse(textAreaResult.value.text[0]);
10-
} catch (e) {
10+
} catch (_e) {
1111
Htx.showModal("Invalid JSON format. Please correct the JSON and try again.", "error");
1212
return false;
1313
}

0 commit comments

Comments
 (0)