Skip to content

Commit

Permalink
fix(demo-app-web): fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Badisi committed Feb 22, 2024
1 parent 0fc76e0 commit acb0e3e
Show file tree
Hide file tree
Showing 14 changed files with 198 additions and 49 deletions.
157 changes: 151 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@nrwl/web": "15.8.6",
"@nrwl/webpack": "15.8.6",
"@nrwl/workspace": "15.8.6",
"@types/jest": "^29.5.12",
"@types/jest": "28.1.3",
"@types/node": "^20.11.19",
"cpy-cli": "^5.0.0",
"esbuild": "^0.20.0",
Expand Down
2 changes: 2 additions & 0 deletions projects/demo-app/web/auth-js/src/app/app.element.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it } from '@jest/globals';

import { AppElement } from './app.element';

describe('AppElement', () => {
Expand Down
6 changes: 3 additions & 3 deletions projects/demo-app/web/auth-js/src/app/app.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ export class AppElement extends HTMLElement {
}

public connectedCallback(): void {
this.demoAppMainEl = this.shadowRoot?.querySelector('demo-app-main') as DemoAppMainElement;
this.demoAppPlaygroundEl = this.shadowRoot?.querySelector('demo-app-playground') as DemoAppPlaygroundElement;
this.demoAppDebugEl = this.shadowRoot?.querySelector('demo-app-debug') as DemoAppDebugElement;
this.demoAppMainEl = this.shadowRoot!.querySelector<DemoAppMainElement>('demo-app-main')!;
this.demoAppPlaygroundEl = this.shadowRoot!.querySelector<DemoAppPlaygroundElement>('demo-app-playground')!;
this.demoAppDebugEl = this.shadowRoot!.querySelector<DemoAppDebugElement>('demo-app-debug')!;

this.listenForHeaderEvents();
this.listenForPlaygroundEvents();
Expand Down
2 changes: 1 addition & 1 deletion projects/demo-app/web/auth-js/src/app/app.settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import pkgJson from 'projects/auth-js/package.json';

import { environment } from '../environments/environment';

export const appSettings: DemoAppSettings<OIDCAuthSettings> = new DemoAppSettings(
export const appSettings = new DemoAppSettings<OIDCAuthSettings>(
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
`auth-js:${(pkgJson as any).version as string}:demo-app:settings`, {
showTip: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ export class DemoAppDebugElement extends HTMLElement {
}
}

public set userSession(value: unknown | undefined) {
public set userSession(value: unknown) {
this.update('#userSession', prettyPrint(value, ['expires_at']));
}

public set accessToken(value: string | undefined) {
this.update('#accessToken', value);
}

public set accessTokenDecoded(value: unknown | undefined) {
public set accessTokenDecoded(value: unknown) {
const text = (typeof value !== 'string') ?
prettyPrint(value, ['exp', 'iat', 'auth_time']) : '(no decoded info as it is not a JWT token)';
this.update('#accessTokenDecoded', text);
Expand All @@ -112,11 +112,11 @@ export class DemoAppDebugElement extends HTMLElement {
this.update('#idToken', value);
}

public set idTokenDecoded(value: unknown | undefined) {
public set idTokenDecoded(value: unknown) {
this.update('#idTokenDecoded', prettyPrint(value, ['exp', 'iat', 'auth_time']));
}

public set userProfile(value: unknown | undefined) {
public set userProfile(value: unknown) {
this.update('#userProfile', prettyPrint(value));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,12 @@ export class DemoAppHeaderElement extends HTMLElement {
this.attachShadow({ mode: 'open' });
this.shadowRoot?.appendChild(document.importNode(template.content, true));

this.implSelectEl = this.shadowRoot?.querySelector('#implementation-select') as HTMLSelectElement;
this.statusEl = this.shadowRoot?.querySelector('.status') as HTMLElement;
this.versionEl = this.shadowRoot?.querySelector('.version') as HTMLElement;
this.loginButtonEl = this.shadowRoot?.querySelector('#login-button') as HTMLElement;
this.logoutButtonEl = this.shadowRoot?.querySelector('#logout-button') as HTMLElement;
this.silentRenewButtonEl = this.shadowRoot?.querySelector('#silent-renew-button') as HTMLElement;
this.implSelectEl = this.shadowRoot!.querySelector<HTMLSelectElement>('#implementation-select')!;
this.statusEl = this.shadowRoot!.querySelector<HTMLElement>('.status')!;
this.versionEl = this.shadowRoot!.querySelector<HTMLElement>('.version')!;
this.loginButtonEl = this.shadowRoot!.querySelector<HTMLElement>('#login-button')!;
this.logoutButtonEl = this.shadowRoot!.querySelector<HTMLElement>('#logout-button')!;
this.silentRenewButtonEl = this.shadowRoot!.querySelector<HTMLElement>('#silent-renew-button')!;
}

public set isRenewing(value: boolean) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ export class DemoAppMainElement extends HTMLElement {
this.attachShadow({ mode: 'open' });
this.shadowRoot?.appendChild(document.importNode(template.content, true));

this.tabsContentEl = this.shadowRoot?.querySelector('.tabs-content') as HTMLElement;
this.demoAppHeaderEl = this.shadowRoot?.querySelector('demo-app-header') as DemoAppHeaderElement;
this.tabsContentEl = this.shadowRoot!.querySelector<HTMLElement>('.tabs-content')!;
this.demoAppHeaderEl = this.shadowRoot!.querySelector<DemoAppHeaderElement>('demo-app-header')!;
}

public set isRenewing(value: boolean) {
Expand All @@ -103,8 +103,8 @@ export class DemoAppMainElement extends HTMLElement {
// --- HELPER(s) ---

private drawTabs(): void {
const viewsEl = this.shadowRoot?.querySelector('#views') as HTMLSlotElement;
const tabsEl = this.shadowRoot?.querySelector('#tabs') as HTMLElement;
const viewsEl = this.shadowRoot!.querySelector<HTMLSlotElement>('#views')!;
const tabsEl = this.shadowRoot!.querySelector('#tabs')!;
if (viewsEl && tabsEl) {
this.views = viewsEl.assignedElements() as HTMLElement[];
this.views.forEach((view, index) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ export class DemoAppPlaygroundElement extends HTMLElement {
this.attachShadow({ mode: 'open' });
this.shadowRoot?.appendChild(document.importNode(template.content, true));

this.apiStatusEl = this.shadowRoot?.querySelector('#api-status') as HTMLElement;
this.apiResponseEl = this.shadowRoot?.querySelector('#api-response') as HTMLElement;
this.apiUrlEl = this.shadowRoot?.querySelector('#api-url-input') as HTMLInputElement;
this.apiHeadersEl = this.shadowRoot?.querySelector('#api-headers-input') as HTMLInputElement;
this.apiStatusEl = this.shadowRoot!.querySelector<HTMLElement>('#api-status')!;
this.apiResponseEl = this.shadowRoot!.querySelector<HTMLElement>('#api-response')!;
this.apiUrlEl = this.shadowRoot!.querySelector<HTMLInputElement>('#api-url-input')!;
this.apiHeadersEl = this.shadowRoot!.querySelector<HTMLInputElement>('#api-headers-input')!;
}

public connectedCallback(): void {
Expand Down Expand Up @@ -113,7 +113,7 @@ export class DemoAppPlaygroundElement extends HTMLElement {

// --- API(s) ---

public setApiStatus(data: unknown | Error, isError: boolean): void {
public setApiStatus(data: unknown, isError: boolean): void {
this.apiStatusEl.classList.remove(isError ? 'success' : 'error');
this.apiStatusEl.classList.add(isError ? 'error' : 'success');
this.apiResponseEl.innerHTML = prettyPrint(data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ export class DemoAppSettingsElement extends HTMLElement {
}

public connectedCallback(): void {
this.formEl = this.shadowRoot?.querySelector('form') as HTMLFormElement;
this.formContentEl = this.shadowRoot?.querySelector('.form-content') as HTMLElement;
this.selectEl = this.shadowRoot?.querySelector('#settings-select') as HTMLSelectElement;
this.settingsNameEl = this.shadowRoot?.querySelector('#settingsName') as HTMLInputElement;
this.formEl = this.shadowRoot!.querySelector<HTMLFormElement>('form')!;
this.formContentEl = this.shadowRoot!.querySelector<HTMLElement>('.form-content')!;
this.selectEl = this.shadowRoot!.querySelector<HTMLSelectElement>('#settings-select')!;
this.settingsNameEl = this.shadowRoot!.querySelector<HTMLInputElement>('#settingsName')!;

// Form events
const inputCb = (e: Event): void => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { describe, expect, it } from '@jest/globals';

import { AppComponent } from './app.component';

Expand Down
2 changes: 1 addition & 1 deletion projects/demo-app/web/ngx-auth/src/app/app.settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import pkgJson from 'projects/ngx-auth/package.json';

import { environment } from '../environments/environment';

export const appSettings: DemoAppSettings<AuthSettings> = new DemoAppSettings(
export const appSettings = new DemoAppSettings<AuthSettings>(
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
`ngx-auth:${(pkgJson as any).version as string}:demo-app:settings`, {
showTip: true,
Expand Down
8 changes: 4 additions & 4 deletions projects/demo-app/web/ngx-auth/tsconfig.editor.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"extends": "./tsconfig.json",
"include": [
"**/*.ts"
],
"compilerOptions": {
"types": [
"jest",
"node"
]
}
},
"include": [
"**/*.ts"
]
}
Loading

0 comments on commit acb0e3e

Please sign in to comment.