Skip to content

Commit f3f2ce2

Browse files
committed
Replace ESLint and Prettier with Oxc tooling
1 parent 5ad1409 commit f3f2ce2

File tree

127 files changed

+1245
-5075
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+1245
-5075
lines changed

.github/workflows/package-ci.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,9 @@ jobs:
4646
name: Build & Test Report
4747
path: ./packages/*/junit.xml
4848
reporter: jest-junit
49-
- id: prettier
50-
name: Check styling
51-
run: yarn prettier
49+
- id: fmt
50+
name: Check formatting
51+
run: yarn fmt
5252
- id: lint
5353
name: Check for linting errors
5454
run: yarn lint:ci
55-
- name: Annotate from ESLint report
56-
uses: ataylorme/eslint-annotate-action@v2
57-
with:
58-
repo-token: "${{ secrets.GITHUB_TOKEN }}"
59-
report-json: ./packages/*/eslint-report.json
60-
fail-on-warning: true

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,4 @@ playwright/.cache/
4141
junit.xml
4242

4343
.next
44-
eslint-report.json
4544
reflag.config.json

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
yarn lint-staged

.oxfmtrc.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"printWidth": 80,
4+
"ignorePatterns": [
5+
"**/__snapshots__/**",
6+
"**/build/**",
7+
"**/dist/**",
8+
"**/gen/**",
9+
"coverage/**",
10+
"playwright-report/**",
11+
"test-results/**",
12+
"packages/management-sdk/src/generated/**",
13+
"packages/node-sdk/examples/cloudflare-worker/worker-configuration.d.ts"
14+
],
15+
"experimentalSortImports": {
16+
"groups": [
17+
"builtin",
18+
"external",
19+
"internal",
20+
["parent", "sibling", "index"]
21+
],
22+
"internalPattern": ["@reflag/", "@/"],
23+
"newlinesBetween": true
24+
}
25+
}

.oxlintrc.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"plugins": ["typescript", "react", "import"],
4+
"rules": {
5+
"no-unused-vars": "warn",
6+
"unicorn/no-thenable": "off",
7+
"react/exhaustive-deps": "warn",
8+
"import/no-duplicates": "warn",
9+
"sort-imports": "off",
10+
"typescript/no-floating-promises": "error"
11+
},
12+
"ignorePatterns": [
13+
"build/",
14+
"**/build/**",
15+
"**/dist/**",
16+
"**/gen/**",
17+
"node_modules/",
18+
"coverage/",
19+
"playwright-report/",
20+
"test-results/",
21+
"packages/management-sdk/src/generated/**",
22+
"packages/node-sdk/examples/cloudflare-worker/worker-configuration.d.ts"
23+
]
24+
}

package.json

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,25 @@
1717
"build": "lerna run build --stream",
1818
"test:ci": "lerna run test:ci --stream",
1919
"test": "lerna run test --stream",
20-
"format": "lerna run format --stream",
21-
"prettier": "lerna run prettier --stream",
22-
"prettier:fix": "lerna run prettier -- --write",
23-
"lint": "lerna run lint --stream",
24-
"lint:ci": "lerna run lint:ci --stream",
20+
"format": "yarn fmt:fix && yarn lint:fix",
21+
"lint": "yarn oxlint .",
22+
"lint:ci": "yarn oxlint .",
2523
"version-packages": "changeset version && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install",
2624
"release-packages": "yarn build && yarn release",
2725
"release": "changeset publish",
28-
"docs": "./docs.sh"
26+
"docs": "./docs.sh",
27+
"lint:fix": "yarn oxlint --fix .",
28+
"fmt": "yarn oxfmt --check .",
29+
"fmt:fix": "yarn oxfmt --write .",
30+
"postinstall": "husky"
2931
},
30-
"packageManager": "yarn@4.10.3",
3132
"devDependencies": {
3233
"@changesets/cli": "^2.29.6",
34+
"husky": "^9.1.7",
3335
"lerna": "^8.1.3",
34-
"prettier": "^3.5.2",
36+
"lint-staged": "^16.2.7",
37+
"oxfmt": "^0.27.0",
38+
"oxlint": "^1.42.0",
3539
"react": "19.1.0",
3640
"react-dom": "19.1.0",
3741
"typedoc": "0.27.6",
@@ -43,5 +47,15 @@
4347
"resolutions": {
4448
"react": "19.1.0",
4549
"react-dom": "19.1.0"
46-
}
50+
},
51+
"lint-staged": {
52+
"*.{ts,tsx,js,jsx,mjs,cjs,mts,cts,vue}": [
53+
"oxfmt --write",
54+
"oxlint --fix"
55+
],
56+
"*.{json,md,yml,yaml,css,html}": [
57+
"oxfmt --write"
58+
]
59+
},
60+
"packageManager": "yarn@4.10.3"
4761
}

packages/browser-sdk/eslint.config.js

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

packages/browser-sdk/package.json

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,11 @@
11
{
22
"name": "@reflag/browser-sdk",
33
"version": "1.4.7",
4-
"packageManager": "yarn@4.1.1",
54
"license": "MIT",
65
"repository": {
76
"type": "git",
87
"url": "https://github.com/reflagcom/javascript.git"
98
},
10-
"publishConfig": {
11-
"access": "public"
12-
},
13-
"scripts": {
14-
"dev": "vite",
15-
"build": "tsc --project tsconfig.native.json && tsc --project tsconfig.build.json && vite build",
16-
"test": "vitest run",
17-
"test:watch": "vitest",
18-
"test:e2e": "yarn build && playwright test",
19-
"test:ci": "yarn test --reporter=default --reporter=junit --outputFile=junit.xml && yarn test:e2e",
20-
"coverage": "yarn test --coverage",
21-
"lint": "eslint .",
22-
"lint:ci": "eslint --output-file eslint-report.json --format json .",
23-
"prettier": "prettier --check .",
24-
"format": "yarn lint --fix && yarn prettier --write",
25-
"preversion": "yarn lint && yarn prettier && yarn test && yarn build"
26-
},
279
"files": [
2810
"dist"
2911
],
@@ -32,12 +14,31 @@
3214
"react-native": "./dist/index.native.js",
3315
"exports": {
3416
".": {
17+
"types": "./dist/types/src/index.d.ts",
3518
"react-native": "./dist/index.native.js",
3619
"import": "./dist/reflag-browser-sdk.mjs",
37-
"require": "./dist/reflag-browser-sdk.umd.js",
38-
"types": "./dist/types/src/index.d.ts"
20+
"require": "./dist/reflag-browser-sdk.umd.js"
3921
}
4022
},
23+
"publishConfig": {
24+
"access": "public"
25+
},
26+
"scripts": {
27+
"dev": "vite",
28+
"build": "tsc --project tsconfig.native.json && tsc --project tsconfig.build.json && vite build",
29+
"test": "vitest run",
30+
"test:watch": "vitest",
31+
"test:e2e": "yarn build && playwright test",
32+
"test:ci": "yarn test --reporter=default --reporter=junit --outputFile=junit.xml && yarn test:e2e",
33+
"coverage": "yarn test --coverage",
34+
"lint": "oxlint .",
35+
"lint:ci": "oxlint .",
36+
"format": "yarn fmt:fix && yarn lint:fix",
37+
"preversion": "yarn lint && yarn fmt && yarn test && yarn build",
38+
"lint:fix": "oxlint --fix .",
39+
"fmt": "oxfmt --check .",
40+
"fmt:fix": "oxfmt --write ."
41+
},
4142
"dependencies": {
4243
"@floating-ui/dom": "^1.6.8",
4344
"fast-equals": "^5.2.2",
@@ -46,26 +47,23 @@
4647
},
4748
"devDependencies": {
4849
"@playwright/test": "^1.49.1",
49-
"@reflag/eslint-config": "0.0.2",
5050
"@reflag/tsconfig": "0.0.2",
5151
"@types/js-cookie": "^3.0.6",
5252
"@types/node": "^22.12.0",
5353
"@vitest/coverage-v8": "^2.0.4",
5454
"c8": "~10.1.3",
55-
"eslint": "^9.21.0",
56-
"eslint-config-preact": "^1.5.0",
5755
"http-server": "^14.1.1",
5856
"jsdom": "^24.1.0",
5957
"msw": "^2.3.4",
6058
"nock": "^14.0.1",
6159
"postcss": "^8.4.33",
6260
"postcss-nesting": "^12.0.2",
6361
"postcss-preset-env": "^9.3.0",
64-
"prettier": "^3.5.2",
6562
"typescript": "^5.7.3",
6663
"vite": "^5.3.5",
6764
"vite-plugin-dts": "^4.0.0-beta.1",
6865
"vite-plugin-static-copy": "^2.3.2",
6966
"vitest": "^2.0.4"
70-
}
67+
},
68+
"packageManager": "yarn@4.1.1"
7169
}

packages/browser-sdk/src/bulkQueue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { logResponseError } from "./utils/responseError";
21
import { BULK_QUEUE_FLUSH_DELAY_MS, BULK_QUEUE_MAX_SIZE } from "./config";
32
import { Logger } from "./logger";
3+
import { logResponseError } from "./utils/responseError";
44

55
const DROP_ERROR_THROTTLE_MS = 15 * 60 * 1000;
66

packages/browser-sdk/src/client.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
import { deepEqual } from "fast-equals";
22

3+
import { BulkEvent, BulkQueue } from "./bulkQueue";
4+
import {
5+
API_BASE_URL,
6+
APP_BASE_URL,
7+
IS_SERVER,
8+
SSE_REALTIME_BASE_URL,
9+
} from "./config";
10+
import { ReflagContext, ReflagDeprecatedContext } from "./context";
311
import {
412
AutoFeedback,
513
Feedback,
@@ -15,21 +23,13 @@ import {
1523
FlagsClient,
1624
RawFlags,
1725
} from "./flag/flags";
18-
import { ToolbarPosition } from "./ui/types";
19-
import { logResponseError } from "./utils/responseError";
20-
import { BulkEvent, BulkQueue } from "./bulkQueue";
21-
import {
22-
API_BASE_URL,
23-
APP_BASE_URL,
24-
IS_SERVER,
25-
SSE_REALTIME_BASE_URL,
26-
} from "./config";
27-
import { ReflagContext, ReflagDeprecatedContext } from "./context";
2826
import { HookArgs, HooksManager, State } from "./hooksManager";
2927
import { HttpClient } from "./httpClient";
3028
import { Logger, loggerWithPrefix, quietConsoleLogger } from "./logger";
3129
import { StorageAdapter } from "./storage";
3230
import { showToolbarToggle } from "./toolbar";
31+
import { ToolbarPosition } from "./ui/types";
32+
import { logResponseError } from "./utils/responseError";
3333

3434
const isMobile = typeof window !== "undefined" && window.innerWidth < 768;
3535
const isNode = typeof document === "undefined"; // deno supports "window" but not "document" according to https://remix.run/docs/en/main/guides/gotchas

0 commit comments

Comments
 (0)