Skip to content

Commit ebc685c

Browse files
authored
chore: migrate to oxfmt (#2681)
1 parent 505fdee commit ebc685c

9 files changed

Lines changed: 251 additions & 84 deletions

File tree

.github/prettierrc.json

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

.oxfmtrc.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"printWidth": 80,
4+
"trailingComma": "es5",
5+
"ignorePatterns": [],
6+
"sortImports": {
7+
"groups": [
8+
["builtin", "external"],
9+
["internal", "subpath"]
10+
],
11+
"newlinesBetween": false
12+
},
13+
"sortPackageJson": true
14+
}

CONTRIBUTING.md

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -365,33 +365,20 @@ entries.
365365

366366
<!-- References -->
367367

368-
[Dependency Dashboard]:
369-
https://github.com/microsoft/react-native-test-app/issues/492
368+
[Dependency Dashboard]: https://github.com/microsoft/react-native-test-app/issues/492
370369
[Patches page]: https://github.com/microsoft/react-native-test-app/wiki/Patches
371370
[Renovate]: https://docs.renovatebot.com
372-
[`@rnx-kit/align-deps`]:
373-
https://github.com/microsoft/rnx-kit/tree/main/packages/align-deps#contribution
374-
[`@rnx-kit/react-native-host`]:
375-
https://github.com/microsoft/rnx-kit/tree/main/packages/react-native-host#readme
376-
[`dependencies.gradle`]:
377-
https://github.com/microsoft/react-native-test-app/blob/trunk/android/dependencies.gradle
378-
[`generate-schema.mjs`]:
379-
https://github.com/microsoft/react-native-test-app/blob/trunk/scripts/internal/generate-schema.mjs
380-
[`package.json`]:
381-
https://github.com/microsoft/react-native-test-app/blob/trunk/package.json
382-
[`react-native-releases`]:
383-
https://github.com/reactwg/react-native-releases/discussions
384-
[`scripts/docs/`]:
385-
https://github.com/microsoft/react-native-test-app/tree/trunk/scripts/docs
386-
[`test:matrix`]:
387-
https://github.com/microsoft/react-native-test-app/blob/trunk/scripts/testing/test-matrix.mjs
371+
[`@rnx-kit/align-deps`]: https://github.com/microsoft/rnx-kit/tree/main/packages/align-deps#contribution
372+
[`@rnx-kit/react-native-host`]: https://github.com/microsoft/rnx-kit/tree/main/packages/react-native-host#readme
373+
[`dependencies.gradle`]: https://github.com/microsoft/react-native-test-app/blob/trunk/android/dependencies.gradle
374+
[`generate-schema.mjs`]: https://github.com/microsoft/react-native-test-app/blob/trunk/scripts/internal/generate-schema.mjs
375+
[`package.json`]: https://github.com/microsoft/react-native-test-app/blob/trunk/package.json
376+
[`react-native-releases`]: https://github.com/reactwg/react-native-releases/discussions
377+
[`scripts/docs/`]: https://github.com/microsoft/react-native-test-app/tree/trunk/scripts/docs
378+
[`test:matrix`]: https://github.com/microsoft/react-native-test-app/blob/trunk/scripts/testing/test-matrix.mjs
388379
[`uuid`]: https://github.com/uuidjs/uuid
389-
[commitlint-lite]:
390-
https://github.com/microsoft/rnx-kit/tree/main/incubator/commitlint-lite#readme
380+
[commitlint-lite]: https://github.com/microsoft/rnx-kit/tree/main/incubator/commitlint-lite#readme
391381
[conventional commit format]: https://conventionalcommits.org
392-
[every Monday morning]:
393-
https://github.com/microsoft/react-native-test-app/blob/trunk/.github/renovate.json
394-
[link to the issue]:
395-
https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
396-
[supported versions table]:
397-
https://github.com/microsoft/react-native-test-app/wiki#react-native-versions
382+
[every Monday morning]: https://github.com/microsoft/react-native-test-app/blob/trunk/.github/renovate.json
383+
[link to the issue]: https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
384+
[supported versions table]: https://github.com/microsoft/react-native-test-app/wiki#react-native-versions

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"scripts": {
1616
"format": "nx run-many --target format:c,format:js,format:swift",
1717
"lint": "nx run-many --target lint:js,lint:kt,lint:rb,lint:swift",
18-
"format:js": "prettier --write --log-level error $(git ls-files '.github/*.json' '.github/*.yml' '.yarn/plugins/*' '.yarnrc.yml' 'CONTRIBUTING.md' 'README.md' 'nx.json')",
18+
"format:js": "oxfmt $(git ls-files '.github/*.json' '.github/*.yml' '.yarn/plugins/*' '.yarnrc.yml' 'CONTRIBUTING.md' 'README.md' 'nx.json')",
1919
"lint:commit": "git log --format='%s' origin/trunk..HEAD | tail -1 | npx @rnx-kit/commitlint-lite@2.0.0",
2020
"release-notes": "node scripts/release-notes.mts",
2121
"show-affected": "node scripts/affected.mts"
@@ -28,8 +28,7 @@
2828
"js-yaml": "^4.1.0",
2929
"minimatch": "^10.0.0",
3030
"nx": "^21.0.0",
31-
"prettier": "^3.0.0",
32-
"prettier-plugin-organize-imports": "^4.1.0",
31+
"oxfmt": "^0.35.0",
3332
"typescript": "^5.0.0"
3433
},
3534
"engines": {
@@ -93,7 +92,6 @@
9392
"packages/app",
9493
"packages/app/example"
9594
],
96-
"prettier": "./.github/prettierrc.json",
9795
"rnx-kit": {
9896
"lint": {
9997
"lockfile": {

packages/app/example/src/App.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ import {
77
useColorScheme,
88
View,
99
} from "react-native";
10-
import { Feature } from "./Feature";
11-
import { LocalStorageStatus } from "./LocalStorage";
12-
import { RemoteDebugging } from "./RemoteDebugging";
13-
import { SafeAreaView } from "./SafeAreaView";
14-
import { Separator } from "./Separator";
1510
import {
1611
getHermesVersion,
1712
isBridgeless,
1813
isFabricInstance,
1914
ReactNativeVersion,
2015
} from "./core";
16+
import { Feature } from "./Feature";
17+
import { LocalStorageStatus } from "./LocalStorage";
18+
import { RemoteDebugging } from "./RemoteDebugging";
19+
import { SafeAreaView } from "./SafeAreaView";
20+
import { Separator } from "./Separator";
2121
import { useStyles } from "./styles";
2222

2323
declare global {

packages/app/example/src/RemoteDebugging.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22
import { NativeModules, View } from "react-native";
3-
import { Feature } from "./Feature";
43
import { getHermesVersion, isBridgeless } from "./core";
4+
import { Feature } from "./Feature";
55
import { useStyles } from "./styles";
66

77
function isRemoteDebuggingAvailable(): boolean {

packages/app/example/src/core.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ export function isFabricInstance<T>(
5959
return Boolean(
6060
// @ts-expect-error — https://github.com/facebook/react-native/blob/0.76-stable/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstanceUtils.js
6161
ref["__nativeTag"] ||
62-
// @ts-expect-error — https://github.com/facebook/react-native/blob/0.76-stable/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstanceUtils.js
63-
ref["_internalInstanceHandle"]?.stateNode?.canonical
62+
// @ts-expect-error — https://github.com/facebook/react-native/blob/0.76-stable/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstanceUtils.js
63+
ref["_internalInstanceHandle"]?.stateNode?.canonical
6464
);
6565
}
6666

packages/app/package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
},
6969
"scripts": {
7070
"format:c": "clang-format -i $(git ls-files '*.cpp' '*.h' '*.m' '*.mm')",
71-
"format:js": "prettier --write --log-level error $(git ls-files '*.[cm][jt]s' '*.[jt]s' '*.tsx' '*.yml' 'README.md' 'test/**/*.json')",
71+
"format:js": "oxfmt $(git ls-files '*.[cm][jt]s' '*.[jt]s' '*.tsx' '*.yml' 'README.md' 'test/**/*.json')",
7272
"format:swift": "swiftformat $(git ls-files '*.swift')",
7373
"generate:code": "node scripts/internal/generate-manifest.mts",
7474
"generate:docs": "node scripts/internal/generate-manifest-docs.mts",
@@ -143,8 +143,7 @@
143143
"js-yaml": "^4.1.0",
144144
"memfs": "^4.0.0",
145145
"minimatch": "^10.0.0",
146-
"prettier": "^3.0.0",
147-
"prettier-plugin-organize-imports": "^4.1.0",
146+
"oxfmt": "^0.35.0",
148147
"react": "19.1.0",
149148
"react-native": "^0.81.0",
150149
"react-native-macos": "^0.81.1",
@@ -160,6 +159,5 @@
160159
"macos": "react-native-macos",
161160
"visionos": "@callstack/react-native-visionos",
162161
"windows": "react-native-windows"
163-
},
164-
"prettier": "../../.github/prettierrc.json"
162+
}
165163
}

0 commit comments

Comments
 (0)