diff --git a/packages/igx-templates/igx-ts/custom-templates/fintech-grid/files/src/app/__path__/__filePrefix__.ts b/packages/igx-templates/igx-ts/custom-templates/fintech-grid/files/src/app/__path__/__filePrefix__.ts index a65c2b9ec..0534e377b 100644 --- a/packages/igx-templates/igx-ts/custom-templates/fintech-grid/files/src/app/__path__/__filePrefix__.ts +++ b/packages/igx-templates/igx-ts/custom-templates/fintech-grid/files/src/app/__path__/__filePrefix__.ts @@ -498,13 +498,12 @@ export class <%=ClassName%> implements OnInit, AfterViewInit, OnDestroy { let rnd = Math.random(); rnd = Math.round(rnd * 100) / 100; const volatility = 2; - let newPrice = 0; let changePercent = 2 * volatility * rnd; if (changePercent > volatility) { changePercent -= (2 * volatility); } const changeAmount = oldPrice * (changePercent / 100); - newPrice = oldPrice + changeAmount; + let newPrice = oldPrice + changeAmount; newPrice = Math.round(newPrice * 100) / 100; const result = { Price: 0, ChangePercent: 0 }; changePercent = Math.round(changePercent * 100) / 100; diff --git a/packages/igx-templates/igx-ts/custom-templates/fintech-grid/files/src/app/__path__/data/financialData.ts b/packages/igx-templates/igx-ts/custom-templates/fintech-grid/files/src/app/__path__/data/financialData.ts index 253454a39..a8c626949 100644 --- a/packages/igx-templates/igx-ts/custom-templates/fintech-grid/files/src/app/__path__/data/financialData.ts +++ b/packages/igx-templates/igx-ts/custom-templates/fintech-grid/files/src/app/__path__/data/financialData.ts @@ -953,15 +953,13 @@ export class FinancialData { private generateNewPrice(oldPrice: number): any { const rnd = parseFloat(Math.random().toFixed(2)); const volatility = 2; - let newPrice = 0; - let changePercent = 2 * volatility * rnd; if (changePercent > volatility) { changePercent -= (2 * volatility); } const changeAmount = oldPrice * (changePercent / 100); - newPrice = oldPrice + changeAmount; + const newPrice = oldPrice + changeAmount; const result = {Price: 0, ChangePercent: 0}; result.Price = parseFloat(newPrice.toFixed(2)); diff --git a/packages/igx-templates/igx-ts/custom-templates/fintech-tree-grid/files/src/app/__path__/__filePrefix__.ts b/packages/igx-templates/igx-ts/custom-templates/fintech-tree-grid/files/src/app/__path__/__filePrefix__.ts index 4fef2b3c6..4046a449c 100644 --- a/packages/igx-templates/igx-ts/custom-templates/fintech-tree-grid/files/src/app/__path__/__filePrefix__.ts +++ b/packages/igx-templates/igx-ts/custom-templates/fintech-tree-grid/files/src/app/__path__/__filePrefix__.ts @@ -328,13 +328,12 @@ export class <%=ClassName%> implements OnInit, AfterViewInit, OnDestroy { let rnd = Math.random(); rnd = Math.round(rnd * 100) / 100; const volatility = 2; - let newPrice = 0; let changePercent = 2 * volatility * rnd; if (changePercent > volatility) { changePercent -= (2 * volatility); } const changeAmount = oldPrice * (changePercent / 100); - newPrice = oldPrice + changeAmount; + let newPrice = oldPrice + changeAmount; newPrice = Math.round(newPrice * 100) / 100; const result = {Price: 0, ChangePercent: 0}; changePercent = Math.round(changePercent * 100) / 100; diff --git a/packages/igx-templates/igx-ts/custom-templates/fintech-tree-grid/files/src/app/__path__/assets/financialData.ts b/packages/igx-templates/igx-ts/custom-templates/fintech-tree-grid/files/src/app/__path__/assets/financialData.ts index 253454a39..a8c626949 100644 --- a/packages/igx-templates/igx-ts/custom-templates/fintech-tree-grid/files/src/app/__path__/assets/financialData.ts +++ b/packages/igx-templates/igx-ts/custom-templates/fintech-tree-grid/files/src/app/__path__/assets/financialData.ts @@ -953,15 +953,13 @@ export class FinancialData { private generateNewPrice(oldPrice: number): any { const rnd = parseFloat(Math.random().toFixed(2)); const volatility = 2; - let newPrice = 0; - let changePercent = 2 * volatility * rnd; if (changePercent > volatility) { changePercent -= (2 * volatility); } const changeAmount = oldPrice * (changePercent / 100); - newPrice = oldPrice + changeAmount; + const newPrice = oldPrice + changeAmount; const result = {Price: 0, ChangePercent: 0}; result.Price = parseFloat(newPrice.toFixed(2)); diff --git a/packages/igx-templates/igx-ts/generate/files/src/app/__path__/__filePrefix__.ts b/packages/igx-templates/igx-ts/generate/files/src/app/__path__/__filePrefix__.ts index 5b7b5607c..5e09fa172 100644 --- a/packages/igx-templates/igx-ts/generate/files/src/app/__path__/__filePrefix__.ts +++ b/packages/igx-templates/igx-ts/generate/files/src/app/__path__/__filePrefix__.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core'; @Component({ - selector: "<%=filePrefix%>", + selector: "app-<%=filePrefix%>", templateUrl: './<%=filePrefix%>.html', styleUrl: './<%=filePrefix%>.scss' }) diff --git a/packages/igx-templates/igx-ts/projects/_base/files/eslint.config.js b/packages/igx-templates/igx-ts/projects/_base/files/eslint.config.js index 6e56cfeb7..14f4941af 100644 --- a/packages/igx-templates/igx-ts/projects/_base/files/eslint.config.js +++ b/packages/igx-templates/igx-ts/projects/_base/files/eslint.config.js @@ -33,7 +33,15 @@ module.exports = defineConfig([ ], // Relax rules '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-empty-function': 'off', '@angular-eslint/prefer-inject': 'off', + '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], + }, + }, + { + files: ['**/*.spec.ts'], + rules: { + '@typescript-eslint/class-literal-property-style': 'off', }, }, { diff --git a/packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/providers/facebook-provider.ts b/packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/providers/facebook-provider.ts index 51acf6d84..c6f781261 100644 --- a/packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/providers/facebook-provider.ts +++ b/packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/providers/facebook-provider.ts @@ -51,6 +51,6 @@ export class FacebookProvider implements AuthProvider { } public logout() { - FB.logout((response) => { }); + FB.logout(); } } diff --git a/packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/services/external-auth.ts b/packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/services/external-auth.ts index 42548888e..6b18fe25e 100644 --- a/packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/services/external-auth.ts +++ b/packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/services/external-auth.ts @@ -25,7 +25,7 @@ export class ExternalAuth { private location = inject(Location); private localStorage = inject(LocalStorageService); - protected providers: Map = new Map(); + protected providers = new Map(); public get activeProvider(): ExternalAuthProvider { return this.localStorage.getItem('extActiveProvider') as ExternalAuthProvider; } diff --git a/packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/services/jwt-util.ts b/packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/services/jwt-util.ts index 095432f46..734dd2751 100644 --- a/packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/services/jwt-util.ts +++ b/packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/services/jwt-util.ts @@ -36,11 +36,12 @@ export function decodeBase64Url(base64Url: string) { return decodeURIComponent(decoded.split('') .map(c => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)) .join('')); - } catch (er) { + } catch { return decoded; } } +// eslint-disable-next-line @typescript-eslint/no-empty-object-type export function encodeBase64Url(input: {}) { const encodedToURI: string = encodeURI(JSON.stringify(input)); let result = ''; diff --git a/packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/services/local-storage.ts b/packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/services/local-storage.ts index 1859405c8..c0dbbfe51 100644 --- a/packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/services/local-storage.ts +++ b/packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/services/local-storage.ts @@ -5,10 +5,10 @@ class LocalStorageFallback implements Storage { [name: string]: any; readonly length = 0; clear(): void { } - getItem(key: string): string | null { return null; } - key(index: number): string | null { return null; } - removeItem(key: string): void { } - setItem(key: string, value: string): void { } + getItem(_key: string): string | null { return null; } + key(_index: number): string | null { return null; } + removeItem(_key: string): void { } + setItem(_key: string, _value: string): void { } } @Injectable({ diff --git a/packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/services/services.spec.ts b/packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/services/services.spec.ts index 10e5e4539..cf353437b 100644 --- a/packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/services/services.spec.ts +++ b/packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/services/services.spec.ts @@ -526,7 +526,11 @@ describe('Services', () => { describe(`User Service`, () => { let userServ: UserStore; let localStorage: LocalStorageService; - let mockLocalStorage: any; + const mockLocalStorage = { + getItem: vi.fn(), + setItem: vi.fn(), + removeItem: vi.fn() + }; const mockUser = { exp: 111, name: 'Testy Testington', @@ -538,12 +542,6 @@ describe('Services', () => { externalToken: `mock token` }; - mockLocalStorage = { - getItem: vi.fn(), - setItem: vi.fn(), - removeItem: vi.fn() - }; - beforeEach(() => { vi.spyOn(JSON, 'parse').mockReturnValue(mockUser); vi.spyOn(mockLocalStorage, 'getItem').mockReturnValue('MOCK JSON');