diff --git a/.eslintrc.json b/.eslintrc.json index 3e48ddb..9866226 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -4,16 +4,37 @@ { "files": ["*.ts"], "parserOptions": { - "project": ["tsconfig.json"], + "project": true, "createDefaultProgram": true }, "extends": [ "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:@angular-eslint/recommended", + "plugin:@typescript-eslint/strict-type-checked", + "plugin:@typescript-eslint/stylistic-type-checked", + "plugin:@angular-eslint/all", "plugin:@angular-eslint/template/process-inline-templates" ], "rules": { + "@angular-eslint/component-max-inline-declarations": "off", // We use that mostly for testing, so it's fine + "@angular-eslint/no-forward-ref": "off", // We sometimes need it + "@angular-eslint/prefer-on-push-component-change-detection": "off", + "@angular-eslint/use-component-selector": "off", // Some components are not template-able and thus do not need selector + "@typescript-eslint/consistent-type-definitions": ["error", "type"], + "@typescript-eslint/explicit-member-accessibility": "error", + "@typescript-eslint/no-confusing-void-expression": "off", // We prefer code tersity + "@typescript-eslint/no-dynamic-delete": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-extraneous-class": "off", // We have component without any logic in TS + "@typescript-eslint/no-floating-promises": "off", + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-unnecessary-condition": "off", // This is very unfortunate, but there are too many dangerous false-positive, see https://github.com/typescript-eslint/typescript-eslint/issues/1798 + "@typescript-eslint/no-unsafe-argument": "off", + "@typescript-eslint/no-unsafe-assignment": "off", + "@typescript-eslint/no-unsafe-call": "off", + "@typescript-eslint/no-unsafe-member-access": "off", + "@typescript-eslint/no-unsafe-return": "off", + "@typescript-eslint/prefer-nullish-coalescing": "off", // Usually a good idea, but sometimes dangerous false-positive + "@typescript-eslint/unbound-method": "off", "@angular-eslint/directive-selector": [ "error", { @@ -30,21 +51,28 @@ "style": "kebab-case" } ], - "@typescript-eslint/ban-types": "error", "@typescript-eslint/explicit-function-return-type": [ "error", { "allowExpressions": true } ], - "@typescript-eslint/explicit-member-accessibility": "error", "@typescript-eslint/explicit-module-boundary-types": [ "error", { "allowArgumentsExplicitlyTypedAsAny": true } ], - "@typescript-eslint/prefer-for-of": "error", + "@typescript-eslint/no-misused-promises": [ + "error", + { + "checksVoidReturn": { + // We want to use promise in Rxjs subscribes without caring about the promise result + "arguments": false, + "properties": false + } + } + ], "no-restricted-globals": [ "error", "atob", @@ -64,8 +92,27 @@ }, { "files": ["*.html"], - "extends": ["plugin:@angular-eslint/template/recommended"], - "rules": {} + "extends": ["plugin:@angular-eslint/template/all"], + "rules": { + "@angular-eslint/template/alt-text": "off", // We don't care as much as we should about a11y + "@angular-eslint/template/attributes-order": "off", // TODO: We want to enable this, but autofix mess up our code, and it's too much manual changes + "@angular-eslint/template/button-has-type": "off", + "@angular-eslint/template/click-events-have-key-events": "off", // We don't care as much as we should about a11y + "@angular-eslint/template/i18n": "off", + "@angular-eslint/template/interactive-supports-focus": "off", // We don't care as much as we should about a11y + "@angular-eslint/template/label-has-associated-control": "off", // We don't care as much as we should about a11y + "@angular-eslint/template/no-any": "off", // Unfortunately, some libs force us to use this + "@angular-eslint/template/no-autofocus": "off", + "@angular-eslint/template/no-call-expression": "off", + "@angular-eslint/template/no-inline-styles": "off", // We sometimes use short inlie styles + "@angular-eslint/template/prefer-ngsrc": "off", // TODO: experiment with ngsrc and see if we need to use it or not + "@angular-eslint/template/eqeqeq": [ + "error", + { + "allowNullOrUndefined": true + } + ] + } } ] } diff --git a/projects/fab-speed-dial/src/lib/fab-speed-dial.ts b/projects/fab-speed-dial/src/lib/fab-speed-dial.ts index 45faff6..d602970 100644 --- a/projects/fab-speed-dial/src/lib/fab-speed-dial.ts +++ b/projects/fab-speed-dial/src/lib/fab-speed-dial.ts @@ -34,7 +34,7 @@ function getHostElement(button: MatMiniFabButton): any { @Component({ selector: 'eco-fab-speed-dial-actions', template: `@if (miniFabVisible) { - + }`, standalone: true, }) @@ -82,10 +82,6 @@ export class EcoFabSpeedDialActionsComponent implements AfterContentInit { } public show(): void { - if (!this._buttons) { - return; - } - this.resetAnimationState(); this.miniFabVisible = true; @@ -118,10 +114,6 @@ export class EcoFabSpeedDialActionsComponent implements AfterContentInit { } public hide(): void { - if (!this._buttons) { - return; - } - this.resetAnimationState(); const obs = this._buttons.map((button, i) => { @@ -170,11 +162,12 @@ export class EcoFabSpeedDialActionsComponent implements AfterContentInit { selector: 'eco-fab-speed-dial', template: `
- - + +
`, - styleUrls: ['fab-speed-dial.scss'], + styleUrls: ['./fab-speed-dial.scss'], + // eslint-disable-next-line @angular-eslint/use-component-view-encapsulation encapsulation: ViewEncapsulation.None, standalone: true, }) @@ -298,10 +291,6 @@ export class EcoFabSpeedDialComponent implements OnDestroy, AfterContentInit { } public setActionsVisibility(): void { - if (!this._childActions) { - return; - } - if (this.open) { this._childActions.show(); } else { @@ -345,7 +334,7 @@ export class EcoFabSpeedDialComponent implements OnDestroy, AfterContentInit { @Component({ selector: 'eco-fab-speed-dial-trigger', - template: ` `, + template: ` `, standalone: true, }) export class EcoFabSpeedDialTriggerComponent { diff --git a/src/app/app.component.html b/src/app/app.component.html index 182d733..c4d97c5 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -50,19 +50,19 @@ @@ -85,19 +85,19 @@ > diff --git a/src/index.html b/src/index.html index 3736e9f..c90427a 100644 --- a/src/index.html +++ b/src/index.html @@ -10,6 +10,6 @@ - +