Skip to content

Commit

Permalink
chore(frontend): linted
Browse files Browse the repository at this point in the history
  • Loading branch information
c0rydoras committed Sep 4, 2024
1 parent eafe90c commit 257a350
Show file tree
Hide file tree
Showing 97 changed files with 479 additions and 397 deletions.
2 changes: 1 addition & 1 deletion frontend/app/abilities/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default class ReportAbility extends Ability {
return ((await this.model?.taskAssignees) ?? [])
.concat(
(await this.model?.projectAssignees) ?? [],
(await this.model?.customerAssignees) ?? []
(await this.model?.customerAssignees) ?? [],
)
.filter((a) => a?.user)
.map((a) => a.user.get("id"))
Expand Down
8 changes: 4 additions & 4 deletions frontend/app/analysis/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default class AnalysisEditController extends Controller {
})}`,
{
method: "GET",
}
},
);

yield this.store.pushPayload("report-intersection", res);
Expand Down Expand Up @@ -282,9 +282,9 @@ export default class AnalysisEditController extends Controller {
underscoreQueryParams(
serializeQueryParams(
filterQueryParams(params, "editable"),
queryParamsState(this)
)
)
queryParamsState(this),
),
),
);
}
}
22 changes: 11 additions & 11 deletions frontend/app/analysis/index/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export default class AnalysisController extends QPController {

data = enqueueTask(async () => {
const params = underscoreQueryParams(
serializeQueryParams(this.allQueryParams, queryParamsState(this))
serializeQueryParams(this.allQueryParams, queryParamsState(this)),
);

if (this._canLoadMore) {
Expand All @@ -223,24 +223,24 @@ export default class AnalysisController extends QPController {
"taskAssignees",
taskAssignees.filter(
(taskAssignee) =>
report.get("task.id") === taskAssignee.get("task.id")
)
report.get("task.id") === taskAssignee.get("task.id"),
),
);
report.set(
"projectAssignees",
projectAssignees.filter(
(projectAssignee) =>
report.get("task.project.id") ===
projectAssignee.get("project.id")
)
projectAssignee.get("project.id"),
),
);
report.set(
"customerAssignees",
customerAssignees.filter(
(customerAssignee) =>
report.get("task.project.customer.id") ===
customerAssignee.get("customer.id")
)
customerAssignee.get("customer.id"),
),
);
return report;
});
Expand Down Expand Up @@ -316,10 +316,10 @@ export default class AnalysisController extends QPController {
...params,
...serializeQueryParams(
this.allQueryParams,
queryParamsState(this)
queryParamsState(this),
),
})
)
}),
),
);

const res = yield fetch(`${url}?${queryString}`, {
Expand All @@ -346,7 +346,7 @@ export default class AnalysisController extends QPController {
} catch (e) {
/* istanbul ignore next */
this.notify.error(
"Error while downloading, try again or try reducing results"
"Error while downloading, try again or try reducing results",
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/attendance-slider/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default class AttendanceSlider extends Component {

attendance.set(
"from",
moment(attendance.get("from")).hour(0).minute(fromMin)
moment(attendance.get("from")).hour(0).minute(fromMin),
);
attendance.set("to", moment(attendance.get("to")).hour(0).minute(toMin));

Expand Down
4 changes: 2 additions & 2 deletions frontend/app/components/date-buttons/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ export default class DateButtonsComponent extends Component {
break;
case "last month":
this.args.onUpdateFromDate(
moment().subtract(1, "month").startOf("month")
moment().subtract(1, "month").startOf("month"),
);
this.args.onUpdateToDate(moment().subtract(1, "month").endOf("month"));
break;
case "last year":
this.args.onUpdateFromDate(
moment().subtract(1, "year").startOf("year")
moment().subtract(1, "year").startOf("year"),
);
this.args.onUpdateToDate(moment().subtract(1, "year").endOf("year"));
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class OptimizedPowerSelectOptionsComponent extends Component {
"actions",
this.args.select.actions,
"scrollTo",
this.args.select.highlighted
this.args.select.highlighted,
);
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/report-row/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class ReportRowComponent extends Component {
return editable
? ""
: `This entry was already verified by ${this.args.report.get(
"verifiedBy.fullName"
"verifiedBy.fullName",
)} and therefore not editable anymore`;
}

Expand Down
8 changes: 4 additions & 4 deletions frontend/app/components/statistic-list/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,16 @@ export default class StatisticList extends Component {
}

const maxEstimated = moment.duration(
Math.max(0, ...this.value.map((v) => v.estimatedTime).filter(Boolean))
Math.max(0, ...this.value.map((v) => v.estimatedTime).filter(Boolean)),
);
const maxDurationWithRemainingEffort = moment.duration(
Math.max(
...this.value.map((task) =>
moment
.duration(task.duration)
.add(moment.duration(task.mostRecentRemainingEffort))
)
)
.add(moment.duration(task.mostRecentRemainingEffort)),
),
),
);
return Math.max(maxEstimated, maxDurationWithRemainingEffort);
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/sy-calendar/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class SyCalendar extends Component {
months = moment.months();

years = [...new Array(40).keys()].map(
(i) => `${CURRENT_YEAR + YEARS_IN_FUTURE - i}`
(i) => `${CURRENT_YEAR + YEARS_IN_FUTURE - i}`,
);

@action
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/sy-datepicker/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class SyDatepicker extends Component {
@action
handleBlur(dd, e) {
const container = document.getElementById(
`ember-basic-dropdown-content-${dd.uniqueId}`
`ember-basic-dropdown-content-${dd.uniqueId}`,
);

if (!container || !container.contains(e.relatedTarget)) {
Expand Down
6 changes: 3 additions & 3 deletions frontend/app/components/task-selection/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default class TaskSelectionComponent extends Component {
// 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/component.js

View workflow job for this annotation

GitHub Actions / lint (js)

Don't use observers
"_activity",
this.handleTrackingActiveActivityChanged.perform
this.handleTrackingActiveActivityChanged.perform,
);
}
}
Expand All @@ -73,7 +73,7 @@ export default class TaskSelectionComponent extends Component {
if (this.args.liveTracking) {
this.tracking.removeObserver(
"_activity",
this.handleTrackingActiveActivityChanged.perform
this.handleTrackingActiveActivityChanged.perform,
);
}
super.willDestroy(...args);
Expand Down Expand Up @@ -245,7 +245,7 @@ export default class TaskSelectionComponent extends Component {
_customersAndRecentTasks = trackedTask(
this,
this.customersAndRecentTasksTask,
() => [this.history, this.tracking.recentTasks, this.archived]
() => [this.history, this.tracking.recentTasks, this.archived],
);

get customersAndRecentTasks() {
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/weekly-overview-day/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class WeeklyOverviewDay extends Component {
get style() {
const height = Math.min(
(this.args.worktime.asHours() / this.max) * 100,
100
100,
);
return { height: `${height}%` };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class WorktimeBalanceChart extends Component {
datasets: [
{
data: this.args.worktimeBalances.map(({ balance }) =>
Number.parseFloat(balance.asHours().toFixed(2))
Number.parseFloat(balance.asHours().toFixed(2)),
),
},
],
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/controllers/qpcontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class ControllersQPControllerController extends Controller {
value: this[key],
enumerable: true,
}),
{}
{},
);
}
}
2 changes: 1 addition & 1 deletion frontend/app/index/activities/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export default class ActivitiesIndexController extends Controller {
(a) =>
a.get("task.id") &&
!(a.get("active") && !a.get("from").isSame(moment(), "day")) &&
!a.get("transferred")
!a.get("transferred"),
)
.reduce(async (reducer, activity) => {
if (activity.get("active")) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/index/activities/edit/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class IndexActivityEditController extends Route {
const changeset = new Changeset(
model,
lookupValidator(ActivityValidator),
ActivityValidator
ActivityValidator,
);
changeset.validate();

Expand Down
12 changes: 6 additions & 6 deletions frontend/app/index/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export default class IndexController extends Controller {

return [...reportDurations, ...absenceDurations].reduce(
(val, dur) => val.add(dur),
moment.duration()
moment.duration(),
);
}

Expand Down Expand Up @@ -329,14 +329,14 @@ export default class IndexController extends Controller {
(report) =>
report.get("user.id") === this.currentUser.user.get("id") &&
!report.get("isDeleted") &&
!report.get("isNew")
!report.get("isNew"),
);

const allAbsences = this.allAbsences.filter(
(absence) =>
absence.get("user.id") === this.currentUser.user.get("id") &&
!absence.get("isDeleted") &&
!absence.get("isNew")
!absence.get("isNew"),
);

const allHolidays = this.store.peekAll("public-holiday");
Expand All @@ -360,11 +360,11 @@ export default class IndexController extends Controller {

return obj;
},
{}
{},
);

return Array.from({ length: 31 }, (value, index) =>
moment(this.date).add(index - 20, "days")
moment(this.date).add(index - 20, "days"),
).map((d) => {
const {
reports = [],
Expand Down Expand Up @@ -461,7 +461,7 @@ export default class IndexController extends Controller {
*/
get disabledDatesForEdit() {
return this.disabledDates.filter(
(date) => !date.isSame(this.absence.date, "day")
(date) => !date.isSame(this.absence.date, "day"),
);
}

Expand Down
4 changes: 2 additions & 2 deletions frontend/app/index/reports/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,15 @@ export default class IndexReportController extends Controller {
if (reports.length < this.reports.length - 1) {
/* istanbul ignore next */
this.notify.warning(
"Reports that got verified already can not get transferred."
"Reports that got verified already can not get transferred.",
);
}

await all(
reports.map(async (report) => {
report.set("date", date);
return await report.save();
})
}),
);
this.showReschedule = false;
this.router.transitionTo({
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/index/reports/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class IndexReportsRoute extends Route {
controller.notBillable = null;

this.notify.success(
"Temporary report was created. Please amend it and save it or delete it."
"Temporary report was created. Please amend it and save it or delete it.",
);
} catch {
/* istanbul ignore next */
Expand Down
10 changes: 5 additions & 5 deletions frontend/app/models/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default class Activity extends Model {
review: this.review,
notBillable: this.notBillable,
fromTime: moment({ h: 0, m: 0, s: 0 }),
})
}),
);
}

Expand All @@ -121,18 +121,18 @@ export default class Activity extends Model {
m: 59,
s: 59,
}),
moment()
)
moment(),
),
);

await activity.save();
})
}),
);

if (moment().diff(this.date, "days") > 1) {
this.notify.info(
"The activity overlapped multiple days, which is not possible. The activity was stopped at midnight of the day it was started.",
{ closeAfter: 5000 }
{ closeAfter: 5000 },
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions frontend/app/projects/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class ProjectsController extends Controller {
get customers() {
return uniqBy(
this.projects?.map((p) => p?.get("customer")).filter(Boolean) ?? [],
(c) => c.get("id")
(c) => c.get("id"),
).toSorted((c) => c.get("name"));
}

Expand Down Expand Up @@ -68,7 +68,7 @@ export default class ProjectsController extends Controller {
*filterProjects() {
return yield this.projects.filter(
(project) =>
project.get("customer.id") === this.selectedCustomer.get("id")
project.get("customer.id") === this.selectedCustomer.get("id"),
);
}

Expand Down Expand Up @@ -150,7 +150,7 @@ export default class ProjectsController extends Controller {
) {
changeset.set(
"mostRecentRemainingEffort",
changeset.get("estimatedTime")
changeset.get("estimatedTime"),
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/services/current-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class CurrentUserService extends Service {
})}`,
{
method: "GET",
}
},
);

await this.store.pushPayload("user", user);
Expand Down
Loading

0 comments on commit 257a350

Please sign in to comment.