Skip to content

bump Jose to 6 to support Cloudflare workers, update ESlint #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions .eslintrc.yml

This file was deleted.

66 changes: 66 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import tseslint from '@typescript-eslint/eslint-plugin';
import typescript from '@typescript-eslint/parser';
import n from 'eslint-plugin-n';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import promise from 'eslint-plugin-promise';
import { defineConfig, globalIgnores } from 'eslint/config';

export default defineConfig([
// Global ignores
globalIgnores(['**/dist', '**/dist-cjs']),

// Base configuration for all files
{
linterOptions: {
reportUnusedDisableDirectives: true,
},
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {
quotes: ['error', 'single'],
},
},

// TypeScript files
{
files: ['**/*.ts'],
plugins: {
'@typescript-eslint': tseslint,
},
languageOptions: {
parser: typescript,
parserOptions: {
project: './tsconfig.json',
},
Comment on lines +34 to +36
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify TypeScript project configuration.

The parser options reference ./tsconfig.json directly. Ensure this path is correct relative to where ESLint will be executed, especially if your build or test scripts run from different directories.


🏁 Script executed:

#!/bin/bash
# Check if tsconfig.json exists in the expected location
if [ -f "./tsconfig.json" ]; then
  echo "tsconfig.json found in root directory"
else
  echo "tsconfig.json not found in root directory"
  echo "Searching for tsconfig.json in the repository:"
  find . -name "tsconfig.json" | sort
fi

Length of output: 260


Missing TypeScript Configuration for ESLint Parser

It appears there’s no tsconfig.json at the repository root (or anywhere else), yet your ESLint config is pointing to ./tsconfig.json. ESLint will error out when it can’t find that file. Please update as follows:

• Either add (or move) your tsconfig.json to the project root
• Or correct the path in eslint.config.mjs (lines 34–36) under parserOptions.project to point at the actual TS config location

},
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/strict-boolean-expressions': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-dynamic-delete': 'off',
},
},

// JavaScript files
{
files: ['**/*.js', '**/*.mjs', '**/*.cjs'],
ignores: ['**/*.ts', '**/*.tsx'],
},

// Other plugins
{
plugins: {
n,
promise,
},
rules: {
'n/no-missing-import': 'off',
},
},

// Prettier at the end to override formatting rules
eslintPluginPrettierRecommended,
]);
4 changes: 1 addition & 3 deletions lib/__tests__/sdk/oauth2-flows/AuthorizationCode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,7 @@ describe('AuthorizationCode', () => {
await sessionManager.setSessionItem('refresh_token', 'mines are here');
await sessionManager.setSessionItem(
'access_token',
(
await mocks.getMockAccessToken(clientConfig.authDomain, true)
).token
(await mocks.getMockAccessToken(clientConfig.authDomain, true)).token
);

const client = new AuthorizationCode(clientConfig, clientSecret);
Expand Down
2 changes: 1 addition & 1 deletion lib/__tests__/sdk/oauth2-flows/ClientCredentials.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createLocalJWKSet, importJWK } from 'jose';
import { importJWK } from 'jose';
import { ClientCredentials } from '../../../sdk/oauth2-flows/ClientCredentials';
import { type ClientCredentialsOptions } from '../../../sdk/oauth2-flows/types';
import {
Expand Down
16 changes: 8 additions & 8 deletions lib/sdk/clients/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ import type {
type Options<T> = T extends GrantType.PKCE
? PKCEClientOptions
: T extends GrantType.AUTHORIZATION_CODE
? ACClientOptions
: T extends GrantType.CLIENT_CREDENTIALS
? CCClientOptions
: never;
? ACClientOptions
: T extends GrantType.CLIENT_CREDENTIALS
? CCClientOptions
: never;
type Client<T> = T extends PKCEClientOptions
? ACClient
: T extends ACClientOptions
? ACClient
: T extends CCClientOptions
? CCClient
: never;
? ACClient
: T extends CCClientOptions
? CCClient
: never;

export const createKindeServerClient = <G extends GrantType>(
grantType: G,
Expand Down
2 changes: 1 addition & 1 deletion lib/sdk/clients/server/with-auth-utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import * as utilities from '../../utilities/index.js';

import type {
ClaimTokenType,
GetFlagType,
FlagType,
GetFlagType,
} from '../../utilities/index.js';

const withAuthUtilities = (
Expand Down
5 changes: 4 additions & 1 deletion lib/sdk/exceptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ export enum KindeSDKErrorCode {
}

export class KindeSDKError extends Error {
constructor(public errorCode: KindeSDKErrorCode, message: string) {
constructor(
public errorCode: KindeSDKErrorCode,
message: string
) {
super(message);
this.name = 'KindeSDKError';
Object.setPrototypeOf(this, KindeSDKError.prototype);
Expand Down
5 changes: 2 additions & 3 deletions lib/sdk/utilities/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { type KeyLike } from 'jose';

import { CryptoKey } from 'jose';
export interface TokenCollection {
refresh_token: string;
access_token: string;
Expand Down Expand Up @@ -47,5 +46,5 @@ export interface GetFlagType {
export interface TokenValidationDetailsType {
issuer: string;
audience?: string | string[];
keyProvider: () => Promise<KeyLike | Uint8Array>;
keyProvider: () => Promise<CryptoKey | Uint8Array>;
}
34 changes: 18 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"postbuild": "node sdk-version.js clean && ncp ./package-cjs.json ./dist-cjs/package.json && ncp ./package-esm.json ./dist/package.json",
"prebuild": "node sdk-version.js && rimraf dist dist-cjs lib/models lib/apis",
"lint": "eslint . && prettier . --check",
"lint:fix": "eslint --fix . && prettier . --check",
"lint:fix": "eslint --fix .",
"test": "jest --passWithNoTests",
"lint-staged": "lint-staged",
"husky": "husky install",
Expand All @@ -47,30 +47,32 @@
"devDependencies": {
"@openapitools/openapi-generator-cli": "^2.7.0",
"@tsconfig/node18": "^2.0.1",
"@types/jest": "^29.5.1",
"@types/jest": "^29.5.14",
"@types/jsdom": "^21.1.1",
"@types/node": "^20.2.1",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"eslint": "^8.41.0",
"eslint-config-prettier": "^8.8.0",
"eslint-config-standard-with-typescript": "^34.0.1",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-n": "^15.0.0",
"eslint-plugin-promise": "^6.0.0",
"@typescript-eslint/eslint-plugin": "^7",
"eslint": "^9.24.0",
"eslint-config-prettier": "^10.1.2",
"eslint-config-standard-with-typescript": "^43.0.1",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-n": "^17.17.0",
"eslint-plugin-prettier": "^5.2.6",
"eslint-plugin-promise": "^7.2.1",
"husky": "^8.0.3",
"jest": "^29.5.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.5.0",
"jsdom": "^22.0.0",
"lint-staged": "^13.2.2",
"ncp": "^2.0.0",
"prettier": "^2.8.8",
"rimraf": "^5.0.1",
"ts-jest": "^29.1.0",
"typescript": "^5.0.4"
"prettier": "^3.5.3",
"rimraf": "^6.0.1",
"ts-jest": "^29.3.2",
"typescript": "^5.8.3"
},
"dependencies": {
"jose": "^5.2.2",
"@typescript-eslint/parser": "^8.30.1",
"jose": "^6.0.10",
"uncrypto": "^0.1.3"
},
"packageManager": "pnpm@10.6.5+sha512.cdf928fca20832cd59ec53826492b7dc25dc524d4370b6b4adbf65803d32efaa6c1c88147c0ae4e8d579a6c9eec715757b50d4fa35eea179d868eada4ed043af"
}
}
Loading
Loading