Skip to content

Commit

Permalink
refactor(lint): Fix minor lint issues
Browse files Browse the repository at this point in the history
- Imports, unused variables,
- deprecated use of substr replaced with slice.
- remove await on non awaitable code.
  • Loading branch information
jafin authored and guillaume-chervet committed Jul 17, 2024
1 parent bb7bc92 commit 8797330
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/react-oidc-demo/src/MultiAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const fetchWithLogs = (fetch: Fetch) => async (...params: Parameters<Fetch>) =>
return await fetch(url, options, ...rest);
};

const MultiAuth = ({ configurationName, handleConfigurationChange }) => {;
const MultiAuth = ({ configurationName, handleConfigurationChange }) => {
const { login, logout, isAuthenticated } = useOidc(configurationName);
const { isAuthenticated: isAuthenticatedDefault } = useOidc('default');
const [fname, setFname] = useState('');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import {
getDomains,
hideTokens,
isTokensValid,
normalizeUrl,
serializeHeaders,
sleep,
} from './utils';
import {extractConfigurationNameFromCodeVerifier, replaceCodeVerifier} from './utils/codeVerifier';
import { normalizeUrl } from './utils/normalizeUrl';
import version from './version';

// @ts-ignore
Expand Down
3 changes: 1 addition & 2 deletions packages/oidc-client/src/checkSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ export const startCheckSessionAsync = (oidc:Oidc, oidcDatabase:any, configuratio

}).catch(async (e) => {
console.warn('SessionMonitor._callback: Silent login failed, logging out other tabs:', e);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
for (const [key, oidc] of Object.entries(oidcDatabase)) {
for (const [, oidc] of Object.entries(oidcDatabase)) {
// @ts-ignore
await oidc.logoutOtherTabAsync(configuration.client_id, idTokenPayload.sub);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/oidc-client/src/checkSessionIFrame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class CheckSessionIFrame {
this._interval = interval || DefaultInterval;
this._stopOnError = stopOnError;
const idx = url.indexOf('/', url.indexOf('//') + 2);
this._frame_origin = url.substr(0, idx);
this._frame_origin = url.substring(0, idx);
this._frame = window.document.createElement('iframe');
this._frame.style.visibility = 'hidden';
this._frame.style.position = 'absolute';
Expand Down
2 changes: 1 addition & 1 deletion packages/oidc-client/src/oidc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio

const session = initSession(this.configurationName, configuration.storage);
const jwk = await session.getDemonstratingProofOfPossessionJwkAsync();
const demonstratingProofOfPossessionNonce = await session.getDemonstratingProofOfPossessionNonce();
const demonstratingProofOfPossessionNonce = session.getDemonstratingProofOfPossessionNonce();

if (demonstratingProofOfPossessionNonce) {
claimsExtras['nonce'] = demonstratingProofOfPossessionNonce;
Expand Down
2 changes: 1 addition & 1 deletion packages/oidc-client/src/oidcClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface EventSubscriber {
}

export class OidcClient {
private _oidc: Oidc;
private readonly _oidc: Oidc;
constructor(oidc: Oidc) {
this._oidc = oidc;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/oidc-client/src/silentLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const _silentLoginAsync = (configurationName:string, configuration:OidcCo
isResolved = true;
};

const listener = (e: MessageEvent<any>) => {
const listener = (e: MessageEvent) => {
if (e.origin === iFrameOrigin &&
e.source === iframe.contentWindow
) {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-oidc/src/core/routes/withRouter.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const generateKey = () =>
Math.random()
.toString(36)
.substr(2, 6);
.slice(2, 8);

// Exported only for test
export type WindowInternal = Window & {
Expand Down

0 comments on commit 8797330

Please sign in to comment.