diff --git a/.eslintrc.json b/.eslintrc.json index 067fc62..2c42ec2 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -16,7 +16,7 @@ ], "parserOptions": { "project": [ - "tsconfig.json" + "projects/common-ui/tsconfig.json" ] }, "rules": { @@ -82,6 +82,7 @@ "no-underscore-dangle": "off", "no-param-reassign": "error", "no-dupe-class-members": "off", + "no-redeclare": "off", "consistent-return": "off", "@typescript-eslint/restrict-template-expressions": "off", "@typescript-eslint/lines-between-class-members": "off" diff --git a/src/lib/buttons/help-button/help-button.component.ts b/src/lib/buttons/help-button/help-button.component.ts index efd4139..86f8d49 100644 --- a/src/lib/buttons/help-button/help-button.component.ts +++ b/src/lib/buttons/help-button/help-button.component.ts @@ -1,3 +1,4 @@ +/* eslint-disable @angular-eslint/prefer-on-push-component-change-detection */ import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import { HelpModeService } from '@iqser/common-ui'; @@ -17,7 +18,7 @@ export class HelpButtonComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { - this._helpModeService.helpButtonKey = null; + this._helpModeService.helpButtonKey = undefined; } activateHelpMode(): void { diff --git a/src/lib/filtering/single-filter/single-filter.component.ts b/src/lib/filtering/single-filter/single-filter.component.ts index c11ae07..a85351a 100644 --- a/src/lib/filtering/single-filter/single-filter.component.ts +++ b/src/lib/filtering/single-filter/single-filter.component.ts @@ -1,3 +1,4 @@ +/* eslint-disable @angular-eslint/prefer-on-push-component-change-detection */ import { Component, Input } from '@angular/core'; import { FilterService } from '../filter.service'; import { IFilter } from '../models/filter.model'; diff --git a/src/lib/help-mode/help-mode.service.ts b/src/lib/help-mode/help-mode.service.ts index b78abe9..202b50c 100644 --- a/src/lib/help-mode/help-mode.service.ts +++ b/src/lib/help-mode/help-mode.service.ts @@ -27,18 +27,15 @@ interface Helper { providedIn: 'root', }) export class HelpModeService { + helpButtonKey: string | undefined; private readonly _isHelpModeActive$ = new BehaviorSubject(false); readonly isHelpModeActive$ = this._isHelpModeActive$.asObservable(); private readonly _helpModeDialogIsOpened$ = new BehaviorSubject(false); readonly helpModeDialogIsOpened$ = this._helpModeDialogIsOpened$.asObservable(); - private readonly _helperElements: Record = {}; private readonly _renderer: Renderer2; - private _dialogMode = false; - helpButtonKey: string | null = null; - constructor( @Inject(HELP_DOCS) private readonly _docs: Record>, @Inject(MANUAL_BASE_URL) private readonly _manualBaseURL: string, @@ -95,7 +92,7 @@ export class HelpModeService { } highlightHelperElements(): void { - Object.values(this._helperElements).forEach(({ element, helperElement }) => { + Object.values(this._helperElements).forEach(({ helperElement }) => { this._renderer.addClass(helperElement, 'help-highlight'); setTimeout(() => { this._renderer.removeClass(helperElement, 'help-highlight'); diff --git a/src/lib/inputs/form-field/form-field-component.directive.ts b/src/lib/inputs/form-field/form-field-component.directive.ts index 0574ac8..08ae8e4 100644 --- a/src/lib/inputs/form-field/form-field-component.directive.ts +++ b/src/lib/inputs/form-field/form-field-component.directive.ts @@ -12,6 +12,7 @@ export abstract class FormFieldComponent implements ControlValueAccessor, Val return this._value; } + // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars onChange = (value?: I) => {}; onTouched = () => {}; diff --git a/src/lib/listing/table-content/table-content.component.ts b/src/lib/listing/table-content/table-content.component.ts index c1c1d87..1adf5d5 100644 --- a/src/lib/listing/table-content/table-content.component.ts +++ b/src/lib/listing/table-content/table-content.component.ts @@ -1,3 +1,4 @@ +/* eslint-disable @angular-eslint/prefer-on-push-component-change-detection */ import { AfterViewInit, Component, forwardRef, HostListener, Inject, Input, OnDestroy, ViewChild } from '@angular/core'; import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling'; import { delay, tap } from 'rxjs/operators'; diff --git a/src/lib/misc/small-chip/small-chip.component.ts b/src/lib/misc/small-chip/small-chip.component.ts index db9a6e5..2996250 100644 --- a/src/lib/misc/small-chip/small-chip.component.ts +++ b/src/lib/misc/small-chip/small-chip.component.ts @@ -1,6 +1,7 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; @Component({ + // eslint-disable-next-line @angular-eslint/component-selector selector: 'redaction-small-chip [color]', templateUrl: './small-chip.component.html', styleUrls: ['./small-chip.component.scss'], diff --git a/src/lib/services/generic.service.ts b/src/lib/services/generic.service.ts index 95014bf..f3e0950 100644 --- a/src/lib/services/generic.service.ts +++ b/src/lib/services/generic.service.ts @@ -30,7 +30,7 @@ export abstract class GenericService { get(): Observable; // eslint-disable-next-line @typescript-eslint/unified-signatures get(id: string, ...args: unknown[]): Observable; - // eslint-disable-next-line @typescript-eslint/no-unused-vars + // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars get(id?: string, ...args: unknown[]): Observable { return id ? this._getOne([id]) : this.getAll(); } diff --git a/src/lib/utils/decorators/on-change.decorator.ts b/src/lib/utils/decorators/on-change.decorator.ts index 11ddf69..f608e6a 100644 --- a/src/lib/utils/decorators/on-change.decorator.ts +++ b/src/lib/utils/decorators/on-change.decorator.ts @@ -24,7 +24,9 @@ export function OnChange(callback: CallBackFunction | string): PropertyDec // eslint-disable-next-line @typescript-eslint/ban-types export function OnChange(callback: CallBackFunction | FunctionKeys): TypedPropertyDecorator; // eslint-disable-next-line @typescript-eslint/ban-types -export function OnChange(callback: CallBackFunction | FunctionKeys): TypedPropertyDecorator { +export function OnChange( + callback: CallBackFunction | string | FunctionKeys, +): TypedPropertyDecorator | PropertyDecorator { return function _onChange(target: C, key: PropertyKey) { Object.defineProperty(target, key, { set(value: T) { diff --git a/src/lib/utils/decorators/required.decorator.ts b/src/lib/utils/decorators/required.decorator.ts index b142468..0ffd13f 100644 --- a/src/lib/utils/decorators/required.decorator.ts +++ b/src/lib/utils/decorators/required.decorator.ts @@ -7,6 +7,7 @@ export function Required(condition: Condition = () => true): PropertyDecor if (condition(this)) { throw new Error(`Attribute ${String(propertyKey)} is required`); } + return this[propertyKey]; }, set(value: unknown) { Object.defineProperty(this, propertyKey, { diff --git a/tsconfig.json b/tsconfig.json index ce070a7..cc10762 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,16 +2,22 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "../../dist/out-tsc", + "strict": true, "declaration": true, "declarationMap": true, "inlineSources": true, "forceConsistentCasingInFileNames": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, - "lib": ["dom", "es2020"], + "lib": [ + "dom", + "es2020" + ], "allowSyntheticDefaultImports": true }, - "include": ["**/*.ts"], + "include": [ + "**/*.ts" + ], "angularCompilerOptions": { "strictInjectionParameters": true, "strictInputAccessModifiers": true