Skip to content

Commit

Permalink
Merge pull request #1141 from authts/fix-eslint-warnings
Browse files Browse the repository at this point in the history
fix: make code compatible for eslint-plugin v6.4
  • Loading branch information
pamapa authored Aug 24, 2023
2 parents 89021b0 + 76d1fba commit fe4d511
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 13 deletions.
6 changes: 3 additions & 3 deletions docs/oidc-client-ts.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ export interface OidcClientSettings {
stateStore?: StateStore;
ui_locales?: string;
// @deprecated (undocumented)
userInfoJwtIssuer?: "ANY" | "OP" | string;
userInfoJwtIssuer?: string;
}

// @public
Expand Down Expand Up @@ -415,7 +415,7 @@ export class OidcClientSettingsStore {
// (undocumented)
readonly ui_locales: string | undefined;
// (undocumented)
readonly userInfoJwtIssuer: "ANY" | "OP" | string;
readonly userInfoJwtIssuer: string;
}

// @public (undocumented)
Expand Down Expand Up @@ -777,7 +777,7 @@ export class State {
static clearStaleState(storage: StateStore, age: number): Promise<void>;
// (undocumented)
readonly created: number;
readonly data: unknown | undefined;
readonly data?: unknown;
// (undocumented)
static fromStorageString(storageString: string): State;
// (undocumented)
Expand Down
4 changes: 2 additions & 2 deletions src/OidcClientSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export interface OidcClientSettings {
/** @deprecated Unused */
clockSkewInSeconds?: number;
/** @deprecated Unused */
userInfoJwtIssuer?: "ANY" | "OP" | string;
userInfoJwtIssuer?: /*"ANY" | "OP" |*/ string;

/**
* Indicates if objects returned from the user info endpoint as claims (e.g. `address`) are merged into the claims from the id token as a single object.
Expand Down Expand Up @@ -179,7 +179,7 @@ export class OidcClientSettingsStore {
public readonly loadUserInfo: boolean;
public readonly staleStateAgeInSeconds: number;
public readonly clockSkewInSeconds: number;
public readonly userInfoJwtIssuer: "ANY" | "OP" | string;
public readonly userInfoJwtIssuer: /*"ANY" | "OP" |*/ string;
public readonly mergeClaims: boolean;

public readonly stateStore: StateStore;
Expand Down
2 changes: 1 addition & 1 deletion src/RefreshState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { UserProfile } from "./User";
*/
export class RefreshState {
/** custom "state", which can be used by a caller to have "data" round tripped */
public readonly data: unknown | undefined;
public readonly data?: unknown;

public readonly refresh_token: string;
public readonly id_token?: string;
Expand Down
2 changes: 1 addition & 1 deletion src/State.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class State {
public readonly request_type: string | undefined;

/** custom "state", which can be used by a caller to have "data" round tripped */
public readonly data: unknown | undefined;
public readonly data?: unknown;

public constructor(args: {
id?: string;
Expand Down
2 changes: 1 addition & 1 deletion src/UserManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ describe("UserManager", () => {
it("should redirect the browser to the authorize url", async () => {
// act
const spy = jest.fn();
subject.signinRedirect().finally(spy);
void subject.signinRedirect().finally(spy);

// signinRedirect is a promise that will never resolve (since we
// want it to hold until the page has redirected), so we wait for
Expand Down
4 changes: 2 additions & 2 deletions src/navigators/IFrameWindow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe("IFrameWindow", () => {
const frameWindow = new IFrameWindow({});
const promise = frameWindow.navigate({ state: fakeState, url: fakeUrl, scriptOrigin: args.passedOrigin });

promise.finally(() => promiseDone = true);
void promise.finally(() => promiseDone = true);
await flushPromises();

expect(promiseDone).toBe(false);
Expand All @@ -154,7 +154,7 @@ describe("IFrameWindow", () => {
const frameWindow = new IFrameWindow({});
const promise = frameWindow.navigate({ state: "diff_state", url: fakeUrl });

promise.finally(() => promiseDone = true);
void promise.finally(() => promiseDone = true);
await flushPromises();

expect(promiseDone).toBe(false);
Expand Down
6 changes: 3 additions & 3 deletions src/navigators/RedirectNavigator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("RedirectNavigator", () => {
it("should redirect to the authority server using a specific redirect method", async () => {
const handle = await navigator.prepare({ redirectMethod: "replace" });
const spy = jest.fn();
handle.navigate({ url: "http://sts/authorize" }).finally(spy);
void handle.navigate({ url: "http://sts/authorize" }).finally(spy);

expect(window.location.replace).toHaveBeenCalledWith("http://sts/authorize");

Expand All @@ -32,7 +32,7 @@ describe("RedirectNavigator", () => {
});

it("should redirect to the authority server from window top", async () => {

Object.defineProperty(window, "top", {
value: {
location: {
Expand All @@ -43,7 +43,7 @@ describe("RedirectNavigator", () => {

const handle = await navigator.prepare({ redirectTarget: "top" });
const spy = jest.fn();
handle.navigate({ url: "http://sts/authorize" }).finally(spy);
void handle.navigate({ url: "http://sts/authorize" }).finally(spy);

expect(window.location.assign).toHaveBeenCalledTimes(0);
expect(window.parent.location.assign).toHaveBeenCalledTimes(0);
Expand Down
4 changes: 4 additions & 0 deletions src/utils/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export class Logger {
private _method?: string;
public constructor(private _name: string) {}

/* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */
public debug(...args: unknown[]): void {
if (level >= Log.DEBUG) {
logger.debug(Logger._format(this._name, this._method), ...args);
Expand All @@ -88,6 +89,7 @@ export class Logger {
logger.error(Logger._format(this._name, this._method), ...args);
}
}
/* eslint-enable @typescript-eslint/no-unsafe-enum-comparison */

public throw(err: Error): never {
this.error(err);
Expand All @@ -112,6 +114,7 @@ export class Logger {
return method ? `${prefix} ${method}:` : prefix;
}

/* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */
// helpers for static class methods
public static debug(name: string, ...args: unknown[]): void {
if (level >= Log.DEBUG) {
Expand All @@ -133,6 +136,7 @@ export class Logger {
logger.error(Logger._format(name), ...args);
}
}
/* eslint-enable @typescript-eslint/no-unsafe-enum-comparison */
}

Log.reset();

0 comments on commit fe4d511

Please sign in to comment.