Skip to content

Commit a003fe2

Browse files
murbanowiczDanielRivers
authored andcommitted
bump Jose to 6 to support Cloudflare workers, update ESlint
1 parent cbd4dcc commit a003fe2

File tree

10 files changed

+724
-422
lines changed

10 files changed

+724
-422
lines changed

.eslintrc.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import tseslint from '@typescript-eslint/eslint-plugin';
2+
import typescript from '@typescript-eslint/parser';
3+
import n from 'eslint-plugin-n';
4+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
5+
import promise from 'eslint-plugin-promise';
6+
import { defineConfig, globalIgnores } from 'eslint/config';
7+
8+
export default defineConfig([
9+
// Global ignores
10+
globalIgnores(['**/dist', '**/dist-cjs']),
11+
12+
// Base configuration for all files
13+
{
14+
linterOptions: {
15+
reportUnusedDisableDirectives: true,
16+
},
17+
languageOptions: {
18+
ecmaVersion: 'latest',
19+
sourceType: 'module',
20+
},
21+
rules: {
22+
quotes: ['error', 'single'],
23+
},
24+
},
25+
26+
// TypeScript files
27+
{
28+
files: ['**/*.ts'],
29+
plugins: {
30+
'@typescript-eslint': tseslint,
31+
},
32+
languageOptions: {
33+
parser: typescript,
34+
parserOptions: {
35+
project: './tsconfig.json',
36+
},
37+
},
38+
rules: {
39+
'@typescript-eslint/explicit-function-return-type': 'off',
40+
'@typescript-eslint/strict-boolean-expressions': 'off',
41+
'@typescript-eslint/no-non-null-assertion': 'off',
42+
'@typescript-eslint/no-misused-promises': 'off',
43+
'@typescript-eslint/no-dynamic-delete': 'off',
44+
},
45+
},
46+
47+
// JavaScript files
48+
{
49+
files: ['**/*.js', '**/*.mjs', '**/*.cjs'],
50+
ignores: ['**/*.ts', '**/*.tsx'],
51+
},
52+
53+
// Other plugins
54+
{
55+
plugins: {
56+
n,
57+
promise,
58+
},
59+
rules: {
60+
'n/no-missing-import': 'off',
61+
},
62+
},
63+
64+
// Prettier at the end to override formatting rules
65+
eslintPluginPrettierRecommended,
66+
]);

lib/__tests__/sdk/oauth2-flows/AuthorizationCode.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,7 @@ describe('AuthorizationCode', () => {
381381
await sessionManager.setSessionItem('refresh_token', 'mines are here');
382382
await sessionManager.setSessionItem(
383383
'access_token',
384-
(
385-
await mocks.getMockAccessToken(clientConfig.authDomain, true)
386-
).token
384+
(await mocks.getMockAccessToken(clientConfig.authDomain, true)).token
387385
);
388386

389387
const client = new AuthorizationCode(clientConfig, clientSecret);

lib/__tests__/sdk/oauth2-flows/ClientCredentials.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createLocalJWKSet, importJWK } from 'jose';
1+
import { importJWK } from 'jose';
22
import { ClientCredentials } from '../../../sdk/oauth2-flows/ClientCredentials';
33
import { type ClientCredentialsOptions } from '../../../sdk/oauth2-flows/types';
44
import {

lib/sdk/clients/server/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ import type {
1414
type Options<T> = T extends GrantType.PKCE
1515
? PKCEClientOptions
1616
: T extends GrantType.AUTHORIZATION_CODE
17-
? ACClientOptions
18-
: T extends GrantType.CLIENT_CREDENTIALS
19-
? CCClientOptions
20-
: never;
17+
? ACClientOptions
18+
: T extends GrantType.CLIENT_CREDENTIALS
19+
? CCClientOptions
20+
: never;
2121
type Client<T> = T extends PKCEClientOptions
2222
? ACClient
2323
: T extends ACClientOptions
24-
? ACClient
25-
: T extends CCClientOptions
26-
? CCClient
27-
: never;
24+
? ACClient
25+
: T extends CCClientOptions
26+
? CCClient
27+
: never;
2828

2929
export const createKindeServerClient = <G extends GrantType>(
3030
grantType: G,

lib/sdk/clients/server/with-auth-utilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import * as utilities from '../../utilities/index.js';
33

44
import type {
55
ClaimTokenType,
6-
GetFlagType,
76
FlagType,
7+
GetFlagType,
88
} from '../../utilities/index.js';
99

1010
const withAuthUtilities = (

lib/sdk/exceptions.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ export enum KindeSDKErrorCode {
44
}
55

66
export class KindeSDKError extends Error {
7-
constructor(public errorCode: KindeSDKErrorCode, message: string) {
7+
constructor(
8+
public errorCode: KindeSDKErrorCode,
9+
message: string
10+
) {
811
super(message);
912
this.name = 'KindeSDKError';
1013
Object.setPrototypeOf(this, KindeSDKError.prototype);

lib/sdk/utilities/types.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { type KeyLike } from 'jose';
2-
1+
import { CryptoKey } from 'jose';
32
export interface TokenCollection {
43
refresh_token: string;
54
access_token: string;
@@ -47,5 +46,5 @@ export interface GetFlagType {
4746
export interface TokenValidationDetailsType {
4847
issuer: string;
4948
audience?: string | string[];
50-
keyProvider: () => Promise<KeyLike | Uint8Array>;
49+
keyProvider: () => Promise<CryptoKey | Uint8Array>;
5150
}

package.json

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,30 +47,32 @@
4747
"devDependencies": {
4848
"@openapitools/openapi-generator-cli": "^2.7.0",
4949
"@tsconfig/node18": "^2.0.1",
50-
"@types/jest": "^29.5.1",
50+
"@types/jest": "^29.5.14",
5151
"@types/jsdom": "^21.1.1",
5252
"@types/node": "^20.2.1",
53-
"@typescript-eslint/eslint-plugin": "^5.43.0",
54-
"eslint": "^8.41.0",
55-
"eslint-config-prettier": "^8.8.0",
56-
"eslint-config-standard-with-typescript": "^34.0.1",
57-
"eslint-plugin-import": "^2.25.2",
58-
"eslint-plugin-n": "^15.0.0",
59-
"eslint-plugin-promise": "^6.0.0",
53+
"@typescript-eslint/eslint-plugin": "^7",
54+
"eslint": "^9.24.0",
55+
"eslint-config-prettier": "^10.1.2",
56+
"eslint-config-standard-with-typescript": "^43.0.1",
57+
"eslint-plugin-import": "^2.31.0",
58+
"eslint-plugin-n": "^17.17.0",
59+
"eslint-plugin-prettier": "^5.2.6",
60+
"eslint-plugin-promise": "^7.2.1",
6061
"husky": "^8.0.3",
61-
"jest": "^29.5.0",
62+
"jest": "^29.7.0",
6263
"jest-environment-jsdom": "^29.5.0",
6364
"jsdom": "^22.0.0",
6465
"lint-staged": "^13.2.2",
6566
"ncp": "^2.0.0",
66-
"prettier": "^2.8.8",
67-
"rimraf": "^5.0.1",
68-
"ts-jest": "^29.1.0",
69-
"typescript": "^5.0.4"
67+
"prettier": "^3.5.3",
68+
"rimraf": "^6.0.1",
69+
"ts-jest": "^29.3.2",
70+
"typescript": "^5.8.3"
7071
},
7172
"dependencies": {
7273
"@kinde/js-utils": "^0.18.1",
73-
"jose": "^5.2.2",
74+
"@typescript-eslint/parser": "^8.30.1",
75+
"jose": "^6.0.10",
7476
"uncrypto": "^0.1.3"
7577
},
7678
"packageManager": "[email protected]+sha512.cdf928fca20832cd59ec53826492b7dc25dc524d4370b6b4adbf65803d32efaa6c1c88147c0ae4e8d579a6c9eec715757b50d4fa35eea179d868eada4ed043af"

0 commit comments

Comments
 (0)