From 2df99f3101eb10b042dad2434b302e5fdd8a0e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20B=C3=BCrk?= Date: Fri, 14 Dec 2018 09:51:53 +0100 Subject: [PATCH] Some initial bootstrapping --- .editorconfig | 4 +- angular.json | 80 +++--- projects/ngqp/core/karma.conf.js | 54 ++-- projects/ngqp/core/ng-package.json | 10 +- projects/ngqp/core/package.json | 16 +- projects/ngqp/core/src/lib/core.module.ts | 9 - projects/ngqp/core/src/lib/core.ts | 5 + projects/ngqp/core/src/lib/model.ts | 101 +++++++ .../src/lib/query-param-builder.service.ts | 39 +++ .../src/lib/query-param-group.directive.ts | 90 ++++++ .../src/lib/query-param-name.directive.ts | 74 +++++ .../ngqp/core/src/lib/query-param.module.ts | 16 ++ projects/ngqp/core/src/lib/util.ts | 13 + projects/ngqp/core/src/public_api.ts | 2 +- projects/ngqp/core/src/test.ts | 8 +- projects/ngqp/core/tsconfig.lib.json | 60 ++-- projects/ngqp/core/tsconfig.spec.json | 28 +- projects/ngqp/core/tslint.json | 29 +- tsconfig.json | 54 ++-- tslint.json | 256 +++++++++--------- 20 files changed, 639 insertions(+), 309 deletions(-) delete mode 100644 projects/ngqp/core/src/lib/core.module.ts create mode 100644 projects/ngqp/core/src/lib/core.ts create mode 100644 projects/ngqp/core/src/lib/model.ts create mode 100644 projects/ngqp/core/src/lib/query-param-builder.service.ts create mode 100644 projects/ngqp/core/src/lib/query-param-group.directive.ts create mode 100644 projects/ngqp/core/src/lib/query-param-name.directive.ts create mode 100644 projects/ngqp/core/src/lib/query-param.module.ts create mode 100644 projects/ngqp/core/src/lib/util.ts diff --git a/.editorconfig b/.editorconfig index e89330a..3d020f8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,8 +4,8 @@ root = true [*] charset = utf-8 indent_style = space -indent_size = 2 -insert_final_newline = true +indent_size = 4 +insert_final_newline = false trim_trailing_whitespace = true [*.md] diff --git a/angular.json b/angular.json index b138c00..6261b5b 100644 --- a/angular.json +++ b/angular.json @@ -1,43 +1,43 @@ { - "$schema": "./node_modules/@angular/cli/lib/config/schema.json", - "version": 1, - "newProjectRoot": "projects", - "projects": { - "@ngqp/core": { - "root": "projects/ngqp/core", - "sourceRoot": "projects/ngqp/core/src", - "projectType": "library", - "prefix": "lib", - "architect": { - "build": { - "builder": "@angular-devkit/build-ng-packagr:build", - "options": { - "tsConfig": "projects/ngqp/core/tsconfig.lib.json", - "project": "projects/ngqp/core/ng-package.json" - } - }, - "test": { - "builder": "@angular-devkit/build-angular:karma", - "options": { - "main": "projects/ngqp/core/src/test.ts", - "tsConfig": "projects/ngqp/core/tsconfig.spec.json", - "karmaConfig": "projects/ngqp/core/karma.conf.js" - } - }, - "lint": { - "builder": "@angular-devkit/build-angular:tslint", - "options": { - "tsConfig": [ - "projects/ngqp/core/tsconfig.lib.json", - "projects/ngqp/core/tsconfig.spec.json" - ], - "exclude": [ - "**/node_modules/**" - ] - } + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "@ngqp/core": { + "root": "projects/ngqp/core", + "sourceRoot": "projects/ngqp/core/src", + "projectType": "library", + "prefix": "lib", + "architect": { + "build": { + "builder": "@angular-devkit/build-ng-packagr:build", + "options": { + "tsConfig": "projects/ngqp/core/tsconfig.lib.json", + "project": "projects/ngqp/core/ng-package.json" + } + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "main": "projects/ngqp/core/src/test.ts", + "tsConfig": "projects/ngqp/core/tsconfig.spec.json", + "karmaConfig": "projects/ngqp/core/karma.conf.js" + } + }, + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [ + "projects/ngqp/core/tsconfig.lib.json", + "projects/ngqp/core/tsconfig.spec.json" + ], + "exclude": [ + "**/node_modules/**" + ] + } + } + } } - } - } - }, - "defaultProject": "@ngqp/core" + }, + "defaultProject": "@ngqp/core" } \ No newline at end of file diff --git a/projects/ngqp/core/karma.conf.js b/projects/ngqp/core/karma.conf.js index 79abacc..85fbfa7 100644 --- a/projects/ngqp/core/karma.conf.js +++ b/projects/ngqp/core/karma.conf.js @@ -1,31 +1,31 @@ // Karma configuration file, see link for more information // https://karma-runner.github.io/1.0/config/configuration-file.html -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../../coverage'), - reports: ['html', 'lcovonly'], - fixWebpackSourcePaths: true - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false - }); +module.exports = function(config) { + config.set({ + basePath: '', + frameworks: [ 'jasmine', '@angular-devkit/build-angular' ], + plugins: [ + require('karma-jasmine'), + require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), + require('karma-coverage-istanbul-reporter'), + require('@angular-devkit/build-angular/plugins/karma') + ], + client: { + clearContext: false // leave Jasmine Spec Runner output visible in browser + }, + coverageIstanbulReporter: { + dir: require('path').join(__dirname, '../../../coverage'), + reports: [ 'html', 'lcovonly' ], + fixWebpackSourcePaths: true + }, + reporters: [ 'progress', 'kjhtml' ], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: [ 'Chrome' ], + singleRun: false + }); }; diff --git a/projects/ngqp/core/ng-package.json b/projects/ngqp/core/ng-package.json index b31df4d..c19c6f5 100644 --- a/projects/ngqp/core/ng-package.json +++ b/projects/ngqp/core/ng-package.json @@ -1,7 +1,7 @@ { - "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", - "dest": "../../../dist/ngqp/core", - "lib": { - "entryFile": "src/public_api.ts" - } + "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", + "dest": "../../../dist/ngqp/core", + "lib": { + "entryFile": "src/public_api.ts" + } } \ No newline at end of file diff --git a/projects/ngqp/core/package.json b/projects/ngqp/core/package.json index ae80965..5ce1687 100644 --- a/projects/ngqp/core/package.json +++ b/projects/ngqp/core/package.json @@ -1,9 +1,11 @@ { - "name": "@ngqp/core", - "version": "0.0.1", - "peerDependencies": { - "@angular/common": "^7.x.x", - "@angular/core": "^7.x.x", - "@angular/router": "^7.x.x" - } + "name": "@ngqp/core", + "version": "0.0.1", + "peerDependencies": { + "@angular/common": "^7.x.x", + "@angular/core": "^7.x.x", + "@angular/forms": "^7.x.x", + "@angular/router": "^7.x.x", + "rxjs": "^6.x.x" + } } diff --git a/projects/ngqp/core/src/lib/core.module.ts b/projects/ngqp/core/src/lib/core.module.ts deleted file mode 100644 index 869ae28..0000000 --- a/projects/ngqp/core/src/lib/core.module.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { NgModule } from '@angular/core'; - -@NgModule({ - declarations: [], - imports: [], - exports: [] -}) -export class CoreModule { -} diff --git a/projects/ngqp/core/src/lib/core.ts b/projects/ngqp/core/src/lib/core.ts new file mode 100644 index 0000000..bcb1e4d --- /dev/null +++ b/projects/ngqp/core/src/lib/core.ts @@ -0,0 +1,5 @@ +export { QueryParamGroup, QueryParamControl, QueryParamControlOpts } from './model'; +export { QueryParamNameDirective } from './query-param-name.directive'; +export { QueryParamGroupDirective } from './query-param-group.directive'; +export { QueryParamBuilder } from './query-param-builder.service'; +export { QueryParamModule } from './query-param.module'; \ No newline at end of file diff --git a/projects/ngqp/core/src/lib/model.ts b/projects/ngqp/core/src/lib/model.ts new file mode 100644 index 0000000..7f95a6d --- /dev/null +++ b/projects/ngqp/core/src/lib/model.ts @@ -0,0 +1,101 @@ +import { Observable, Subject } from 'rxjs'; +import { isOptionalFunction } from './util'; + +/** + * TODO Documentation + */ +export class QueryParamGroup { + + /** @internal Maps each control name to the corresponding control. */ + public controls: {[controlName: string]: QueryParamControl} = {}; + + constructor(controls: {[controlName: string]: QueryParamControl}) { + this.controls = controls; + } + + /** + * TODO Documentation + */ + public setValue(/* TODO { emitEvent? } */): void { + // TODO + } + + /** + * TODO Documentation + */ + public patchValue(/* TODO { emitEvent? } */): void { + // TODO + } + + /** + * TODO Documentation + */ + public get valueChanges(): Observable { + // TODO Implement and turn into a property + return null; + } + +} + +/** + * TODO Documentation + */ +export class QueryParamControl { + + /** TODO Documentation */ + public value: T = null; + + /** TODO Documentation */ + // @ts-ignore + public readonly valueChanges$ = this._valueChanges$.asObservable(); + + /** TODO Documentation */ + public name: string | null = null; + + /** TODO Documentation */ + public initialValue!: T | null; + + /** TODO Documentation */ + public serialize: (model: T) => string; + + /** TODO Documentation */ + public deserialize: (value: string) => T; + + // TODO Add combineWith(previousValue: T, currentValue: T): Params + + // TODO Who completes this? + private _valueChanges$ = new Subject(); + + constructor(config: QueryParamControlOpts) { + const { + name = null, + initialValue = null, + serialize = model => '' + model, + deserialize = value => value as any, + } = config; + + if (!isOptionalFunction(serialize)) { + throw new Error(`serialize must be a function, but received ${serialize}`); + } + + if (!isOptionalFunction(deserialize)) { + throw new Error(`deserialize must be a function, but received ${deserialize}`); + } + + this.name = name; + this.initialValue = initialValue; + this.serialize = serialize; + this.deserialize = deserialize; + } + +} + +/** + * TODO Documentation + */ +export interface QueryParamControlOpts { + name?: string; + initialValue?: T; + serialize?: (model: T) => string; + deserialize?: (value: string) => T; +} \ No newline at end of file diff --git a/projects/ngqp/core/src/lib/query-param-builder.service.ts b/projects/ngqp/core/src/lib/query-param-builder.service.ts new file mode 100644 index 0000000..3755884 --- /dev/null +++ b/projects/ngqp/core/src/lib/query-param-builder.service.ts @@ -0,0 +1,39 @@ +import { Injectable } from '@angular/core'; +import { QueryParamControl, QueryParamControlOpts, QueryParamGroup } from './model'; + +/** + * TODO Documentation + */ +@Injectable({ + providedIn: 'root' +}) +export class QueryParamBuilder { + + /** + * TODO Documentation + */ + public group(config: { [ name: string ]: QueryParamControl | string }): QueryParamGroup { + const controls: { [ controlName: string ]: QueryParamControl } = {}; + Object.keys(config).forEach(controlName => { + controls[ controlName ] = this.createControl(config[ controlName ]); + }); + + return new QueryParamGroup(controls); + } + + /** + * TODO Documentation + */ + public param(config: QueryParamControlOpts = {}): QueryParamControl { + return new QueryParamControl(config); + } + + private createControl(controlConfig: QueryParamControl | string): QueryParamControl { + if (controlConfig instanceof QueryParamControl) { + return controlConfig; + } + + return this.param(); + } + +} diff --git a/projects/ngqp/core/src/lib/query-param-group.directive.ts b/projects/ngqp/core/src/lib/query-param-group.directive.ts new file mode 100644 index 0000000..c68dd2d --- /dev/null +++ b/projects/ngqp/core/src/lib/query-param-group.directive.ts @@ -0,0 +1,90 @@ +import { Directive, Input, OnDestroy } from '@angular/core'; +import { ActivatedRoute, Params, Router } from '@angular/router'; +import { Subject } from 'rxjs'; +import { concatMap, map, takeUntil } from 'rxjs/operators'; +import { QueryParamControl, QueryParamGroup } from './model'; +import { QueryParamNameDirective } from './query-param-name.directive'; + +/** + * TODO Documentation + */ +@Directive({ + selector: '[queryParamGroup]', +}) +export class QueryParamGroupDirective implements OnDestroy { + + /** TODO Documentation */ + @Input('queryParamGroup') + public queryParamGroup: QueryParamGroup; + + /** TODO Documentation */ + private directives: QueryParamNameDirective[] = []; + + /** TODO Documentation */ + private queue$ = new Subject(); + private destroy$ = new Subject(); + + constructor( + private router: Router, + private route: ActivatedRoute, + ) { + this.setupNavigationQueue(); + } + + public ngOnDestroy() { + this.destroy$.next(); + this.destroy$.complete(); + } + + public addControl(directive: QueryParamNameDirective): void { + const control: QueryParamControl = this.queryParamGroup.controls[directive.name]; + if (!control) { + throw new Error(`Could not find control ${directive.name}. Did you forget to add it to your QueryParamGroup?`); + } + if (!directive.valueAccessor) { + throw new Error(`No value accessor found for the control. Please make sure to implement ControlValueAccessor on this component.`); + } + + directive.valueAccessor.writeValue(control.initialValue); + + // View -> Model + directive.valueAccessor.registerOnChange((newModel: any) => { + this.enqueueNavigation({ + [control.name]: control.serialize(newModel) + }); + }); + + // Model -> View + this.route.queryParamMap.pipe( + map(queryParamMap => queryParamMap.get(control.name)), + map(param => control.deserialize(param)), + ).subscribe(newModel => { + if (control.serialize(newModel) === control.serialize(control.value)) { + return; + } + + directive.valueAccessor.writeValue(newModel); + control.value = newModel; + }); + + this.directives.push(directive); + } + + private setupNavigationQueue() { + // TODO Use bufferReduceMap (https://stackoverflow.com/questions/53732408) + this.queue$.pipe( + takeUntil(this.destroy$), + concatMap(params => this.router.navigate([], { + relativeTo: this.route, + queryParamsHandling: 'merge', + // TODO Allow specifying skipLocationChange / replaceUrl + queryParams: params, + })), + ).subscribe(); + } + + private enqueueNavigation(params: Params): void { + this.queue$.next(params); + } + +} diff --git a/projects/ngqp/core/src/lib/query-param-name.directive.ts b/projects/ngqp/core/src/lib/query-param-name.directive.ts new file mode 100644 index 0000000..ed4b1ae --- /dev/null +++ b/projects/ngqp/core/src/lib/query-param-name.directive.ts @@ -0,0 +1,74 @@ +import { Directive, Host, Inject, Input, OnChanges, OnInit, Optional, Self, SimpleChanges, SkipSelf } from '@angular/core'; +import { ControlValueAccessor, DefaultValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; +import { QueryParamGroupDirective } from './query-param-group.directive'; + +/** + * TODO Documentation + */ +@Directive({ + selector: '[queryParamName]', +}) +export class QueryParamNameDirective implements OnInit, OnChanges { + + /** TODO Documentation */ + @Input('queryParamName') + public name: string; + + /** TODO Documentation */ + public valueAccessor: ControlValueAccessor | null = null; + + private added = false; + + constructor( + @Optional() @Host() @SkipSelf() private parent: QueryParamGroupDirective, + @Optional() @Self() @Inject(NG_VALUE_ACCESSOR) valueAccessors: ControlValueAccessor[], + ) { + if (!this.parent) { + throw new Error(`No parent configuration found. Did you forget to add [queryParamGroup]?`); + } + + this.valueAccessor = this.selectValueAccessor(valueAccessors); + } + + public ngOnInit() { + if (!this.name) { + throw new Error(`queryParamName has been added, but without specifying the name.`); + } + } + + public ngOnChanges(changes: SimpleChanges) { + if (!this.added) { + this.setupControl(); + } + } + + /** + * This resembles the selectControlValueAccessor function from + * https://github.com/angular/angular/blob/7.1.2/packages/forms/src/directives/shared.ts#L186 + * We can't use it directly since it isn't exported in the public API, but let's hope choosing + * any accessor is good enough for our purposes. + */ + private selectValueAccessor(valueAccessors: ControlValueAccessor[]): ControlValueAccessor | null { + if (!valueAccessors) { + return null; + } + + const customAccessor = valueAccessors.find(valueAccessor => valueAccessor.constructor !== DefaultValueAccessor); + if (customAccessor !== undefined) { + return customAccessor; + } + + const defaultAccessor = valueAccessors.find(valueAccessor => valueAccessor.constructor === DefaultValueAccessor); + if (defaultAccessor !== undefined) { + return defaultAccessor; + } + + return null; + } + + private setupControl(): void { + this.parent.addControl(this); + this.added = true; + } + +} diff --git a/projects/ngqp/core/src/lib/query-param.module.ts b/projects/ngqp/core/src/lib/query-param.module.ts new file mode 100644 index 0000000..0cd680f --- /dev/null +++ b/projects/ngqp/core/src/lib/query-param.module.ts @@ -0,0 +1,16 @@ +import { NgModule, Type } from '@angular/core'; +import { QueryParamNameDirective } from './query-param-name.directive'; +import { QueryParamGroupDirective } from './query-param-group.directive'; + +const DIRECTIVES: Type[] = [ + QueryParamNameDirective, + QueryParamGroupDirective, +]; + +@NgModule({ + imports: [], + declarations: [ DIRECTIVES ], + exports: [ DIRECTIVES ], +}) +export class QueryParamModule { +} diff --git a/projects/ngqp/core/src/lib/util.ts b/projects/ngqp/core/src/lib/util.ts new file mode 100644 index 0000000..41e05bb --- /dev/null +++ b/projects/ngqp/core/src/lib/util.ts @@ -0,0 +1,13 @@ +/** + * TODO Documentation + */ +export function isDefined(obj: any): boolean { + return obj !== undefined && obj !== null; +} + +/** + * TODO Documentation + */ +export function isOptionalFunction(obj: any): boolean { + return !isDefined(obj) || typeof obj === 'function'; +} \ No newline at end of file diff --git a/projects/ngqp/core/src/public_api.ts b/projects/ngqp/core/src/public_api.ts index ab5a2f7..16702e8 100644 --- a/projects/ngqp/core/src/public_api.ts +++ b/projects/ngqp/core/src/public_api.ts @@ -1 +1 @@ -export * from './lib/core.module'; +export * from './lib/core'; \ No newline at end of file diff --git a/projects/ngqp/core/src/test.ts b/projects/ngqp/core/src/test.ts index e11ff1c..0f51930 100644 --- a/projects/ngqp/core/src/test.ts +++ b/projects/ngqp/core/src/test.ts @@ -5,16 +5,16 @@ import 'zone.js/dist/zone'; import 'zone.js/dist/zone-testing'; import { getTestBed } from '@angular/core/testing'; import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting + BrowserDynamicTestingModule, + platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; declare const require: any; // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() + BrowserDynamicTestingModule, + platformBrowserDynamicTesting() ); // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); diff --git a/projects/ngqp/core/tsconfig.lib.json b/projects/ngqp/core/tsconfig.lib.json index 4af309b..27f9486 100644 --- a/projects/ngqp/core/tsconfig.lib.json +++ b/projects/ngqp/core/tsconfig.lib.json @@ -1,33 +1,33 @@ { - "extends": "../../../tsconfig.json", - "compilerOptions": { - "outDir": "../../../out-tsc/lib", - "target": "es2015", - "module": "es2015", - "moduleResolution": "node", - "declaration": true, - "sourceMap": true, - "inlineSources": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "importHelpers": true, - "strict": true, - "types": [], - "lib": [ - "dom", - "es2018" + "extends": "../../../tsconfig.json", + "compilerOptions": { + "outDir": "../../../out-tsc/lib", + "target": "es2015", + "module": "es2015", + "moduleResolution": "node", + "declaration": true, + "sourceMap": true, + "inlineSources": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "importHelpers": true, + "strict": true, + "types": [], + "lib": [ + "dom", + "es2018" + ] + }, + "angularCompilerOptions": { + "annotateForClosureCompiler": true, + "skipTemplateCodegen": true, + "strictMetadataEmit": true, + "fullTemplateTypeCheck": true, + "strictInjectionParameters": true, + "enableResourceInlining": true + }, + "exclude": [ + "src/test.ts", + "**/*.spec.ts" ] - }, - "angularCompilerOptions": { - "annotateForClosureCompiler": true, - "skipTemplateCodegen": true, - "strictMetadataEmit": true, - "fullTemplateTypeCheck": true, - "strictInjectionParameters": true, - "enableResourceInlining": true - }, - "exclude": [ - "src/test.ts", - "**/*.spec.ts" - ] } diff --git a/projects/ngqp/core/tsconfig.spec.json b/projects/ngqp/core/tsconfig.spec.json index 4acf941..66c1883 100644 --- a/projects/ngqp/core/tsconfig.spec.json +++ b/projects/ngqp/core/tsconfig.spec.json @@ -1,17 +1,17 @@ { - "extends": "../../../tsconfig.json", - "compilerOptions": { - "outDir": "../../../out-tsc/spec", - "types": [ - "jasmine", - "node" + "extends": "../../../tsconfig.json", + "compilerOptions": { + "outDir": "../../../out-tsc/spec", + "types": [ + "jasmine", + "node" + ] + }, + "files": [ + "src/test.ts" + ], + "include": [ + "**/*.spec.ts", + "**/*.d.ts" ] - }, - "files": [ - "src/test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] } diff --git a/projects/ngqp/core/tslint.json b/projects/ngqp/core/tslint.json index 3aa2f4c..97b4dd6 100644 --- a/projects/ngqp/core/tslint.json +++ b/projects/ngqp/core/tslint.json @@ -1,17 +1,16 @@ { - "extends": "../../../tslint.json", - "rules": { - "directive-selector": [ - true, - "attribute", - "lib", - "camelCase" - ], - "component-selector": [ - true, - "element", - "lib", - "kebab-case" - ] - } + "extends": "../../../tslint.json", + "rules": { + "directive-selector": [ + true, + "attribute", + "camelCase" + ], + "component-selector": [ + true, + "element", + "kebab-case" + ], + "max-line-length": false + } } diff --git a/tsconfig.json b/tsconfig.json index 06d425e..02a0ced 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,30 +1,30 @@ { - "compileOnSave": false, - "compilerOptions": { - "baseUrl": "./", - "outDir": "./dist/out-tsc", - "sourceMap": true, - "declaration": false, - "module": "es2015", - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "importHelpers": true, - "target": "es5", - "typeRoots": [ - "node_modules/@types" - ], - "lib": [ - "es2018", - "dom" - ], - "paths": { - "@ngqp/core": [ - "dist/ngqp/core" - ], - "@ngqp/core/*": [ - "dist/ngqp/core/*" - ] + "compileOnSave": false, + "compilerOptions": { + "baseUrl": "./", + "outDir": "./dist/out-tsc", + "sourceMap": true, + "declaration": false, + "module": "es2015", + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "importHelpers": true, + "target": "es5", + "typeRoots": [ + "node_modules/@types" + ], + "lib": [ + "es2018", + "dom" + ], + "paths": { + "@ngqp/core": [ + "dist/ngqp/core" + ], + "@ngqp/core/*": [ + "dist/ngqp/core/*" + ] + } } - } } \ No newline at end of file diff --git a/tslint.json b/tslint.json index c740a7b..5e2fb6c 100644 --- a/tslint.json +++ b/tslint.json @@ -1,131 +1,131 @@ { - "rulesDirectory": [ - "codelyzer" - ], - "rules": { - "arrow-return-shorthand": true, - "callable-types": true, - "class-name": true, - "comment-format": [ - true, - "check-space" + "rulesDirectory": [ + "codelyzer" ], - "curly": true, - "deprecation": { - "severity": "warn" - }, - "eofline": true, - "forin": true, - "import-blacklist": [ - true, - "rxjs/Rx" - ], - "import-spacing": true, - "indent": [ - true, - "spaces" - ], - "interface-over-type-literal": true, - "label-position": true, - "max-line-length": [ - true, - 140 - ], - "member-access": false, - "member-ordering": [ - true, - { - "order": [ - "static-field", - "instance-field", - "static-method", - "instance-method" - ] - } - ], - "no-arg": true, - "no-bitwise": true, - "no-console": [ - true, - "debug", - "info", - "time", - "timeEnd", - "trace" - ], - "no-construct": true, - "no-debugger": true, - "no-duplicate-super": true, - "no-empty": false, - "no-empty-interface": true, - "no-eval": true, - "no-inferrable-types": [ - true, - "ignore-params" - ], - "no-misused-new": true, - "no-non-null-assertion": true, - "no-redundant-jsdoc": true, - "no-shadowed-variable": true, - "no-string-literal": false, - "no-string-throw": true, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-unnecessary-initializer": true, - "no-unused-expression": true, - "no-use-before-declare": true, - "no-var-keyword": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-whitespace" - ], - "prefer-const": true, - "quotemark": [ - true, - "single" - ], - "radix": true, - "semicolon": [ - true, - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "unified-signatures": true, - "variable-name": false, - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ], - "no-output-on-prefix": true, - "use-input-property-decorator": true, - "use-output-property-decorator": true, - "use-host-property-decorator": true, - "no-input-rename": true, - "no-output-rename": true, - "use-life-cycle-interface": true, - "use-pipe-transform-interface": true, - "component-class-suffix": true, - "directive-class-suffix": true - } + "rules": { + "arrow-return-shorthand": true, + "callable-types": true, + "class-name": true, + "comment-format": [ + true, + "check-space" + ], + "curly": true, + "deprecation": { + "severity": "warn" + }, + "eofline": true, + "forin": true, + "import-blacklist": [ + true, + "rxjs/Rx" + ], + "import-spacing": true, + "indent": [ + true, + "spaces" + ], + "interface-over-type-literal": true, + "label-position": true, + "max-line-length": [ + true, + 140 + ], + "member-access": false, + "member-ordering": [ + true, + { + "order": [ + "static-field", + "instance-field", + "static-method", + "instance-method" + ] + } + ], + "no-arg": true, + "no-bitwise": true, + "no-console": [ + true, + "debug", + "info", + "time", + "timeEnd", + "trace" + ], + "no-construct": true, + "no-debugger": true, + "no-duplicate-super": true, + "no-empty": false, + "no-empty-interface": true, + "no-eval": true, + "no-inferrable-types": [ + true, + "ignore-params" + ], + "no-misused-new": true, + "no-non-null-assertion": true, + "no-redundant-jsdoc": true, + "no-shadowed-variable": true, + "no-string-literal": false, + "no-string-throw": true, + "no-switch-case-fall-through": true, + "no-trailing-whitespace": true, + "no-unnecessary-initializer": true, + "no-unused-expression": true, + "no-use-before-declare": true, + "no-var-keyword": true, + "object-literal-sort-keys": false, + "one-line": [ + true, + "check-open-brace", + "check-catch", + "check-else", + "check-whitespace" + ], + "prefer-const": true, + "quotemark": [ + true, + "single" + ], + "radix": true, + "semicolon": [ + true, + "always" + ], + "triple-equals": [ + true, + "allow-null-check" + ], + "typedef-whitespace": [ + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + } + ], + "unified-signatures": true, + "variable-name": false, + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-type" + ], + "no-output-on-prefix": true, + "use-input-property-decorator": true, + "use-output-property-decorator": true, + "use-host-property-decorator": true, + "no-input-rename": true, + "no-output-rename": true, + "use-life-cycle-interface": true, + "use-pipe-transform-interface": true, + "component-class-suffix": true, + "directive-class-suffix": true + } }