mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 00:52:55 +00:00
feat: upgrade prettier to v3
This commit is contained in:
@@ -106,7 +106,6 @@
|
||||
"ngx-markdown": "16.0.0",
|
||||
"ngx-moment": "6.0.2",
|
||||
"opening_hours": "3.8.0",
|
||||
"prettier": "2.8.6",
|
||||
"rxjs": "7.8.1",
|
||||
"swiper": "8.4.5",
|
||||
"tslib": "2.4.1",
|
||||
|
||||
@@ -12,9 +12,11 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import prettierConfig from '@openstapps/prettier-config';
|
||||
|
||||
module.exports = {
|
||||
...require('@openstapps/prettier-config'),
|
||||
/** @type {import('prettier').Config} */
|
||||
const config = {
|
||||
...prettierConfig,
|
||||
overrides: [
|
||||
{
|
||||
files: 'src/**/*.html',
|
||||
@@ -25,3 +27,5 @@ module.exports = {
|
||||
],
|
||||
ignorePath: ['.prettierignore', '../../.gitignore'],
|
||||
};
|
||||
|
||||
export default config;
|
||||
@@ -49,7 +49,10 @@ export class SharedAxisChoreographer<T> {
|
||||
*/
|
||||
currentValue: T;
|
||||
|
||||
constructor(initialValue: T, readonly pages?: T[]) {
|
||||
constructor(
|
||||
initialValue: T,
|
||||
readonly pages?: T[],
|
||||
) {
|
||||
this.currentValue = initialValue;
|
||||
this.expectedValue = initialValue;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,10 @@ export class AboutPageComponent implements OnInit {
|
||||
|
||||
version: string;
|
||||
|
||||
constructor(private readonly route: ActivatedRoute, private readonly configProvider: ConfigProvider) {}
|
||||
constructor(
|
||||
private readonly route: ActivatedRoute,
|
||||
private readonly configProvider: ConfigProvider,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
const route = this.route.snapshot.url.map(it => it.path).join('/');
|
||||
|
||||
@@ -22,7 +22,10 @@ import {AuthHelperService} from './auth-helper.service';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class AuthGuardService implements CanActivate {
|
||||
constructor(private authHelper: AuthHelperService, private router: Router) {}
|
||||
constructor(
|
||||
private authHelper: AuthHelperService,
|
||||
private router: Router,
|
||||
) {}
|
||||
|
||||
public async canActivate(route: ActivatedProtectedRouteSnapshot, _state: RouterStateSnapshot) {
|
||||
if (route.queryParamMap.get('token')) {
|
||||
|
||||
@@ -134,9 +134,9 @@ export class ScheduleSyncService {
|
||||
private formatChanges(changes: ChangesOf<SCDateSeries, DateSeriesRelevantData>): string[] {
|
||||
return changes.changes.map(
|
||||
change =>
|
||||
`${
|
||||
this.translator.translator.translatedPropertyNames<SCDateSeries>(SCThingType.DateSeries)?.[change]
|
||||
}: ${formatRelevantKeys[change](
|
||||
`${this.translator.translator.translatedPropertyNames<SCDateSeries>(SCThingType.DateSeries)?.[
|
||||
change
|
||||
]}: ${formatRelevantKeys[change](
|
||||
changes.new[change] as never,
|
||||
this.dateFormatPipe,
|
||||
this.durationFormatPipe,
|
||||
|
||||
@@ -38,7 +38,10 @@ export class CalendarService {
|
||||
calendarName = 'StApps';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
constructor(readonly calendar: Calendar, private readonly configProvider: ConfigProvider) {
|
||||
constructor(
|
||||
readonly calendar: Calendar,
|
||||
private readonly configProvider: ConfigProvider,
|
||||
) {
|
||||
this.calendarName = (this.configProvider.getValue('name') as string) ?? 'StApps';
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<ion-label>
|
||||
{{
|
||||
nextEvent
|
||||
? (nextEvent!.dates | nextDateInList | amDateFormat : 'll, HH:mm')
|
||||
? (nextEvent!.dates | nextDateInList | amDateFormat: 'll, HH:mm')
|
||||
: ('dashboard.schedule.noEvent' | translate)
|
||||
}}
|
||||
</ion-label>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<ng-container *ngIf="items | async as items">
|
||||
<ng-container *ngIf="items.length !== 0; else nothingSelected">
|
||||
<ng-container *ngFor="let item of items">
|
||||
<stapps-section @fade [item]="item" [title]="'name' | thingTranslate : item">
|
||||
<stapps-section @fade [item]="item" [title]="'name' | thingTranslate: item">
|
||||
<ion-button slot="button-end" fill="clear" color="medium" (click)="favoritesService.delete(item)">
|
||||
<ion-icon slot="icon-only" name="delete" size="24"></ion-icon>
|
||||
</ion-button>
|
||||
|
||||
@@ -42,8 +42,8 @@ export class ActionChipListComponent {
|
||||
const maybeCoords = isInPlace
|
||||
? item?.inPlace?.geo.point.coordinates
|
||||
: hasDirectGeo
|
||||
? item.geo.point.coordinates
|
||||
: undefined;
|
||||
? item.geo.point.coordinates
|
||||
: undefined;
|
||||
const isNullIsland = maybeCoords ? maybeCoords[0] === 0 && maybeCoords[1] === 0 : false;
|
||||
this.applicable = {
|
||||
locate: false, // TODO: reimplement this at a later date
|
||||
|
||||
@@ -44,7 +44,10 @@ export class TreeNode<T extends TreeNode<any> | SelectionValue> {
|
||||
*/
|
||||
parent?: TreeNode<TreeNode<T>>;
|
||||
|
||||
constructor(readonly children: T[], readonly ref: ChangeDetectorRef) {
|
||||
constructor(
|
||||
readonly children: T[],
|
||||
readonly ref: ChangeDetectorRef,
|
||||
) {
|
||||
this.updateParents();
|
||||
this.accumulateApplyValues();
|
||||
}
|
||||
@@ -58,11 +61,11 @@ export class TreeNode<T extends TreeNode<any> | SelectionValue> {
|
||||
? it.checked
|
||||
? Selection.ON
|
||||
: it.indeterminate
|
||||
? Selection.PARTIAL
|
||||
: Selection.OFF
|
||||
? Selection.PARTIAL
|
||||
: Selection.OFF
|
||||
: (it as SelectionValue).selected
|
||||
? Selection.ON
|
||||
: Selection.OFF,
|
||||
? Selection.ON
|
||||
: Selection.OFF,
|
||||
);
|
||||
|
||||
this.checked = selections.every(it => it === Selection.ON);
|
||||
|
||||
@@ -29,10 +29,13 @@ async function delay(ms: number): Promise<void> {
|
||||
* ['a', 'b', 'c'] => {0: 'a', 1: 'b', 2: 'c'}
|
||||
*/
|
||||
export function arrayToIndexMap<T>(array: T[]): Record<number, T> {
|
||||
return array.reduce((previous, current, index) => {
|
||||
previous[index] = current;
|
||||
return previous;
|
||||
}, {} as Record<number, T>);
|
||||
return array.reduce(
|
||||
(previous, current, index) => {
|
||||
previous[index] = current;
|
||||
return previous;
|
||||
},
|
||||
{} as Record<number, T>,
|
||||
);
|
||||
}
|
||||
|
||||
interface OngoingQuery {
|
||||
|
||||
@@ -51,7 +51,10 @@ export class StappsRatingComponent {
|
||||
this.dish.next(value);
|
||||
}
|
||||
|
||||
constructor(readonly elementRef: ElementRef, readonly ratingProvider: RatingProvider) {}
|
||||
constructor(
|
||||
readonly elementRef: ElementRef,
|
||||
readonly ratingProvider: RatingProvider,
|
||||
) {}
|
||||
|
||||
@HostListener('document:mousedown', ['$event'])
|
||||
clickOutside(event: MouseEvent) {
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
<ion-card-title>
|
||||
<h1>
|
||||
<ng-container *ngIf="$any(item).honorificPrefix">{{
|
||||
'honorificPrefix' | thingTranslate : item
|
||||
'honorificPrefix' | thingTranslate: item
|
||||
}}</ng-container>
|
||||
{{ 'name' | thingTranslate : item }}
|
||||
{{ 'name' | thingTranslate: item }}
|
||||
<ng-container *ngIf="$any(item).honorificSuffix">{{
|
||||
'honorificSuffix' | thingTranslate : item
|
||||
'honorificSuffix' | thingTranslate: item
|
||||
}}</ng-container>
|
||||
</h1>
|
||||
</ion-card-title>
|
||||
@@ -33,7 +33,7 @@
|
||||
<!-- TODO obviously this is bad style. Tbd where to put the differentiation. Job Postings always have a description, but it's going to be shown in `stapps-job-posting-detail-content` anyways, no need to repeat here. For this view, I would use other fields of the schema.org JobPosting like the `ThingWithCategory.category` -->
|
||||
<div *ngIf="item.description && item.type !== 'job posting'" class="description">
|
||||
<div class="text-accordion" [style.-webkit-line-clamp]="descriptionLinesToDisplay" #accordionTextArea>
|
||||
{{ 'description' | thingTranslate : item }}
|
||||
{{ 'description' | thingTranslate: item }}
|
||||
</div>
|
||||
</div>
|
||||
<!-- TODO see above -->
|
||||
|
||||
@@ -53,7 +53,10 @@ export class SimpleDataListComponent implements OnInit {
|
||||
|
||||
destroy$ = inject(DestroyRef);
|
||||
|
||||
constructor(protected router: Router, private readonly dataRoutingService: DataRoutingService) {}
|
||||
constructor(
|
||||
protected router: Router,
|
||||
private readonly dataRoutingService: DataRoutingService,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (!this.autoRouting) return;
|
||||
|
||||
@@ -26,7 +26,10 @@ import {SettingsProvider} from '../../../../../settings/settings.provider';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class PlaceMensaService {
|
||||
constructor(private dataProvider: DataProvider, readonly settingsProvider: SettingsProvider) {}
|
||||
constructor(
|
||||
private dataProvider: DataProvider,
|
||||
readonly settingsProvider: SettingsProvider,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Fetches all dishes for this building
|
||||
@@ -39,10 +42,13 @@ export class PlaceMensaService {
|
||||
Array.from({length: days})
|
||||
.map((_, i) => i)
|
||||
.map(i => moment().add(i, 'days').toISOString())
|
||||
.reduce((accumulator, item) => {
|
||||
accumulator[item] = item;
|
||||
return accumulator;
|
||||
}, {} as Record<SCISO8601Date, SCISO8601Date>),
|
||||
.reduce(
|
||||
(accumulator, item) => {
|
||||
accumulator[item] = item;
|
||||
return accumulator;
|
||||
},
|
||||
{} as Record<SCISO8601Date, SCISO8601Date>,
|
||||
),
|
||||
date => ({
|
||||
filter: {
|
||||
arguments: {
|
||||
|
||||
@@ -47,7 +47,10 @@ export class MapListModalComponent implements OnInit {
|
||||
*/
|
||||
@Input() queryText?: string;
|
||||
|
||||
constructor(private mapProvider: MapProvider, readonly modalController: ModalController) {}
|
||||
constructor(
|
||||
private mapProvider: MapProvider,
|
||||
readonly modalController: ModalController,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Populate the list with the results from the search
|
||||
|
||||
@@ -359,8 +359,8 @@ export class MapPageComponent implements OnInit {
|
||||
this.locationStatus?.location === 'denied'
|
||||
? location.NOT_ALLOWED
|
||||
: this.locationStatus?.location === 'granted'
|
||||
? unknownError
|
||||
: location.NOT_ENABLED
|
||||
? unknownError
|
||||
: location.NOT_ENABLED
|
||||
}`,
|
||||
buttons: ['OK'],
|
||||
})
|
||||
|
||||
@@ -22,7 +22,10 @@ import {NGXLogger} from 'ngx-logger';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class NavigationService {
|
||||
constructor(private configProvider: ConfigProvider, private logger: NGXLogger) {}
|
||||
constructor(
|
||||
private configProvider: ConfigProvider,
|
||||
private logger: NGXLogger,
|
||||
) {}
|
||||
|
||||
async getMenu() {
|
||||
let menu: SCAppConfigurationMenuCategory[] = [];
|
||||
|
||||
@@ -37,7 +37,10 @@ import {SettingsProvider} from '../settings/settings.provider';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class NewsProvider {
|
||||
constructor(private dataProvider: DataProvider, private settingsProvider: SettingsProvider) {}
|
||||
constructor(
|
||||
private dataProvider: DataProvider,
|
||||
private settingsProvider: SettingsProvider,
|
||||
) {}
|
||||
|
||||
async getCurrentSettings(): Promise<SCSetting[]> {
|
||||
const settings: SCSetting[] = [];
|
||||
|
||||
@@ -46,7 +46,9 @@ describe('ScheduleSingleEvents', () => {
|
||||
start: time.hour() + time.minute() / 60,
|
||||
startAsString: moment(time).format('LT'),
|
||||
duration: series.duration as string,
|
||||
endAsString: moment(time).add(series.duration?.[index]).format('LT'),
|
||||
endAsString: moment(time)
|
||||
.add(series.duration?.[index])
|
||||
.format('LT'),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -133,10 +133,13 @@ export class ScheduleViewComponent extends CalendarComponent implements OnInit,
|
||||
|
||||
for (const series of dateSeries.dates) {
|
||||
const weekDays = Object.keys(
|
||||
series.dates.reduce((accumulator, date) => {
|
||||
accumulator[moment(date).weekday()] = true;
|
||||
return accumulator;
|
||||
}, {} as Record<number, true>),
|
||||
series.dates.reduce(
|
||||
(accumulator, date) => {
|
||||
accumulator[moment(date).weekday()] = true;
|
||||
return accumulator;
|
||||
},
|
||||
{} as Record<number, true>,
|
||||
),
|
||||
);
|
||||
|
||||
for (const day of weekDays) {
|
||||
|
||||
@@ -197,7 +197,10 @@ export class SettingsProvider {
|
||||
* @param storage TODO
|
||||
* @param configProvider TODO
|
||||
*/
|
||||
constructor(private readonly storage: StorageProvider, private readonly configProvider: ConfigProvider) {
|
||||
constructor(
|
||||
private readonly storage: StorageProvider,
|
||||
private readonly configProvider: ConfigProvider,
|
||||
) {
|
||||
this.categoriesOrder = [];
|
||||
this.settingsCache = {};
|
||||
}
|
||||
@@ -330,9 +333,8 @@ export class SettingsProvider {
|
||||
|
||||
if (await this.storage.has(STORAGE_KEY_SETTING_VALUES)) {
|
||||
// get setting values from StorageProvider into settingsCache
|
||||
const valuesContainer: SettingValuesContainer = await this.storage.get<SettingValuesContainer>(
|
||||
STORAGE_KEY_SETTING_VALUES,
|
||||
);
|
||||
const valuesContainer: SettingValuesContainer =
|
||||
await this.storage.get<SettingValuesContainer>(STORAGE_KEY_SETTING_VALUES);
|
||||
// iterate through keys of categories
|
||||
for (const categoryKey of Object.keys(this.settingsCache)) {
|
||||
// iterate through setting keys of category
|
||||
@@ -384,9 +386,8 @@ export class SettingsProvider {
|
||||
*/
|
||||
public async saveSettingValues(): Promise<void> {
|
||||
if (await this.storage.has(STORAGE_KEY_SETTING_VALUES)) {
|
||||
const savedSettingsValues: SettingValuesContainer = await this.storage.get<SettingValuesContainer>(
|
||||
STORAGE_KEY_SETTING_VALUES,
|
||||
);
|
||||
const savedSettingsValues: SettingValuesContainer =
|
||||
await this.storage.get<SettingValuesContainer>(STORAGE_KEY_SETTING_VALUES);
|
||||
const cacheSettingsValues = this.getSettingValuesFromCache();
|
||||
const mergedSettingValues = deepMerge(savedSettingsValues, cacheSettingsValues);
|
||||
await this.storage.put<SettingValuesContainer>(STORAGE_KEY_SETTING_VALUES, mergedSettingValues);
|
||||
|
||||
@@ -101,7 +101,10 @@ export class InternetConnectionService {
|
||||
|
||||
private readonly errors = new Set<unknown>();
|
||||
|
||||
constructor(private readonly logger: NGXLogger, private readonly router: Router) {}
|
||||
constructor(
|
||||
private readonly logger: NGXLogger,
|
||||
private readonly router: Router,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Retry all failed http requests
|
||||
|
||||
@@ -22,7 +22,10 @@
|
||||
height: 100%;
|
||||
|
||||
font-size: inherit;
|
||||
font-variation-settings: 'wght' var(--weight), 'GRAD' var(--grade), 'FILL' var(--fill);
|
||||
font-variation-settings:
|
||||
'wght' var(--weight),
|
||||
'GRAD' var(--grade),
|
||||
'FILL' var(--fill);
|
||||
|
||||
transition: all 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
border-radius: var(--border-radius-default);
|
||||
box-shadow: var(--shadow-cards);
|
||||
|
||||
transition: transform 250ms ease-in-out, box-shadow 250ms ease-in-out;
|
||||
transition:
|
||||
transform 250ms ease-in-out,
|
||||
box-shadow 250ms ease-in-out;
|
||||
}
|
||||
|
||||
@media (hover: hover) {
|
||||
|
||||
Reference in New Issue
Block a user