Skip to content

Commit

Permalink
Automatically sort imports using Prettier plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
hupf committed Nov 6, 2023
1 parent b51d6d1 commit 7c81ac7
Show file tree
Hide file tree
Showing 361 changed files with 1,087 additions and 1,194 deletions.
1 change: 0 additions & 1 deletion .prettierrc

This file was deleted.

27 changes: 27 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const config = {
/**
* Enable plugin for automatically sorting of imports
*/
plugins: ["@trivago/prettier-plugin-sort-imports"],
importOrderParserPlugins: ["typescript", "decorators-legacy"],

/**
* Custom sorting of imports, first lit stuff, then other third
* party libs, then own modules
*/
importOrder: ["^@angular/", "<THIRD_PARTY_MODULES>", "^src/", "^../", "^./"],

/**
* Whether to separate sorting groups (as defined above) with
* newline
*/
// importOrderSeparation: true,

/**
* Whether to sort the specifiers on the left hand side of the
* import statement
*/
importOrderSortSpecifiers: true,
};

export default config;
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
theme: jekyll-theme-slate
theme: jekyll-theme-slate
66 changes: 66 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"type": "git",
"url": "[email protected]:bkd-mba-fbi/webapp-schulverwaltung.git"
},
"type": "module",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand All @@ -21,7 +22,7 @@
"test:brief": "ng test --browsers=ChromeHeadless --reporters brief",
"test:coverage": "ng test --browsers=ChromeHeadless --code-coverage --reporters coverage-istanbul",
"lint": "ng lint",
"format": "prettier --write \"./**/*.{js,ts,json,css,scss,html,md,yaml}\"",
"format": "prettier --write \"./**/*\" --ignore-unknown",
"format:upgrade": "npm install --save-exact prettier@latest && npm run format",
"preanalyze": "ng build --stats-json",
"analyze": "npx webpack-bundle-analyzer dist/$(ng config defaultProject)/stats.json",
Expand Down Expand Up @@ -70,6 +71,7 @@
"@angular/cli": "^16.2.7",
"@angular/compiler-cli": "^16.2.10",
"@angular/language-service": "^16.2.10",
"@trivago/prettier-plugin-sort-imports": "^4.2.1",
"@types/jasmine": "~5.1.1",
"@types/lodash-es": "^4.17.10",
"@types/node": "^18.11.0",
Expand Down
4 changes: 2 additions & 2 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NgModule } from "@angular/core";
import { Routes, RouterModule } from "@angular/router";
import { HomeComponent } from "./home.component";
import { RouterModule, Routes } from "@angular/router";
import { authGuard } from "./auth.guard";
import { HomeComponent } from "./home.component";
import { UnauthenticatedComponent } from "./unauthenticated.component";

const routes: Routes = [
Expand Down
3 changes: 1 addition & 2 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { TestBed, ComponentFixture, waitForAsync } from "@angular/core/testing";

import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";
import { buildTestModuleMetadata } from "src/spec-helpers";
import { AppComponent } from "./app.component";

Expand Down
11 changes: 5 additions & 6 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { Component, ChangeDetectionStrategy, Inject } from "@angular/core";
import { catchError } from "rxjs/operators";
import { ChangeDetectionStrategy, Component, Inject } from "@angular/core";
import { Router } from "@angular/router";
import { EMPTY } from "rxjs";

import { catchError } from "rxjs/operators";
import { SETTINGS, Settings } from "./settings";
import { I18nService } from "./shared/services/i18n.service";
import { decode } from "./shared/utils/decode";
import { NAVIGATOR } from "./shared/tokens/dom-apis";
import { Router } from "@angular/router";
import { ToastService } from "./shared/services/toast.service";
import { NAVIGATOR } from "./shared/tokens/dom-apis";
import { decode } from "./shared/utils/decode";

@Component({
template:
Expand Down
6 changes: 3 additions & 3 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ import {
NgModule,
} from "@angular/core";
import { createCustomElement } from "@angular/elements";
import { FormsModule } from "@angular/forms";
import { BrowserModule } from "@angular/platform-browser";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { RouterModule } from "@angular/router";
import { NgSelectModule } from "@ng-select/ng-select";
import { TranslateLoader, TranslateModule } from "@ngx-translate/core";
import { TranslateHttpLoader } from "@ngx-translate/http-loader";
import { AppRoutingModule } from "./app-routing.module";
import { AppComponent } from "./app.component";
import { GlobalErrorHandler } from "./global-error-handler";
import { HomeComponent } from "./home.component";
import { MyNotificationsShowComponent } from "./my-notifications/components/my-notifications-show/my-notifications-show.component";
import { Settings, SETTINGS } from "./settings";
import { SETTINGS, Settings } from "./settings";
import { I18nService } from "./shared/services/i18n.service";
import { SharedModule } from "./shared/shared.module";
import { UnauthenticatedComponent } from "./unauthenticated.component";
import { NgSelectModule } from "@ng-select/ng-select";
import { FormsModule } from "@angular/forms";

// AoT requires an exported function for factories
export function HttpLoaderFactory(
Expand Down
7 changes: 3 additions & 4 deletions src/app/auth.guard.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { TestBed, fakeAsync, tick } from "@angular/core/testing";
import { Component } from "@angular/core";
import { TestBed, fakeAsync, tick } from "@angular/core/testing";
import {
RouterStateSnapshot,
ActivatedRouteSnapshot,
Router,
RouterStateSnapshot,
} from "@angular/router";
import { RouterTestingModule } from "@angular/router/testing";

import { buildTestModuleMetadata } from "src/spec-helpers";
import { authGuard } from "./auth.guard";
import { AuthService } from "./shared/services/auth.service";
import { buildTestModuleMetadata } from "src/spec-helpers";

/* eslint-disable @typescript-eslint/no-explicit-any */

Expand Down
3 changes: 1 addition & 2 deletions src/app/auth.guard.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { inject } from "@angular/core";
import { Router, CanActivateFn } from "@angular/router";

import { CanActivateFn, Router } from "@angular/router";
import { AuthService } from "./shared/services/auth.service";

export function authGuard(): CanActivateFn {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { DashboardActionComponent } from "./dashboard-action.component";
import { buildTestModuleMetadata } from "../../../../spec-helpers";
import { DashboardDeadlineComponent } from "../dashboard-deadline/dashboard-deadline.component";
import { DashboardActionComponent } from "./dashboard-action.component";

describe("DashboardActionComponent", () => {
let component: DashboardActionComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { DashboardActionsComponent } from "./dashboard-actions.component";
import { buildTestModuleMetadata } from "../../../../spec-helpers";
import { UserSettingsService } from "../../../shared/services/user-settings.service";
import { BehaviorSubject, of } from "rxjs";
import { buildLessonPresence, buildPerson } from "../../../../spec-builders";
import { buildTestModuleMetadata } from "../../../../spec-helpers";
import { CoursesRestService } from "../../../shared/services/courses-rest.service";
import { LessonPresencesRestService } from "../../../shared/services/lesson-presences-rest.service";
import { StudentsRestService } from "../../../shared/services/students-rest.service";
import { PersonsRestService } from "../../../shared/services/persons-rest.service";
import { StorageService } from "../../../shared/services/storage.service";
import { buildLessonPresence, buildPerson } from "../../../../spec-builders";
import { StudentsRestService } from "../../../shared/services/students-rest.service";
import { UserSettingsService } from "../../../shared/services/user-settings.service";
import { DashboardService } from "../../services/dashboard.service";
import { DashboardActionComponent } from "../dashboard-action/dashboard-action.component";
import { DashboardDeadlineComponent } from "../dashboard-deadline/dashboard-deadline.component";
import { CoursesRestService } from "../../../shared/services/courses-rest.service";
import { PersonsRestService } from "../../../shared/services/persons-rest.service";
import { DashboardActionsComponent } from "./dashboard-actions.component";

describe("DashboardActionsComponent", () => {
// let component: DashboardActionsComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, Inject } from "@angular/core";
import { Settings, SETTINGS } from "../../../settings";
import { SETTINGS, Settings } from "../../../settings";
import { DashboardService } from "../../services/dashboard.service";

@Component({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { DashboardDeadlineComponent } from "./dashboard-deadline.component";
import { buildTestModuleMetadata } from "../../../../spec-helpers";
import { DashboardDeadlineComponent } from "./dashboard-deadline.component";

describe("DashboardDeadlineComponent", () => {
let component: DashboardDeadlineComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";
import { Router } from "@angular/router";

import { DashboardSearchComponent } from "./dashboard-search.component";
import { buildTestModuleMetadata } from "../../../../spec-helpers";
import { DashboardSearchComponent } from "./dashboard-search.component";

describe("DashboardSearchComponent", () => {
let component: DashboardSearchComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component } from "@angular/core";
import { Router } from "@angular/router";
import { StudentsRestService } from "../../../shared/services/students-rest.service";
import { DropDownItem } from "../../../shared/models/drop-down-item.model";
import { StudentsRestService } from "../../../shared/services/students-rest.service";

@Component({
selector: "erz-dashboard-search",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ComponentFixture, TestBed } from "@angular/core/testing";
import { of } from "rxjs";
import { buildTestModuleMetadata } from "src/spec-helpers";
import { DashboardService } from "../../services/dashboard.service";

import { DashboardTimetableTableComponent } from "./dashboard-timetable-table.component";

describe("DashboardTimetableTableComponent", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, Inject, Input } from "@angular/core";
import { Settings, SETTINGS } from "src/app/settings";
import { SETTINGS, Settings } from "src/app/settings";
import { DashboardService } from "../../services/dashboard.service";
import { DashboardTimetableEntry } from "../dashboard-timetable/dashboard-timetable.component";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { DashboardTimetableComponent } from "./dashboard-timetable.component";
import { buildTestModuleMetadata } from "src/spec-helpers";
import { StudentsRestService } from "src/app/shared/services/students-rest.service";
import { BehaviorSubject, Observable, of } from "rxjs";
import { LessonPresencesRestService } from "src/app/shared/services/lesson-presences-rest.service";
import { StudentsRestService } from "src/app/shared/services/students-rest.service";
import { UserSettingsService } from "src/app/shared/services/user-settings.service";
import {
buildLesson,
buildLessonAbsence,
buildLessonIncident,
buildTimetableEntry,
} from "src/spec-builders";
import { LessonPresencesRestService } from "src/app/shared/services/lesson-presences-rest.service";
import { UserSettingsService } from "src/app/shared/services/user-settings.service";
import { buildTestModuleMetadata } from "src/spec-helpers";
import { DashboardService } from "../../services/dashboard.service";
import { DashboardTimetableTableComponent } from "../dashboard-timetable-table/dashboard-timetable-table.component";
import { DashboardTimetableComponent } from "./dashboard-timetable.component";

/* eslint-disable @typescript-eslint/no-explicit-any */

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import { Component } from "@angular/core";
import addDays from "date-fns/addDays";
import format from "date-fns/format";
import startOfDay from "date-fns/startOfDay";
import subDays from "date-fns/subDays";
import {
combineLatest,
BehaviorSubject,
Observable,
combineLatest,
map,
switchMap,
of,
BehaviorSubject,
switchMap,
tap,
} from "rxjs";
import startOfDay from "date-fns/startOfDay";
import format from "date-fns/format";
import addDays from "date-fns/addDays";
import subDays from "date-fns/subDays";

import { uniqueLessons } from "src/app/presence-control/utils/lesson-entries";
import { Lesson } from "src/app/shared/models/lesson.model";
import { TimetableEntry } from "src/app/shared/models/timetable-entry.model";
import { LessonPresencesRestService } from "src/app/shared/services/lesson-presences-rest.service";
import { StudentsRestService } from "src/app/shared/services/students-rest.service";
import { uniqueLessons } from "src/app/presence-control/utils/lesson-entries";
import { UserSettingsService } from "src/app/shared/services/user-settings.service";
import { DashboardService } from "../../services/dashboard.service";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";
import { BehaviorSubject } from "rxjs";

import { DashboardComponent } from "./dashboard.component";
import { UserSettingsService } from "src/app/shared/services/user-settings.service";
import { buildTestModuleMetadata } from "src/spec-helpers";
import { StorageService } from "../../../shared/services/storage.service";
import { DashboardService } from "../../services/dashboard.service";
import { DashboardActionComponent } from "../dashboard-action/dashboard-action.component";
import { DashboardActionsComponent } from "../dashboard-actions/dashboard-actions.component";
import { DashboardSearchComponent } from "../dashboard-search/dashboard-search.component";
import { DashboardActionComponent } from "../dashboard-action/dashboard-action.component";
import { DashboardTimetableComponent } from "../dashboard-timetable/dashboard-timetable.component";
import { DashboardComponent } from "./dashboard.component";

describe("DashboardComponent", () => {
let fixture: ComponentFixture<DashboardComponent>;
Expand Down
Loading

0 comments on commit 7c81ac7

Please sign in to comment.