Skip to content

chore(oauth): enable strict TypeScript ESLint rules - #2037

Open
ArtieReus wants to merge 3 commits into
mainfrom
artie-oauth-new-eslint
Open

ArtieReus wants to merge 3 commits into
mainfrom
artie-oauth-new-eslint

Conversation

@ArtieReus

Copy link
Copy Markdown
Collaborator

Summary

This PR enables strict TypeScript ESLint rules for the @cloudoperators/juno-oauth package by removing all disabled unsafe type rules and fixing the resulting type safety issues. This builds on the foundation from PR #2021 which added comprehensive TypeScript types to the package.

Changes Made

  • ESLint Configuration (eslint.config.mjs):

    • Migrated to @cloudoperators/juno-config/eslint/vite-react-ts.mjs config
    • Removed disabled unsafe TypeScript rules:
      • @typescript-eslint/no-unsafe-assignment
      • @typescript-eslint/no-unsafe-call
      • @typescript-eslint/no-unsafe-argument
      • @typescript-eslint/no-unsafe-member-access
    • Updated copyright year to 2025
  • Source Files - Added proper type assertions:

    • oidcConfig.ts: Cast r.json() response to OidcConfig
    • oidcState.ts: Fixed CommonJS import type handling, removed @ts-ignore
    • codeFlow.ts: Cast JSON responses to TokenResponse
    • oidcSession.ts: Cast parsed JSON to Record<string, unknown>
  • Test Files - Added proper type annotations:

    • mockedSession.test.ts: Cast vitest matchers to unknown
    • oidcSession.test.ts: Use exported OidcSessionInstance type
    • tokenSession.test.ts: Import and use proper types (TokenSessionInstance, TokenSessionState)
    • implicitFlow.test.ts: Import FlowResponse type and handle nullable response

Related Issues

Testing Instructions

  1. pnpm i
  2. cd packages/oauth
  3. pnpm lint - Should pass without errors
  4. pnpm typecheck - Should pass without errors
  5. pnpm test - All 86 tests should pass
  6. pnpm build - Should build successfully

Checklist

  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have made corresponding changes to the documentation (if applicable).
  • My changes generate no new warnings or errors.
  • I have created a changeset for my changes.

PR Manifesto

Review the PR Manifesto for best practises.

Signed-off-by: Arturo Reuschenbach Puncernau <reuschenbach@gmail.com>
@ArtieReus ArtieReus self-assigned this Oct 2, 2026
Copilot AI balanced review requested due to automatic review settings October 2, 2026 13:39
@ArtieReus
ArtieReus requested a review from a team as a code owner October 2, 2026 13:39
@changeset-bot

changeset-bot Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c2a3393

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@cloudoperators/juno-oauth Patch
@cloudoperators/juno-app-greenhouse Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The modern JSX compiler setting required by the issue marked as fixed remains missing.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Enables stricter TypeScript ESLint checks for the OAuth package and updates affected source and test typings.

Changes:

  • Migrates OAuth to the shared Vite React TypeScript ESLint configuration.
  • Types JSON responses, CommonJS interop, and request parameters.
  • Replaces test any usages and adds a patch changeset.
File Description
.changeset/​oauth-eslint-strict-types.md Adds the OAuth patch changeset.
packages/​oauth/​eslint.config.mjs Enables the stricter shared ESLint configuration.
packages/​oauth/​src/​oidcState.ts Types PKCE CommonJS interop.
packages/​oauth/​src/​oidcSession.ts Types parsed request parameters.
packages/​oauth/​src/​oidcConfig.ts Types discovery responses.
packages/​oauth/​src/​codeFlow.ts Types token endpoint responses.
packages/​oauth/​__tests__/​tokenSession.test.ts Replaces test any with session types.
packages/​oauth/​__tests__/​oidcSession.test.ts Types the tested session instance.
packages/​oauth/​__tests__/​mockedSession.test.ts Types asymmetric matcher values.
packages/​oauth/​__tests__/​implicitFlow.test.ts Types nullable flow responses.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

*/

import junoConfigs from "@cloudoperators/juno-config/eslint/juno-typescript.mjs"
import junoConfigs from "@cloudoperators/juno-config/eslint/vite-react-ts.mjs"

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task](oauth): Migrate to vite-react-ts eslint config and modern jsx

2 participants