Skip to content

Commit 79c1657

Browse files
authored
chore: Migrate to oxfmt (#880)
1 parent 6944cf7 commit 79c1657

File tree

15 files changed

+171
-42
lines changed

15 files changed

+171
-42
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
},
3131
"customizations": {
3232
"vscode": {
33-
"extensions": ["esbenp.prettier-vscode", "SonarSource.sonarlint-vscode"]
33+
"extensions": ["oxc.oxc-vscode", "SonarSource.sonarlint-vscode"]
3434
}
3535
}
3636
}

.oxfmtrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"printWidth": 100,
4+
"experimentalSortPackageJson": false,
5+
"trailingComma": "es5",
6+
"ignorePatterns": [
7+
"packages/e2e-tests/scenarios/*/ref/**/*",
8+
"packages/bundler-plugin-core/test/fixtures",
9+
".nxcache"
10+
]
11+
}

.prettierignore

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

.prettierrc.json

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

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"editor.defaultFormatter": "oxc.oxc-vscode",
3+
}

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
"test:integration": "nx run @sentry-internal/integration-tests:test",
2323
"test:e2e": "nx run @sentry-internal/bundler-plugin-e2e-tests:test",
2424
"lint": "nx run-many --target=lint --all",
25-
"check:formatting": "prettier --check .",
26-
"fix:formatting": "prettier --write ."
25+
"check:formatting": "oxfmt --check .",
26+
"fix:formatting": "oxfmt ."
2727
},
2828
"devDependencies": {
2929
"@nrwl/cli": "14.5.10",
3030
"@nrwl/workspace": "14.5.10",
3131
"lerna": "^6.6.2",
3232
"nx": "14.5.10",
33-
"prettier": "^2.7.1",
33+
"oxfmt": "^0.33.0",
3434
"pretty-quick": "^3.1.3",
3535
"npm-run-all": "^4.1.5",
3636
"ts-node": "^10.9.2"

packages/bundler-plugin-core/sentry-esbuild-debugid-injection-file.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ try {
33
"undefined" != typeof window
44
? window
55
: "undefined" != typeof global
6-
? global
7-
: "undefined" != typeof globalThis
8-
? global
9-
: "undefined" != typeof self
10-
? self
11-
: {};
6+
? global
7+
: "undefined" != typeof globalThis
8+
? global
9+
: "undefined" != typeof self
10+
? self
11+
: {};
1212

1313
let stack = new globalObject.Error().stack;
1414

packages/bundler-plugin-core/src/sentry/telemetry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export function setTelemetryDataOnScope(
110110

111111
scope.setTags({
112112
organization: org,
113-
project: Array.isArray(project) ? project.join(", ") : project ?? "undefined",
113+
project: Array.isArray(project) ? project.join(", ") : (project ?? "undefined"),
114114
bundler: buildTool,
115115
});
116116

packages/bundler-plugin-core/src/utils.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,19 @@ export function getDependencies(packageJson: PackageJson): {
120120

121121
const deps = Object.keys(dependencies).sort();
122122

123-
const depsVersions: Record<string, number> = deps.reduce((depsVersions, depName) => {
124-
if (PACKAGES_TO_INCLUDE_VERSION.includes(depName)) {
125-
const version = dependencies[depName] as string;
126-
const majorVersion = parseMajorVersion(version);
127-
if (majorVersion) {
128-
depsVersions[depName] = majorVersion;
123+
const depsVersions: Record<string, number> = deps.reduce(
124+
(depsVersions, depName) => {
125+
if (PACKAGES_TO_INCLUDE_VERSION.includes(depName)) {
126+
const version = dependencies[depName] as string;
127+
const majorVersion = parseMajorVersion(version);
128+
if (majorVersion) {
129+
depsVersions[depName] = majorVersion;
130+
}
129131
}
130-
}
131-
return depsVersions;
132-
}, {} as Record<string, number>);
132+
return depsVersions;
133+
},
134+
{} as Record<string, number>
135+
);
133136

134137
return { deps, depsVersions };
135138
}
@@ -414,8 +417,8 @@ export function serializeIgnoreOptions(ignoreValue: string | string[] | undefine
414417
const ignoreOptions: string[] = Array.isArray(ignoreValue)
415418
? ignoreValue
416419
: typeof ignoreValue === "string"
417-
? [ignoreValue]
418-
: DEFAULT_IGNORE;
420+
? [ignoreValue]
421+
: DEFAULT_IGNORE;
419422

420423
return ignoreOptions.reduce(
421424
(acc, value) => acc.concat(["--ignore", String(value)]),

packages/integration-tests/fixtures/component-name-annotate-experimental/component-name-annotate-experimental.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import childProcess from "child_process";
22
import path from "path";
33
import { testIfNodeMajorVersionIsLessThan18 } from "../../utils/testIf";
44

5-
// prettier-ignore
6-
const SNAPSHOT = `"<div><span data-sentry-component=\\"ComponentA\\">Component A</span></div>"`
5+
const SNAPSHOT = `"<div><span data-sentry-component=\\"ComponentA\\">Component A</span></div>"`;
76
const ESBUILD_SNAPSHOT = `"<div><span>Component A</span></div>"`;
87

98
function checkBundle(bundlePath: string, snapshot = SNAPSHOT): void {

0 commit comments

Comments
 (0)