diff --git a/.eslintrc.json b/.eslintrc.json index 9308c785f3..6521fcec95 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -9,12 +9,16 @@ "createDefaultProgram": true }, "extends": [ - "plugin:@angular-eslint/ng-cli-compat", - "plugin:@angular-eslint/ng-cli-compat--formatting-add-on", + "plugin:@typescript-eslint/recommended", + "plugin:@angular-eslint/recommended", "plugin:@angular-eslint/template/process-inline-templates" ], "plugins": ["sonarjs", "eslint-plugin-react"], "rules": { + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-this-alias": "off", + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/no-array-constructor": "off", "@angular-eslint/component-selector": [ "error", { @@ -126,6 +130,11 @@ "format": ["camelCase", "UPPER_CASE", "snake_case", "PascalCase"], "leadingUnderscore": "allow" }, + { + "selector": "import", + "format": ["camelCase", "PascalCase"], + "leadingUnderscore": "allow" + }, { "selector": "classProperty", "format": ["camelCase", "UPPER_CASE", "snake_case", "PascalCase"], diff --git a/projects/templates/src/lib/components/po-page-login/po-page-login-popover/po-page-login-popover.component.spec.ts b/projects/templates/src/lib/components/po-page-login/po-page-login-popover/po-page-login-popover.component.spec.ts index 4ebe1e7a25..5397900286 100644 --- a/projects/templates/src/lib/components/po-page-login/po-page-login-popover/po-page-login-popover.component.spec.ts +++ b/projects/templates/src/lib/components/po-page-login/po-page-login-popover/po-page-login-popover.component.spec.ts @@ -3,7 +3,6 @@ import { RouterTestingModule } from '@angular/router/testing'; import { PoPageLoginPopoverComponent } from './po-page-login-popover.component'; -import * as UtilFunctions from './../../../utils/util'; import { PoI18nPipe } from './../../../../../../ui/src/lib/services/po-i18n/po-i18n.pipe'; describe('ThPageLoginPopoverComponent: ', () => { diff --git a/projects/ui/.eslintrc.json b/projects/ui/.eslintrc.json index d34a1a4bbc..7c00cd565b 100644 --- a/projects/ui/.eslintrc.json +++ b/projects/ui/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": "../../.eslintrc.json", - "ignorePatterns": ["!**/*"], + "ignorePatterns": ["!**/*", "**/util-expect.spec.ts"], "overrides": [ { "files": ["*.ts"], @@ -9,6 +9,14 @@ "createDefaultProgram": true }, "plugins": ["sonarjs", "eslint-plugin-react"], + "excludedFiles": [ + "test.ts", + "**/*.spec.ts", + "**/*.e2e-spec.ts", + "**/*.po.ts", + "./node_modules/", + "./projects/ui/src/lib/util-test/util-expect.spec.ts" + ], "rules": { "@angular-eslint/component-selector": [ "error", @@ -19,6 +27,8 @@ } ], "@angular-eslint/directive-class-suffix": "off", + "@angular-eslint/no-host-metadata-property": "off", + "prefer-spread": "off", "@angular-eslint/directive-selector": [ "error", { diff --git a/projects/ui/src/lib/components/po-container/samples/sample-po-container-dashboard/sample-po-container-dashboard.component.ts b/projects/ui/src/lib/components/po-container/samples/sample-po-container-dashboard/sample-po-container-dashboard.component.ts index a9915383c8..aecb810f06 100644 --- a/projects/ui/src/lib/components/po-container/samples/sample-po-container-dashboard/sample-po-container-dashboard.component.ts +++ b/projects/ui/src/lib/components/po-container/samples/sample-po-container-dashboard/sample-po-container-dashboard.component.ts @@ -26,7 +26,7 @@ import { ], providers: [SampleDashboardService] }) -export class SamplePoContainerDashboardComponent implements AfterContentChecked { +export class SamplePoContainerDashboardComponent implements AfterContentChecked, OnInit { @ViewChild('formShare', { static: true }) formShare: NgForm; @ViewChild(PoModalComponent) poModal: PoModalComponent; diff --git a/projects/ui/src/lib/components/po-gauge/po-gauge-svg/po-gauge-path/po-gauge-path.component.ts b/projects/ui/src/lib/components/po-gauge/po-gauge-svg/po-gauge-path/po-gauge-path.component.ts index dedd4067a4..47b91fe841 100644 --- a/projects/ui/src/lib/components/po-gauge/po-gauge-svg/po-gauge-path/po-gauge-path.component.ts +++ b/projects/ui/src/lib/components/po-gauge/po-gauge-svg/po-gauge-path/po-gauge-path.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { Component, Input } from '@angular/core'; import { PoGaugeCoordinates } from '../../interfaces/po-gauge-coordinates.interface'; @@ -6,15 +6,13 @@ import { PoGaugeCoordinates } from '../../interfaces/po-gauge-coordinates.interf selector: '[po-gauge-path]', templateUrl: './po-gauge-path.component.svg' }) -export class PoGaugePathComponent implements OnInit { +export class PoGaugePathComponent { @Input('p-base-coordinates') baseCoordinates: PoGaugeCoordinates; @Input('p-ranges-coordinates') rangesCoordinates: Array; constructor() {} - ngOnInit(): void {} - trackBy(index) { return index; } diff --git a/projects/ui/src/lib/components/po-menu/samples/sample-po-menu-labs/sample-po-menu-labs.component.ts b/projects/ui/src/lib/components/po-menu/samples/sample-po-menu-labs/sample-po-menu-labs.component.ts index d4df6abd3e..8a24b72607 100644 --- a/projects/ui/src/lib/components/po-menu/samples/sample-po-menu-labs/sample-po-menu-labs.component.ts +++ b/projects/ui/src/lib/components/po-menu/samples/sample-po-menu-labs/sample-po-menu-labs.component.ts @@ -41,7 +41,7 @@ export class SamplePoMenuLabsComponent implements OnInit { label: string; link: string; logo: string; - maxBadgeValue = 99999999999999999999; + maxBadgeValue = 999999999999999; menuItems: Array; menuItemSelected: string; menuParams: string; diff --git a/projects/ui/src/lib/components/po-progress/po-progress.component.ts b/projects/ui/src/lib/components/po-progress/po-progress.component.ts index fc0caad92a..e7cc965e71 100644 --- a/projects/ui/src/lib/components/po-progress/po-progress.component.ts +++ b/projects/ui/src/lib/components/po-progress/po-progress.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; +import { ChangeDetectionStrategy, Component, OnInit, inject } from '@angular/core'; import { PoProgressBaseComponent } from './po-progress-base.component'; import { PoProgressStatus } from './enums/po-progress-status.enum'; @@ -29,7 +29,7 @@ import { poProgressLiterals } from './literals/po-progress.literals'; templateUrl: './po-progress.component.html', changeDetection: ChangeDetectionStrategy.OnPush }) -export class PoProgressComponent extends PoProgressBaseComponent { +export class PoProgressComponent extends PoProgressBaseComponent implements OnInit { language; literals; diff --git a/projects/ui/src/lib/decorators/input-required/input-required.decorator.spec.ts b/projects/ui/src/lib/decorators/input-required/input-required.decorator.spec.ts index c89af950ab..cb0e5d8074 100644 --- a/projects/ui/src/lib/decorators/input-required/input-required.decorator.spec.ts +++ b/projects/ui/src/lib/decorators/input-required/input-required.decorator.spec.ts @@ -10,7 +10,9 @@ import { InputRequired } from './input-required.decorator'; }) class PoMockComponent implements OnInit { @InputRequired() myProperty: any; - ngOnInit() {} + ngOnInit() { + let a; + } } describe('InputRequired:', () => { diff --git a/projects/ui/src/lib/utils/util.spec.ts b/projects/ui/src/lib/utils/util.spec.ts index 3effcd2e9d..82888e43c2 100644 --- a/projects/ui/src/lib/utils/util.spec.ts +++ b/projects/ui/src/lib/utils/util.spec.ts @@ -1407,8 +1407,8 @@ describe('Function convertNumberToDecimals:', () => { it('should convert number to float', () => { expect(convertNumberToDecimal(12.567, 2)).toBe(12.57); expect(convertNumberToDecimal(12.56, 2)).toBe(12.56); - expect(convertNumberToDecimal(12.5649584958748574897, 2)).toBe(12.56); - expect(convertNumberToDecimal(12.5649584958748574897, 4)).toBe(12.565); + expect(convertNumberToDecimal(12.564958495874857, 2)).toBe(12.56); + expect(convertNumberToDecimal(12.564958495874857, 4)).toBe(12.565); expect(convertNumberToDecimal(12.56, 1)).toBe(12.6); expect(convertNumberToDecimal('12.56', 1)).toBe(12.6); expect(convertNumberToDecimal('12', 1)).toBe(12);