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

Bump the eslint group with 2 updates #5474

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

83 changes: 0 additions & 83 deletions .eslintrc

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x
cache: yarn
- name: Install dependencies
run: |
Expand All @@ -53,7 +53,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x
cache: yarn
- name: Install dependencies
run: |
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ jobs:
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Use node 16
- name: Use node 20
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x
cache: yarn
- name: Run tests
env:
Expand All @@ -63,7 +63,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x
cache: yarn
- name: Install dependencies
run: |
Expand Down Expand Up @@ -102,10 +102,10 @@ jobs:
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Use node 16
- name: Use node 20
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x
cache: yarn
- name: Setup chromium-chromedriver
uses: nanasess/setup-chromedriver@master
Expand Down
24 changes: 13 additions & 11 deletions app/assets/javascripts/course.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,39 +293,41 @@
const formCollapse = new bootstrap.Collapse(formCollapseElement, { toggle: false });

function initPanelLogic(): void {
document.getElementById("new-course").addEventListener("click", function () {
const newCourseButton = document.getElementById("new-course");
newCourseButton.addEventListener("click", function () {

Check warning on line 297 in app/assets/javascripts/course.ts

View check run for this annotation

Codecov / codecov/patch

app/assets/javascripts/course.ts#L296-L297

Added lines #L296 - L297 were not covered by tests
choosePanel.classList.add("hidden");
formPanel.querySelector(".step-circle").innerHTML = "2";
this.closest(".panel")
newCourseButton.closest(".panel")

Check warning on line 300 in app/assets/javascripts/course.ts

View check run for this annotation

Codecov / codecov/patch

app/assets/javascripts/course.ts#L300

Added line #L300 was not covered by tests
.querySelector(".answer")
.textContent = this.dataset.answer;
.textContent = newCourseButton.dataset.answer;
fetch("/courses/new.js")
.then(req => req.text())
.then(resp => eval(resp));
});

document.getElementById("copy-course").addEventListener("click", function () {
const copyCourseButton = document.getElementById("copy-course");
copyCourseButton.addEventListener("click", function () {

Check warning on line 309 in app/assets/javascripts/course.ts

View check run for this annotation

Codecov / codecov/patch

app/assets/javascripts/course.ts#L308-L309

Added lines #L308 - L309 were not covered by tests
choosePanel.classList.remove("hidden");
chooseCollapse.show();
choosePanel.querySelectorAll<HTMLInputElement>(`input[type="radio"]`).forEach(el => {
el.checked = false;
});
formPanel.classList.add("hidden");
formPanel.querySelector(".step-circle").innerHTML = "3";
this.closest(".panel")
copyCourseButton.closest(".panel")

Check warning on line 317 in app/assets/javascripts/course.ts

View check run for this annotation

Codecov / codecov/patch

app/assets/javascripts/course.ts#L317

Added line #L317 was not covered by tests
.querySelector(".answer")
.textContent = this.dataset.answer;
.textContent = copyCourseButton.dataset.answer;
});
}

function copyCoursesLoaded(): void {
document.querySelectorAll("[data-course_id]").forEach(el => {
document.querySelectorAll("[data-course_id]").forEach((el: HTMLElement) => {

Check warning on line 324 in app/assets/javascripts/course.ts

View check run for this annotation

Codecov / codecov/patch

app/assets/javascripts/course.ts#L324

Added line #L324 was not covered by tests
el.addEventListener("click", function () {
this.querySelector(`input[type="radio"]`).checked = true;
this.closest(".panel")
(el.querySelector(`input[type="radio"]`) as HTMLInputElement).checked = true;
el.closest(".panel")

Check warning on line 327 in app/assets/javascripts/course.ts

View check run for this annotation

Codecov / codecov/patch

app/assets/javascripts/course.ts#L326-L327

Added lines #L326 - L327 were not covered by tests
.querySelector(".answer")
.textContent = this.dataset.answer;
fetch(`/courses/new.js?copy_options[base_id]=${this.dataset.course_id}`)
.textContent = el.dataset.answer;
fetch(`/courses/new.js?copy_options[base_id]=${el.dataset.course_id}`)

Check warning on line 330 in app/assets/javascripts/course.ts

View check run for this annotation

Codecov / codecov/patch

app/assets/javascripts/course.ts#L330

Added line #L330 was not covered by tests
.then(req => req.text())
.then(resp => eval(resp));
});
Expand Down
12 changes: 6 additions & 6 deletions app/assets/javascripts/favorite_course_buttons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
function initFavoriteButtons(doc: Document | HTMLElement = document): void {
function init(): void {
doc.querySelectorAll(".favorite-button")
.forEach(btn => btn.addEventListener("click", toggleFavorite));
.forEach((btn: HTMLElement) => btn.addEventListener("click", () => toggleFavorite(btn)));

Check warning on line 9 in app/assets/javascripts/favorite_course_buttons.ts

View check run for this annotation

Codecov / codecov/patch

app/assets/javascripts/favorite_course_buttons.ts#L9

Added line #L9 was not covered by tests
}

function toggleFavorite(): void {
if (this.classList.contains("favorited")) {
unfavoriteCourse(this);
function toggleFavorite(btn: HTMLElement): void {

Check warning on line 12 in app/assets/javascripts/favorite_course_buttons.ts

View check run for this annotation

Codecov / codecov/patch

app/assets/javascripts/favorite_course_buttons.ts#L12

Added line #L12 was not covered by tests
if (btn.classList.contains("favorited")) {
unfavoriteCourse(btn);

Check warning on line 14 in app/assets/javascripts/favorite_course_buttons.ts

View check run for this annotation

Codecov / codecov/patch

app/assets/javascripts/favorite_course_buttons.ts#L14

Added line #L14 was not covered by tests
} else {
favoriteCourse(this);
favoriteCourse(btn);

Check warning on line 16 in app/assets/javascripts/favorite_course_buttons.ts

View check run for this annotation

Codecov / codecov/patch

app/assets/javascripts/favorite_course_buttons.ts#L16

Added line #L16 was not covered by tests
}
}

Expand Down Expand Up @@ -44,7 +44,7 @@
const cloneFavButton = clone.querySelector<HTMLButtonElement>(".favorite-button");
cloneFavButton.setAttribute("title", i18n.t("js.unfavorite-course-do"));
new bootstrap.Tooltip(cloneFavButton); // is enabled by default
cloneFavButton.addEventListener("click", toggleFavorite);
cloneFavButton.addEventListener("click", () => toggleFavorite(cloneFavButton));

Check warning on line 47 in app/assets/javascripts/favorite_course_buttons.ts

View check run for this annotation

Codecov / codecov/patch

app/assets/javascripts/favorite_course_buttons.ts#L47

Added line #L47 was not covered by tests
// hack to fix double rendering of content of lit element 'd-series-icon'
clone.querySelectorAll("d-series-icon").forEach((el: SeriesIcon) => {
el.replaceChildren();
Expand Down
4 changes: 2 additions & 2 deletions app/assets/javascripts/feedback/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export default class FeedbackActions {
});
const values = this.scoreForms.map(f => f.getDataForNested());
this.update({
// eslint-disable-next-line camelcase

scores_attributes: values
});
});
Expand All @@ -266,7 +266,7 @@ export default class FeedbackActions {
});
const values = this.scoreForms.map(f => f.getDataForNested());
this.update({
// eslint-disable-next-line camelcase

scores_attributes: values
});
});
Expand Down
10 changes: 5 additions & 5 deletions app/assets/javascripts/feedback/score.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export default class ScoreForm {
} else {
return {
score: this.input.value,
// eslint-disable-next-line camelcase

score_item_id: this.scoreItemId
};
}
Expand All @@ -148,15 +148,15 @@ export default class ScoreForm {
if (this.existing) {
data = {
score: this.input.value,
// eslint-disable-next-line camelcase

expected_score: this.expectedScore.value
};
} else {
data = {
score: this.input.value,
// eslint-disable-next-line camelcase

feedback_id: this.parent.options.feedbackId,
// eslint-disable-next-line camelcase

score_item_id: this.scoreItemId
};
}
Expand All @@ -173,7 +173,7 @@ export default class ScoreForm {

private delete(): void {
this.doRequest("delete", {
// eslint-disable-next-line camelcase

expected_score: this.expectedScore.value
});
}
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/iframe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
export function isInIframe(): boolean {
try {
return window.self !== window.top;
} catch (e) {
} catch {
return true;
}
}
2 changes: 1 addition & 1 deletion app/assets/javascripts/lti.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export function initLtiContentSelection(payloadUrl: string,
activities: activities,
series: seriesSelect ? seriesSelect.value : null,
course: courseSelect.value,
// eslint-disable-next-line camelcase

decoded_token: decodedToken
};
const responseRaw = await fetch(payloadUrl, {
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/question_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class QuestionTable {
body: JSON.stringify({
from: from,
question: {
// eslint-disable-next-line camelcase

question_state: to
}
})
Expand Down
6 changes: 3 additions & 3 deletions app/assets/javascripts/score_item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ function commonCheckboxInit(
function initTotalVisibilityCheckboxes(element: HTMLElement): void {
commonCheckboxInit(element, ".total-visibility-checkbox", checked => {
return {
// eslint-disable-next-line camelcase

evaluation_exercise: {
// eslint-disable-next-line camelcase

visible_score: checked
}
};
Expand All @@ -47,7 +47,7 @@ function initTotalVisibilityCheckboxes(element: HTMLElement): void {
function initItemVisibilityCheckboxes(element: HTMLElement): void {
commonCheckboxInit(element, ".visibility-checkbox", checked => {
return {
// eslint-disable-next-line camelcase

score_item: {
visible: checked
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class CTimeseriesGraph extends SeriesGraph {
>;

// data
// eslint-disable-next-line camelcase

private data: { ex_id: string, ex_data: { bin: d3.Bin<Date, Date>, cSum: number }[] }[] = [];
private studentCount: number; // amount of subscribed students
private maxSum = 0; // largest y-value == max value
Expand Down Expand Up @@ -187,7 +187,7 @@ export class CTimeseriesGraph extends SeriesGraph {
// eslint-disable-next-line camelcase
protected override processData({ data, exercises, student_count, deadline }: RawData): void {
this.data = [];
// eslint-disable-next-line camelcase

data as { ex_id: number, ex_data: (string | Date)[] }[];

this.parseExercises(exercises, data.map(ex => ex.ex_id));
Expand Down
2 changes: 0 additions & 2 deletions app/assets/javascripts/visualisations/series_graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ import { themeState } from "state/Theme";
import { i18n } from "i18n/i18n";

export type RawData = {
// eslint-disable-next-line camelcase
data: { ex_id: number, ex_data: unknown[] }[],
exercises: [number, string][],
// eslint-disable-next-line camelcase
student_count: number,
}

Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/visualisations/violin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable max-len */

// eslint-disable-next-line
// @ts-nocheck

Expand Down
Loading