diff --git a/client/.prettierrc b/client/.prettierrc index 2230fceab..9ab259ab1 100644 --- a/client/.prettierrc +++ b/client/.prettierrc @@ -1,8 +1,11 @@ { "printWidth": 120, + "tabWidth": 4, "singleQuote": true, "useTabs": false, - "tabWidth": 4, + "bracketSpacing": true, + "htmlWhitespaceSensitivity": "strict", "semi": true, - "bracketSpacing": true + "trailingComma": "es5", + "arrowParens": "avoid" } diff --git a/client/angular.json b/client/angular.json index ad17a72eb..e45d51651 100644 --- a/client/angular.json +++ b/client/angular.json @@ -70,7 +70,7 @@ "polyfills": "src/polyfills.ts", "tsConfig": "src/tsconfig.spec.json", "karmaConfig": "src/karma.conf.js", - "styles": ["src/styles.css"], + "styles": ["src/styles.scss"], "scripts": [], "assets": ["src/favicon.ico", "src/assets"] } diff --git a/client/package.json b/client/package.json index 42c43c5c5..bfa291943 100644 --- a/client/package.json +++ b/client/package.json @@ -3,32 +3,33 @@ "version": "0.0.0", "scripts": { "ng": "ng", - "start": "ng serve --proxy-config proxy.conf.json --host=0.0.0.0 --aot", - "build": "ng build", + "start": "ng serve --proxy-config proxy.conf.json --host=0.0.0.0", + "build": "ng build --prod --aot", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", "compodoc": "./node_modules/.bin/compodoc --hideGenerator -p src/tsconfig.app.json -n 'OpenSlides Documentation' -d ../Compodoc -s -w -t -o --port", "extract": "ngx-translate-extract -i ./src -o ./src/assets/i18n/template-en.pot -clean --sort --format pot -m _", "po2json": "./node_modules/.bin/po2json -f mf src/assets/i18n/de.po src/assets/i18n/de.json && ./node_modules/.bin/po2json -f mf src/assets/i18n/cs.po src/assets/i18n/cs.json", - "prettify": "pretty-quick" + "prettify-changes": "pretty-quick --staged", + "prettify-all": "pretty-quick" }, "private": true, "dependencies": { "@angular/animations": "^7.0.0", - "@angular/cdk": "^7.0.0", + "@angular/cdk": "^7.0.4", "@angular/common": "^7.0.0", "@angular/compiler": "^7.0.0", "@angular/core": "^7.0.0", "@angular/forms": "^7.0.0", "@angular/http": "^7.0.0", - "@angular/material": "^7.0.0", + "@angular/material": "^7.0.4", "@angular/platform-browser": "^7.0.0", "@angular/platform-browser-dynamic": "^7.0.0", "@angular/router": "^7.0.0", - "@ngx-pwa/local-storage": "^6.2.0", - "@ngx-translate/core": "^10.0.2", - "@ngx-translate/http-loader": "^3.0.1", + "@ngx-pwa/local-storage": "^7.0.0", + "@ngx-translate/core": "^11.0.1", + "@ngx-translate/http-loader": "^4.0.0", "core-js": "^2.5.4", "file-saver": "^2.0.0-rc.3", "material-design-icons": "^3.0.1", @@ -40,18 +41,18 @@ "zone.js": "^0.8.26" }, "devDependencies": { - "@angular-devkit/build-angular": "^0.7.0", - "@angular/cli": "^7.0.2", + "@angular-devkit/build-angular": "^0.10.5", + "@angular/cli": "^7.0.5", "@angular/compiler-cli": "^7.0.0", "@angular/language-service": "^7.0.0", "@biesbjerg/ngx-translate-extract": "^2.3.4", "@compodoc/compodoc": "^1.1.5", "@types/jasmine": "^2.8.9", "@types/jasminewd2": "^2.0.5", - "@types/node": "~8.9.4", + "@types/node": "~10.12.7", "@types/yargs": "^12.0.1", - "codelyzer": "~4.2.1", - "husky": "^0.14.3", + "codelyzer": "~4.5.0", + "husky": "^1.1.4", "jasmine-core": "~2.99.1", "jasmine-spec-reporter": "~4.2.1", "karma": "^3.0.0", @@ -60,12 +61,13 @@ "karma-jasmine": "~1.1.1", "karma-jasmine-html-reporter": "^0.2.2", "npm-run-all": "^4.1.3", - "prettier": "^1.14.3", + "prettier": "^1.15.2", "pretty-quick": "^1.8.0", "protractor": "^5.4.1", - "ts-node": "~5.0.1", - "tslint": "~5.9.1", - "tsutils": "^3.1.0", - "typescript": "^3.1.3" + "ts-node": "~7.0.1", + "tslint": "~5.11.0", + "tsutils": "^3.5.0", + "typescript": "^3.1.3", + "webpack-bundle-analyzer": "^3.0.3" } } diff --git a/client/src/app/core/services/app-load.service.ts b/client/src/app/core/services/app-load.service.ts index 374bad9fc..c229c66e5 100644 --- a/client/src/app/core/services/app-load.service.ts +++ b/client/src/app/core/services/app-load.service.ts @@ -1,7 +1,6 @@ import { Injectable } from '@angular/core'; import { plugins } from '../../../plugins'; import { CommonAppConfig } from '../../site/common/common.config'; -import { ModelConstructor, BaseModel } from '../../shared/models/base/base-model'; import { AppConfig } from '../../site/base/app-config'; import { CollectionStringModelMapperService } from './collectionStringModelMapper.service'; import { MediafileAppConfig } from '../../site/mediafiles/mediafile.config'; diff --git a/client/src/app/core/services/storage.service.ts b/client/src/app/core/services/storage.service.ts index 3d2e33c9c..fc56b1d2d 100644 --- a/client/src/app/core/services/storage.service.ts +++ b/client/src/app/core/services/storage.service.ts @@ -32,11 +32,15 @@ export class StorageService { /** * get a value from the store. You need to subscribe to the request to retrieve the value. + * + * TODO: This needs adjustment to ensure safe access. + * Since angular 7 `LocalStorrage.getItem` will return "unknown" instead of any. + * https://github.com/cyrilletuzi/angular-async-local-storage/blob/master/docs/MIGRATION_TO_V7.md * @param key The key to get the value from * @returns The requested value to the key */ public async get(key: string): Promise { - return await this.localStorage.getItem(key).toPromise(); + return await this.localStorage.getUnsafeItem(key).toPromise(); } /** diff --git a/client/src/app/site/agenda/components/topic-detail/topic-detail.component.ts b/client/src/app/site/agenda/components/topic-detail/topic-detail.component.ts index cb03e75c6..0983c9e8a 100644 --- a/client/src/app/site/agenda/components/topic-detail/topic-detail.component.ts +++ b/client/src/app/site/agenda/components/topic-detail/topic-detail.component.ts @@ -178,7 +178,7 @@ export class TopicDetailComponent { * @param event has the code */ public keyDownFunction(event: KeyboardEvent): void { - if (event.keyCode === 27) { + if (event.key === "Escape") { this.setEditMode(false); } } diff --git a/client/src/app/site/common/components/start/start.component.ts b/client/src/app/site/common/components/start/start.component.ts index f7aeef948..5db5b6e65 100644 --- a/client/src/app/site/common/components/start/start.component.ts +++ b/client/src/app/site/common/components/start/start.component.ts @@ -8,9 +8,6 @@ import { TranslateService } from '@ngx-translate/core'; // showcase import { Config } from '../../../../shared/models/core/config'; import { DataStoreService } from '../../../../core/services/data-store.service'; -// for Drag n Drop Test -import { moveItemInArray, CdkDragDrop } from '@angular/cdk/drag-drop'; - @Component({ selector: 'os-start', templateUrl: './start.component.html', diff --git a/client/src/app/site/motions/components/category-list/category-list.component.ts b/client/src/app/site/motions/components/category-list/category-list.component.ts index 91ff85ce9..50a7228b6 100644 --- a/client/src/app/site/motions/components/category-list/category-list.component.ts +++ b/client/src/app/site/motions/components/category-list/category-list.component.ts @@ -94,7 +94,7 @@ export class CategoryListComponent extends BaseViewComponent implements OnInit { * @param viewCategory */ public keyDownFunction(event: KeyboardEvent, viewCategory?: ViewCategory): void { - if (event.keyCode === 13) { + if (event.key === "Enter") { if (viewCategory) { this.onSaveButton(viewCategory); } else { diff --git a/client/src/app/site/motions/components/motion-comment-section-list/motion-comment-section-list.component.ts b/client/src/app/site/motions/components/motion-comment-section-list/motion-comment-section-list.component.ts index 2ad1d4226..47502f809 100644 --- a/client/src/app/site/motions/components/motion-comment-section-list/motion-comment-section-list.component.ts +++ b/client/src/app/site/motions/components/motion-comment-section-list/motion-comment-section-list.component.ts @@ -76,7 +76,7 @@ export class MotionCommentSectionListComponent extends BaseViewComponent impleme * Event on Key Down in update or create form. Do not provide the viewSection for the create form. */ public keyDownFunction(event: KeyboardEvent, viewSection?: ViewMotionCommentSection): void { - if (event.keyCode === 13) { + if (event.key === "Escape") { if (viewSection) { this.onSaveButton(viewSection); } else { diff --git a/client/src/app/site/tags/components/tag-list/tag-list.component.ts b/client/src/app/site/tags/components/tag-list/tag-list.component.ts index 2e0544328..4c85aa381 100644 --- a/client/src/app/site/tags/components/tag-list/tag-list.component.ts +++ b/client/src/app/site/tags/components/tag-list/tag-list.component.ts @@ -138,7 +138,7 @@ export class TagListComponent extends ListViewBaseComponent implements * @param event */ public keyDownFunction(event: KeyboardEvent): void { - if (event.keyCode === 27) { + if (event.key === "Enter") { this.cancelEditing(); } } diff --git a/client/src/app/site/users/components/group-list/group-list.component.ts b/client/src/app/site/users/components/group-list/group-list.component.ts index c64ce426d..ccfa42755 100644 --- a/client/src/app/site/users/components/group-list/group-list.component.ts +++ b/client/src/app/site/users/components/group-list/group-list.component.ts @@ -198,7 +198,7 @@ export class GroupListComponent extends BaseViewComponent implements OnInit { * Clicking escape while in #newGroupForm should toggle newGroup. */ public keyDownFunction(event: KeyboardEvent): void { - if (event.keyCode === 27) { + if (event.key === "Escape") { this.newGroup = false; } }