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

chore(frontend): eslint v9 #612

Merged
merged 3 commits into from
Feb 18, 2025
Merged
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
27 changes: 0 additions & 27 deletions frontend/.eslintignore

This file was deleted.

8 changes: 0 additions & 8 deletions frontend/.eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/.stylelintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
"at-rule-empty-line-before": ["never", { ignoreAtRules: ["import"] }], // we use empty lines to group/order imports (su)
"selector-class-pattern": null, // we can ignore this because most css is styling 3rd party components where we don't control the class names
"import-notation": null, // doesn't really work with postcss-import
"at-rule-no-unknown": [
"at-rule-no-deprecated": [
true,
{
ignoreAtRules: ["apply"], // ignore tailwind decorators
Expand Down
2 changes: 0 additions & 2 deletions frontend/app/abilities/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ export default class ReportAbility extends Ability {
const isEditable =
this.user?.isSuperuser ||
(!this.model?.verifiedBy?.get("id") &&
// eslint-disable-next-line ember/no-get
(this.model?.user?.get("id") === this.user?.get("id") ||
// eslint-disable-next-line ember/no-get
(this.model?.user?.get("supervisors") ?? [])
.map((s) => s.id)
.includes(this.user?.get("id"))));
Expand Down
3 changes: 2 additions & 1 deletion frontend/app/analysis/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { dasherize } from "@ember/string";
import { tracked } from "@glimmer/tracking";
import { task } from "ember-concurrency";

import {
underscoreQueryParams,
serializeQueryParams,
Expand Down Expand Up @@ -205,7 +206,7 @@
});

this.notify.success("Reports were saved");
} catch (e) {
} catch {
this.notify.error("Error while saving the reports");
}

Expand Down Expand Up @@ -240,7 +241,7 @@
// We have to defer the rollback for some milliseconds since the combobox
// reset action triggers mutation of customer, task, and project which
// would be run after this rollback and therefore trigger changes
later(() => {

Check warning on line 244 in frontend/app/analysis/edit/controller.js

View workflow job for this annotation

GitHub Actions / lint (js)

Don't use @ember/runloop functions. Use ember-lifeline, ember-concurrency, or @ember/destroyable instead. For this case, you can replace `later` with `runTask` from ember-lifeline
changeset.rollback();
});
}
Expand Down
1 change: 1 addition & 0 deletions frontend/app/analysis/edit/route.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Route from "@ember/routing/route";

import { resetQueryParams } from "timed/utils/query-params";

export default class AnalysisEditRoute extends Route {
Expand Down
8 changes: 4 additions & 4 deletions frontend/app/analysis/index/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import {
} from "ember-concurrency";
import fetch from "fetch";
import moment from "moment";

import config from "../../config/environment";

import QPController from "timed/controllers/qpcontroller";
import parseDjangoDuration from "timed/utils/parse-django-duration";
import parseFileName from "timed/utils/parse-filename";
Expand All @@ -24,8 +27,6 @@ import {
import { serializeMoment } from "timed/utils/serialize-moment";
import { cleanParams, toQueryString } from "timed/utils/url";

import config from "../../config/environment";

export default class AnalysisController extends QPController {
queryParams = [
"customer",
Expand Down Expand Up @@ -341,8 +342,7 @@ export default class AnalysisController extends QPController {
download(file, filename, file.type);

this.notify.success("File was downloaded");
} catch (e) {
/* istanbul ignore next */
} catch {
this.notify.error(
"Error while downloading, try again or try reducing results",
);
Expand Down
1 change: 1 addition & 0 deletions frontend/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { registerDateLibrary } from "ember-power-calendar";
import DateUtils from "ember-power-calendar-moment";
import Resolver from "ember-resolver";
import fastRedact from "fast-redact";

import config from "timed/config/environment";

import "simplebar";
Expand Down
1 change: 1 addition & 0 deletions frontend/app/components/attendance-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { dropTask } from "ember-concurrency";
import moment from "moment";

import formatDuration from "timed/utils/format-duration";
import { pad2joincolon } from "timed/utils/pad";

Expand Down
3 changes: 2 additions & 1 deletion frontend/app/components/datepicker-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
*/

import { action } from "@ember/object";
import Datepicker from "timed/components/datepicker";
import { localCopy } from "tracked-toolbox";

import Datepicker from "timed/components/datepicker";

/**
* The datepicker buttn component
*
Expand Down
1 change: 0 additions & 1 deletion frontend/app/components/duration-since.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export default class DurationSinceComponent extends Component {
* @public
*/
timer = task(async () => {
// eslint-disable-next-line no-constant-condition
while (true) {
this._compute();

Expand Down
1 change: 1 addition & 0 deletions frontend/app/components/durationpicker-day.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { action } from "@ember/object";
import moment from "moment";

import DurationpickerComponent from "timed/components/durationpicker";
import parseDayTime from "timed/utils/parse-daytime";

Expand Down
3 changes: 2 additions & 1 deletion frontend/app/components/durationpicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { action } from "@ember/object";
import { guidFor } from "@ember/object/internals";
import { tracked } from "@glimmer/tracking";
import moment from "moment";
import { localCopy } from "tracked-toolbox";

import TimepickerComponent from "timed/components/timepicker";
import formatDuration from "timed/utils/format-duration";
import { localCopy } from "tracked-toolbox";

const { MIN_SAFE_INTEGER, MAX_SAFE_INTEGER } = Number;
const { abs } = Math;
Expand Down
1 change: 1 addition & 0 deletions frontend/app/components/report-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { action } from "@ember/object";
import { service } from "@ember/service";
import Component from "@glimmer/component";
import { dropTask } from "ember-concurrency";

import ReportValidations from "timed/validations/report";

export default class ReportRowComponent extends Component {
Expand Down
1 change: 1 addition & 0 deletions frontend/app/components/statistic-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { get } from "@ember/object";
import { capitalize } from "@ember/string";
import Component from "@glimmer/component";
import moment from "moment";

import parseDjangoDuration from "timed/utils/parse-django-duration";

const PLAIN_LAYOUT = "PLAIN";
Expand Down
3 changes: 2 additions & 1 deletion frontend/app/components/task-selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
import { restartableTask, timeout, dropTask } from "ember-concurrency";
import { trackedTask } from "reactiveweb/ember-concurrency";
import { resolve } from "rsvp";
import { localCopy } from "tracked-toolbox";

import customerOptionTemplate from "timed/components/optimized-power-select/custom-options/customer-option";
import projectOptionTemplate from "timed/components/optimized-power-select/custom-options/project-option";
import taskOptionTemplate from "timed/components/optimized-power-select/custom-options/task-option";
import customSelectedTemplate from "timed/components/optimized-power-select/custom-select/task-selection";
import { localCopy } from "tracked-toolbox";
/**
* Component for selecting a task, which consists of selecting a customer and
* project first.
Expand Down Expand Up @@ -61,7 +62,7 @@

if (this.args.liveTracking) {
// we track "_activity" here since we can not track the public getters directly
this.tracking.addObserver(

Check warning on line 65 in frontend/app/components/task-selection.js

View workflow job for this annotation

GitHub Actions / lint (js)

Don't use observers
"_activity",
this.handleTrackingActiveActivityChanged.perform,
);
Expand Down Expand Up @@ -317,7 +318,7 @@
}

if (!options.preventAction) {
later(this, () => {

Check warning on line 321 in frontend/app/components/task-selection.js

View workflow job for this annotation

GitHub Actions / lint (js)

Don't use @ember/runloop functions. Use ember-lifeline, ember-concurrency, or @ember/destroyable instead. For this case, you can replace `later` with `runTask` from ember-lifeline
(this.args["on-set-customer"] === undefined
? () => {}
: this.args["on-set-customer"])(value);
Expand Down Expand Up @@ -349,7 +350,7 @@
}

if (!options.preventAction) {
later(this, () => {

Check warning on line 353 in frontend/app/components/task-selection.js

View workflow job for this annotation

GitHub Actions / lint (js)

Don't use @ember/runloop functions. Use ember-lifeline, ember-concurrency, or @ember/destroyable instead. For this case, you can replace `later` with `runTask` from ember-lifeline
(this.args["on-set-project"] === undefined
? () => {}
: this.args["on-set-project"])(value);
Expand All @@ -374,7 +375,7 @@
}

if (!options.preventAction) {
later(this, async () => {

Check warning on line 378 in frontend/app/components/task-selection.js

View workflow job for this annotation

GitHub Actions / lint (js)

Don't use @ember/runloop functions. Use ember-lifeline, ember-concurrency, or @ember/destroyable instead. For this case, you can replace `later` with `runTask` from ember-lifeline
(this.args["on-set-task"] === undefined
? () => {}
: this.args["on-set-task"])(value);
Expand Down
1 change: 0 additions & 1 deletion frontend/app/components/timed-clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@
constructor(...args) {
super(...args);

scheduleOnce("actions", this.timer, "perform");

Check warning on line 27 in frontend/app/components/timed-clock.js

View workflow job for this annotation

GitHub Actions / lint (js)

Don't use @ember/runloop functions. Use ember-lifeline, ember-concurrency, or @ember/destroyable instead
}

timer = task(async () => {
// eslint-disable-next-line no-constant-condition
while (true) {
this._update();

Expand Down
1 change: 1 addition & 0 deletions frontend/app/components/user-selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { restartableTask } from "ember-concurrency";
import { trackedTask } from "reactiveweb/ember-concurrency";

import customOptionTemplate from "timed/components/optimized-power-select/custom-options/user-option";
import customSelectedTemplate from "timed/components/optimized-power-select/custom-select/user-selection";

Expand Down
1 change: 1 addition & 0 deletions frontend/app/components/worktime-balance-chart.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Component from "@glimmer/component";
import moment from "moment";

import humanizeDuration from "timed/utils/humanize-duration";

// TODO: take this from tailwind.config.js
Expand Down
1 change: 1 addition & 0 deletions frontend/app/helpers/format-duration.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @public
*/
import { helper } from "@ember/component/helper";

import formatDuration from "timed/utils/format-duration";

/**
Expand Down
1 change: 1 addition & 0 deletions frontend/app/helpers/humanize-duration.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @public
*/
import { helper } from "@ember/component/helper";

import humanizeDuration from "timed/utils/humanize-duration";

/**
Expand Down
1 change: 1 addition & 0 deletions frontend/app/helpers/parse-django-duration.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @public
*/
import { helper } from "@ember/component/helper";

import parseDjangoDuration from "timed/utils/parse-django-duration";

/**
Expand Down
3 changes: 1 addition & 2 deletions frontend/app/index/activities/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,7 @@ export default class ActivitiesIndexController extends Controller {
}, resolve());

this.router.transitionTo("index.reports");
} catch (e) {
/* istanbul ignore next */
} catch {
this.notify.error("Error while generating reports");
} finally {
this.tracking.generatingReports = false;
Expand Down
1 change: 1 addition & 0 deletions frontend/app/index/activities/edit/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Route from "@ember/routing/route";
import { service } from "@ember/service";
import Changeset from "ember-changeset";
import lookupValidator from "ember-changeset-validations";

import ActivityValidator from "timed/validations/activity";

/**
Expand Down
10 changes: 4 additions & 6 deletions frontend/app/index/attendances/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import Controller from "@ember/controller";
import { action } from "@ember/object";
import { service } from "@ember/service";

import AttendanceValidator from "timed/validations/attendance";

/**
Expand Down Expand Up @@ -73,8 +74,7 @@ export default class AttendanceController extends Controller {
await attendance.save();

this.notify.success("Attendance was saved");
} catch (e) {
/* istanbul ignore next */
} catch {
this.notify.error("Error while saving the attendance");
}
}
Expand All @@ -92,8 +92,7 @@ export default class AttendanceController extends Controller {
await this.store.peekRecord("attendance", attendance.id).destroyRecord();

this.notify.success("Attendance was deleted");
} catch (e) {
/* istanbul ignore next */
} catch {
this.notify.error("Error while deleting the attendance");
}
}
Expand Down Expand Up @@ -121,8 +120,7 @@ export default class AttendanceController extends Controller {
await attendance.save();

this.notify.success("Attendance was added");
} catch (e) {
/* istanbul ignore next */
} catch {
this.notify.error("Error while adding the attendance");
}
}
Expand Down
16 changes: 7 additions & 9 deletions frontend/app/index/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import { tracked } from "@glimmer/tracking";
import { dropTask, timeout } from "ember-concurrency";
import moment from "moment";
import { trackedFunction } from "reactiveweb/function";
import AbsenceValidations from "timed/validations/absence";
import MultipleAbsenceValidations from "timed/validations/multiple-absence";
import { tracked as trackedWrapper } from "tracked-built-ins";
import { cached } from "tracked-toolbox";

import AbsenceValidations from "timed/validations/absence";
import MultipleAbsenceValidations from "timed/validations/multiple-absence";

/**
* The index controller
*
Expand Down Expand Up @@ -138,7 +139,6 @@ export default class IndexController extends Controller {
* @private
*/
_activitySumTask = dropTask(async () => {
// eslint-disable-next-line no-constant-condition
while (true) {
this._activitySum();

Expand Down Expand Up @@ -449,7 +449,7 @@ export default class IndexController extends Controller {

const publicHolidays = await this.store.query("public-holiday", {
...params,
// eslint-disable-next-line ember/no-get

location: this.currentUser.user.activeEmployment.location.get("id"),
});

Expand Down Expand Up @@ -519,8 +519,7 @@ export default class IndexController extends Controller {
await changeset.save();

this.showEditModal = false;
} catch (e) {
/* istanbul ignore next */
} catch {
this.notify.error("Error while saving the absence");
} finally {
this.send("finished");
Expand All @@ -542,8 +541,7 @@ export default class IndexController extends Controller {
await absence.destroyRecord();

this.showEditModal = false;
} catch (e) {
/* istanbul ignore next */
} catch {
this.notify.error("Error while deleting the absence");
} finally {
this.send("finished");
Expand Down Expand Up @@ -579,7 +577,7 @@ export default class IndexController extends Controller {
changeset.rollback();

this.showAddModal = false;
} catch (e) {
} catch {
this.notify.error("Error while adding the absence");
} finally {
this.send("finished");
Expand Down
9 changes: 5 additions & 4 deletions frontend/app/index/reports/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import { service } from "@ember/service";
import { tracked } from "@glimmer/tracking";
import moment from "moment";
import { all } from "rsvp";
import ReportValidations from "timed/validations/report";
import { cached } from "tracked-toolbox";

import ReportValidations from "timed/validations/report";
/**
* The index reports controller
*
Expand Down Expand Up @@ -121,7 +122,7 @@ export default class IndexReportController extends Controller {
if (this.absence) {
await this.absence.reload();
}
} catch (e) {
} catch {
this.notify.error("Error while saving the report");
} finally {
this.send("finished");
Expand All @@ -147,7 +148,7 @@ export default class IndexReportController extends Controller {
await this.absence.reload();
}
}
} catch (e) {
} catch {
this.notify.error("Error while deleting the report");
} finally {
this.send("finished");
Expand Down Expand Up @@ -180,7 +181,7 @@ export default class IndexReportController extends Controller {
this.router.transitionTo({
queryParams: { day: date.format("YYYY-MM-DD") },
});
} catch (e) {
} catch {
this.notify.error("Error while rescheduling the timesheet");
}
}
Expand Down
Loading
Loading