Skip to content
Draft
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
9 changes: 9 additions & 0 deletions .changeset/oxc-migration-correctness-fixes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@knocklabs/client": patch
"@knocklabs/react": patch
---

Fix correctness issues surfaced while migrating packages to oxlint:

- `@knocklabs/react`: the guide `Modal`/`Card` image components no longer pass `children` to the void `<img>` element (previously invalid and ignored at runtime).
- `@knocklabs/client`: `KnockGuideActivationUrlPattern.pattern` is now typed against the `urlpattern-polyfill` `URLPattern` it is constructed from, rather than the DOM lib's global `URLPattern`.
17 changes: 17 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"printWidth": 80,
"trailingComma": "all",
"singleQuote": false,
"tabWidth": 2,
"sortImports": {
"internalPattern": ["@/"],
"ignoreCase": false,
"newlinesBetween": true,
"groups": [
["value-builtin", "value-external", "type-import"],
["value-internal", "type-internal"],
["value-parent", "type-parent"],
["value-sibling", "value-index", "type-sibling", "type-index"]
]
}
}
29 changes: 29 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["typescript", "react", "react-hooks", "jsx-a11y"],
"categories": {
"correctness": "error"
},
"rules": {
"no-unused-vars": [
"error",
{
"args": "all",
"argsIgnorePattern": "^_",
"caughtErrors": "all",
"caughtErrorsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
],
"jsx-a11y/prefer-tag-over-role": "off"
},
"ignorePatterns": [
"**/dist/**",
"**/build/**",
"**/coverage/**",
"examples/**",
"integration/**"
]
}
2 changes: 2 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ yarn format
- **Package manager**: Yarn 4.1.0
- **Testing**: Vitest
- **Releases**: Changesets for versioning
- **Linting & formatting**: `packages/*` use the oxc toolchain — oxlint (`.oxlintrc.json`) and oxfmt (`.oxfmtrc.json`), configured at the repo root and auto-discovered per package. Example apps still run ESLint/Prettier.
- **Type-checking**: `packages/*` type-check with TypeScript 7, installed as the `typescript-7` alias (`npm:typescript@7.0.2`); TypeScript 5.x is retained for builds (`vite-plugin-dts`).

## Adding Dependencies

Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@
"@knocklabs/typescript-config": "workspace:^",
"@manypkg/cli": "^0.25.0",
"@vitest/coverage-v8": "^3.2.4",
"oxfmt": "0.60.0",
"oxlint": "1.75.0",
"prettier": "^3.5.3",
"turbo": "^2.9.16",
"typescript-7": "npm:typescript@7.0.2",
"vitest": "^3.2.4"
},
"engines": {
Expand Down
8 changes: 0 additions & 8 deletions packages/client/.eslintrc.js

This file was deleted.

13 changes: 5 additions & 8 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
},
"scripts": {
"dev": "tsc && vite build --watch --emptyOutDir false",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"format": "prettier \"src/**/*.{js,ts,tsx}\" --write",
"format:check": "prettier \"src/**/*.{js,ts,tsx}\" --check",
"type:check": "tsc --noEmit",
"lint": "oxlint --max-warnings=0",
"format": "oxfmt \"src/**/*.{ts,tsx,js}\"",
"format:check": "oxfmt --check \"src/**/*.{ts,tsx,js}\"",
"type:check": "node ../../node_modules/typescript-7/bin/tsc --noEmit",
"coverage": "vitest run --coverage",
"clean": "rimraf dist",
"build": "yarn clean && yarn build:cjs && yarn build:esm",
Expand All @@ -55,13 +55,10 @@
"@babel/preset-typescript": "^7.28.5",
"@codecov/vite-plugin": "^2.0.1",
"@types/jsonwebtoken": "^9.0.10",
"@typescript-eslint/eslint-plugin": "^8.59.4",
"@typescript-eslint/parser": "^8.59.4",
"@types/node": "^24",
"cross-env": "^7.0.3",
"crypto": "^1.0.1",
"eslint": "^8.56.0",
"jsonwebtoken": "^9.0.3",
"prettier": "^3.5.3",
"rimraf": "^6.0.1",
"rollup": "^4.46.2",
"typescript": "^5.8.3",
Expand Down
1 change: 1 addition & 0 deletions packages/client/src/api.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference types="node" />
import { Socket } from "phoenix";

import { exponentialBackoffFullJitter } from "./helpers";
Expand Down
1 change: 0 additions & 1 deletion packages/client/src/clients/feed/feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class Feed {
);
}

this.feedId = feedId;
this.userFeedId = this.buildUserFeedId();
this.referenceId = CLIENT_REF_ID_PREFIX + nanoid();
this.socketManager = socketManager;
Expand Down
9 changes: 5 additions & 4 deletions packages/client/src/clients/guide/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { GenericData } from "@knocklabs/types";
import type { URLPattern } from "urlpattern-polyfill";

// i.e. useGuide vs useGuides
export type SelectQueryLimit = "one" | "all";
Expand Down Expand Up @@ -205,17 +206,17 @@ export type GuideSocketEvent =
// Guide client
//

export interface KnockGuideStep<TContent = Any>
extends GuideStepData<TContent> {
export interface KnockGuideStep<
TContent = Any,
> extends GuideStepData<TContent> {
markAsSeen: () => Promise<KnockGuideStep<TContent> | undefined>;
markAsInteracted: (params?: {
metadata?: GenericData;
}) => Promise<KnockGuideStep<TContent> | undefined>;
markAsArchived: () => Promise<KnockGuideStep<TContent> | undefined>;
}

export interface KnockGuideActivationUrlPattern
extends GuideActivationUrlPatternData {
export interface KnockGuideActivationUrlPattern extends GuideActivationUrlPatternData {
pattern: URLPattern;
}

Expand Down
11 changes: 0 additions & 11 deletions packages/expo/.eslintrc.js

This file was deleted.

13 changes: 4 additions & 9 deletions packages/expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
"build": "yarn clean && yarn build:esm && yarn build:cjs",
"build:esm": "BUILD_TARGET=esm; tsc && vite build",
"build:cjs": "BUILD_TARGET=cjs; tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"format": "prettier \"src/**/*.{js,ts,tsx}\" --write",
"format:check": "prettier \"src/**/*.{js,ts,tsx}\" --check",
"type:check": "tsc --noEmit",
"lint": "oxlint --max-warnings=0",
"format": "oxfmt \"src/**/*.{ts,tsx,js}\"",
"format:check": "oxfmt --check \"src/**/*.{ts,tsx,js}\"",
"type:check": "node ../../node_modules/typescript-7/bin/tsc --noEmit",
"preview": "vite preview",
"test": "vitest run",
"test:watch": "vitest"
Expand Down Expand Up @@ -65,12 +65,7 @@
"@testing-library/react": "^16.3.2",
"@types/react": "^19.2.17",
"@types/react-native-htmlview": "^0.16.6",
"@typescript-eslint/eslint-plugin": "^8.59.4",
"@typescript-eslint/parser": "^8.59.4",
"@vitejs/plugin-react": "^4.5.1",
"eslint": "^8.56.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.5.2",
"expo": "~56.0.5",
"expo-constants": "~56.0.16",
"expo-device": "~56.0.4",
Expand Down
3 changes: 1 addition & 2 deletions packages/expo/src/modules/push/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import type {
* Context type for the Expo push notification provider.
* Extends the base push notification context with Expo-specific functionality.
*/
export interface KnockExpoPushNotificationContextType
extends KnockPushNotificationContextType {
export interface KnockExpoPushNotificationContextType extends KnockPushNotificationContextType {
/** The Expo push token, or null if not yet registered */
expoPushToken: string | null;

Expand Down
11 changes: 0 additions & 11 deletions packages/react-core/.eslintrc.js

This file was deleted.

13 changes: 4 additions & 9 deletions packages/react-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
"build": "yarn clean && yarn build:esm && yarn build:cjs",
"build:esm": "BUILD_TARGET=esm; vite build",
"build:cjs": "BUILD_TARGET=cjs; vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"format": "prettier \"src/**/*.{js,ts,tsx}\" --write",
"format:check": "prettier \"src/**/*.{js,ts,tsx}\" --check",
"type:check": "tsc --noEmit",
"lint": "oxlint --max-warnings=0",
"format": "oxfmt \"src/**/*.{ts,tsx,js}\"",
"format:check": "oxfmt --check \"src/**/*.{ts,tsx,js}\"",
"type:check": "node ../../node_modules/typescript-7/bin/tsc --noEmit",
"coverage": "vitest run --coverage",
"preview": "vite preview"
},
Expand All @@ -59,13 +59,8 @@
"@testing-library/react": "^16.3.2",
"@types/react": "^19.2.17",
"@types/react-dom": "^19.2.3",
"@typescript-eslint/eslint-plugin": "^8.59.4",
"@typescript-eslint/parser": "^8.59.4",
"@vitejs/plugin-react": "^4.5.1",
"babel-plugin-react-require": "^4.0.3",
"eslint": "^8.56.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.5.2",
"jsdom": "^29.1.0",
"react": "^19.2.7",
"react-dom": "^19.2.7",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useKnockMsTeamsClient } from "..";
import { MsTeamsChannelConnection } from "@knocklabs/client";
import { GenericData } from "@knocklabs/types";
import { useState } from "react";
import useSWR from "swr";

import { useKnockMsTeamsClient } from "..";
import { RecipientObject } from "../../..";
import { useKnockClient } from "../../core";
import { useTranslations } from "../../i18n";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useKnockMsTeamsClient } from "..";
import { TENANT_OBJECT_COLLECTION } from "@knocklabs/client";
import { useCallback, useMemo } from "react";

import { useKnockMsTeamsClient } from "..";
import { useKnockClient } from "../../core";

const MS_TEAMS_ADMINCONSENT_URL =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useSlackConnectionStatus } from "..";
import * as React from "react";
import { PropsWithChildren, useRef } from "react";

import { useSlackConnectionStatus } from "..";
import { type ConnectionStatus, slackProviderKey } from "../../core";
import { useKnockClient } from "../../core";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useKnockSlackClient } from "..";
import { SlackChannelConnection } from "@knocklabs/client";
import { GenericData } from "@knocklabs/types";
import { useState } from "react";
import useSWR from "swr";

import { useKnockSlackClient } from "..";
import { RecipientObject } from "../../..";
import { useKnockClient } from "../../core";
import { useTranslations } from "../../i18n";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useKnockSlackClient } from "..";
import { TENANT_OBJECT_COLLECTION } from "@knocklabs/client";
import { useCallback } from "react";

import { useKnockSlackClient } from "..";
import { useKnockClient } from "../../core";

const SLACK_AUTHORIZE_URL = "https://slack.com/oauth/v2/authorize";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { SlackChannelQueryOptions, useKnockSlackClient } from "..";
import { GetSlackChannelsResponse, SlackChannel } from "@knocklabs/client";
import { useCallback, useEffect, useMemo, useRef } from "react";
import useSWRInfinite from "swr/infinite";

import { SlackChannelQueryOptions, useKnockSlackClient } from "..";
import { useKnockClient } from "../../core";

const MAX_COUNT = 1000;
Expand Down
11 changes: 0 additions & 11 deletions packages/react-native/.eslintrc.js

This file was deleted.

13 changes: 4 additions & 9 deletions packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
"build": "yarn clean && yarn build:esm && yarn build:cjs",
"build:esm": "BUILD_TARGET=esm; tsc && vite build",
"build:cjs": "BUILD_TARGET=cjs; tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"format": "prettier \"src/**/*.{js,ts,tsx}\" --write",
"format:check": "prettier \"src/**/*.{js,ts,tsx}\" --check",
"type:check": "tsc --noEmit",
"lint": "oxlint --max-warnings=0",
"format": "oxfmt \"src/**/*.{ts,tsx,js}\"",
"format:check": "oxfmt --check \"src/**/*.{ts,tsx,js}\"",
"type:check": "node ../../node_modules/typescript-7/bin/tsc --noEmit",
"preview": "vite preview"
},
"repository": {
Expand All @@ -58,12 +58,7 @@
"@types/react": "^19.2.17",
"@types/react-native-get-random-values": "^1",
"@types/react-native-htmlview": "^0.16.6",
"@typescript-eslint/eslint-plugin": "^8.59.4",
"@typescript-eslint/parser": "^8.59.4",
"@vitejs/plugin-react": "^4.5.1",
"eslint": "^8.56.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.5.2",
"react": "^19.2.7",
"react-dom": "^19.2.7",
"react-native": "^0.85.3",
Expand Down
17 changes: 0 additions & 17 deletions packages/react/.eslintrc.js

This file was deleted.

Loading
Loading