Skip to content

Commit ba647cc

Browse files
committed
chore: Autofix files after prettier config change
1 parent 02c20c0 commit ba647cc

Some content is hidden

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

50 files changed

+253
-538
lines changed

scripts/tmp-prepack.ts

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -28,35 +28,24 @@ const packageWithBundles = process.argv.includes('--bundles');
2828
const buildDir = packageWithBundles ? NPM_BUILD_DIR : BUILD_DIR;
2929

3030
// eslint-disable-next-line @typescript-eslint/no-var-requires
31-
const pkgJson: { [key: string]: unknown } = require(path.resolve(
32-
'package.json'
33-
));
31+
const pkgJson: { [key: string]: unknown } = require(path.resolve('package.json'));
3432

3533
// check if build dir exists
3634
if (!fs.existsSync(path.resolve(buildDir))) {
37-
console.error(
38-
`\nERROR: Directory '${buildDir}' does not exist in ${pkgJson.name}.`
39-
);
40-
console.error(
41-
"This script should only be executed after you've run `yarn build`."
42-
);
35+
console.error(`\nERROR: Directory '${buildDir}' does not exist in ${pkgJson.name}.`);
36+
console.error("This script should only be executed after you've run `yarn build`.");
4337
process.exit(1);
4438
}
4539

4640
// copy non-code assets to build dir
47-
ASSETS.forEach((asset) => {
41+
ASSETS.forEach(asset => {
4842
const assetPath = path.resolve(asset);
4943
if (!fs.existsSync(assetPath)) {
5044
console.error(`\nERROR: Asset '${asset}' does not exist.`);
5145
process.exit(1);
5246
}
5347
const destinationPath = path.resolve(buildDir, path.basename(asset));
54-
console.log(
55-
`Copying ${path.basename(asset)} to ${path.relative(
56-
'../..',
57-
destinationPath
58-
)}.`
59-
);
48+
console.log(`Copying ${path.basename(asset)} to ${path.relative('../..', destinationPath)}.`);
6049
fs.copyFileSync(assetPath, destinationPath);
6150
});
6251

@@ -66,14 +55,9 @@ const newPackageJsonPath = path.resolve(buildDir, 'package.json');
6655
const newPkgJson: { [key: string]: unknown } = require(newPackageJsonPath);
6756

6857
// modify entry points to point to correct paths (i.e. strip out the build directory)
69-
ENTRY_POINTS.filter((entryPoint) => newPkgJson[entryPoint]).forEach(
70-
(entryPoint) => {
71-
newPkgJson[entryPoint] = (newPkgJson[entryPoint] as string).replace(
72-
`${buildDir}/`,
73-
''
74-
);
75-
}
76-
);
58+
ENTRY_POINTS.filter(entryPoint => newPkgJson[entryPoint]).forEach(entryPoint => {
59+
newPkgJson[entryPoint] = (newPkgJson[entryPoint] as string).replace(`${buildDir}/`, '');
60+
});
7761

7862
delete newPkgJson.scripts;
7963
delete newPkgJson.volta;
@@ -83,9 +67,6 @@ delete newPkgJson.jest;
8367
try {
8468
fs.writeFileSync(newPackageJsonPath, JSON.stringify(newPkgJson, null, 2));
8569
} catch (error) {
86-
console.error(
87-
`\nERROR: Error while writing modified 'package.json' to disk in ${pkgJson.name}:\n`,
88-
error
89-
);
70+
console.error(`\nERROR: Error while writing modified 'package.json' to disk in ${pkgJson.name}:\n`, error);
9071
process.exit(1);
9172
}

src/coreHandlers/handleDom.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ export function handleDom(handlerData: any) {
1010

1111
// Accessing event.target can throw (see getsentry/raven-js#838, #768)
1212
try {
13-
targetNode =
14-
(handlerData.event.target as Node) ||
15-
(handlerData.event as unknown as Node);
13+
targetNode = (handlerData.event.target as Node) || (handlerData.event as unknown as Node);
1614
target = htmlTreeAsString(targetNode);
1715
} catch (e) {
1816
target = '<unknown>';

src/coreHandlers/handleFetch.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ interface FetchHandlerData {
1818
endTimestamp?: number;
1919
}
2020

21-
export function handleFetch(
22-
handlerData: FetchHandlerData
23-
): null | ReplayPerformanceEntry {
21+
export function handleFetch(handlerData: FetchHandlerData): null | ReplayPerformanceEntry {
2422
if (!handlerData.endTimestamp) {
2523
return null;
2624
}

src/coreHandlers/handleHistory.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ interface HistoryHandlerData {
55
to: string;
66
}
77

8-
export function handleHistory(
9-
handlerData: HistoryHandlerData
10-
): ReplayPerformanceEntry {
8+
export function handleHistory(handlerData: HistoryHandlerData): ReplayPerformanceEntry {
119
const { from, to } = handlerData;
1210

1311
const now = new Date().getTime() / 1000;

src/coreHandlers/handleScope.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ export function handleScope(scope: Scope) {
1717
_LAST_BREADCRUMB = newBreadcrumb;
1818

1919
if (
20-
['fetch', 'xhr', 'sentry.event', 'sentry.transaction'].includes(
21-
newBreadcrumb.category
22-
) ||
20+
['fetch', 'xhr', 'sentry.event', 'sentry.transaction'].includes(newBreadcrumb.category) ||
2321
newBreadcrumb.category?.startsWith('ui.')
2422
) {
2523
return null;

src/coreHandlers/handleXhr.ts

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@ import { isIngestHost } from '../util/isIngestHost';
33

44
// From sentry-javascript
55
// e.g. https://github.com/getsentry/sentry-javascript/blob/c7fc025bf9fa8c073fdb56351808ce53909fbe45/packages/utils/src/instrument.ts#L180
6-
type XHRSendInput =
7-
| null
8-
| Blob
9-
| BufferSource
10-
| FormData
11-
| URLSearchParams
12-
| string;
6+
type XHRSendInput = null | Blob | BufferSource | FormData | URLSearchParams | string;
137

148
interface SentryWrappedXMLHttpRequest extends XMLHttpRequest {
159
[key: string]: unknown;
@@ -32,9 +26,7 @@ interface XhrHandlerData {
3226
endTimestamp?: number;
3327
}
3428

35-
export function handleXhr(
36-
handlerData: XhrHandlerData
37-
): ReplayPerformanceEntry | null {
29+
export function handleXhr(handlerData: XhrHandlerData): ReplayPerformanceEntry | null {
3830
if (handlerData.xhr.__sentry_own_request__) {
3931
// Taken from sentry-javascript
4032
// Only capture non-sentry requests
@@ -51,11 +43,7 @@ export function handleXhr(
5143
return null;
5244
}
5345

54-
const {
55-
method,
56-
url,
57-
status_code: statusCode,
58-
} = handlerData.xhr.__sentry_xhr__ || {};
46+
const { method, url, status_code: statusCode } = handlerData.xhr.__sentry_xhr__ || {};
5947

6048
// Do not capture fetches to Sentry ingestion endpoint
6149
if (url === undefined || isIngestHost(url)) {
@@ -65,9 +53,7 @@ export function handleXhr(
6553
return {
6654
type: 'resource.xhr',
6755
name: url,
68-
start:
69-
(handlerData.xhr.__sentry_xhr__?.startTimestamp || 0) / 1000 ||
70-
handlerData.endTimestamp / 1000.0,
56+
start: (handlerData.xhr.__sentry_xhr__?.startTimestamp || 0) / 1000 || handlerData.endTimestamp / 1000.0,
7157
end: handlerData.endTimestamp / 1000.0,
7258
data: {
7359
method,

src/createPerformanceEntry.ts

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,15 @@ interface MemoryInfo {
3838
}
3939

4040
// Map entryType -> function to normalize data for event
41-
const ENTRY_TYPES: Record<
42-
string,
43-
(entry: AllPerformanceEntry) => null | ReplayPerformanceEntry
44-
> = {
41+
const ENTRY_TYPES: Record<string, (entry: AllPerformanceEntry) => null | ReplayPerformanceEntry> = {
4542
resource: createResourceEntry,
4643
paint: createPaintEntry,
4744
navigation: createNavigationEntry,
4845
['largest-contentful-paint']: createLargestContentfulPaint,
4946
};
5047

5148
export function createPerformanceEntries(entries: AllPerformanceEntry[]) {
52-
return entries
53-
.map(createPerformanceEntry)
54-
.filter(Boolean) as ReplayPerformanceEntry[];
49+
return entries.map(createPerformanceEntry).filter(Boolean) as ReplayPerformanceEntry[];
5550
}
5651

5752
function createPerformanceEntry(entry: AllPerformanceEntry) {
@@ -65,10 +60,7 @@ function createPerformanceEntry(entry: AllPerformanceEntry) {
6560
function getAbsoluteTime(time: number) {
6661
// browserPerformanceTimeOrigin can be undefined if `performance` or
6762
// `performance.now` doesn't exist, but this is already checked by this integration
68-
return (
69-
((browserPerformanceTimeOrigin || window.performance.timeOrigin) + time) /
70-
1000
71-
);
63+
return ((browserPerformanceTimeOrigin || window.performance.timeOrigin) + time) / 1000;
7264
}
7365

7466
function createPaintEntry(entry: PerformancePaintTiming) {
@@ -85,15 +77,7 @@ function createPaintEntry(entry: PerformancePaintTiming) {
8577

8678
function createNavigationEntry(entry: PerformanceNavigationTiming) {
8779
// TODO: There looks to be some more interesting bits in here (domComplete, domContentLoaded)
88-
const {
89-
entryType,
90-
name,
91-
duration,
92-
domComplete,
93-
startTime,
94-
transferSize,
95-
type,
96-
} = entry;
80+
const { entryType, name, duration, domComplete, startTime, transferSize, type } = entry;
9781

9882
// Ignore entries with no duration, they do not seem to be useful and cause dupes
9983
if (duration === 0) {
@@ -112,15 +96,7 @@ function createNavigationEntry(entry: PerformanceNavigationTiming) {
11296
};
11397
}
11498
function createResourceEntry(entry: PerformanceResourceTiming) {
115-
const {
116-
entryType,
117-
initiatorType,
118-
name,
119-
responseEnd,
120-
startTime,
121-
encodedBodySize,
122-
transferSize,
123-
} = entry;
99+
const { entryType, initiatorType, name, responseEnd, startTime, encodedBodySize, transferSize } = entry;
124100

125101
// Do not capture fetches to Sentry ingestion endpoint
126102
if (isIngestHost(name)) {
@@ -144,9 +120,7 @@ function createResourceEntry(entry: PerformanceResourceTiming) {
144120
};
145121
}
146122

147-
function createLargestContentfulPaint(
148-
entry: PerformanceEntry & { size: number; element: Node }
149-
) {
123+
function createLargestContentfulPaint(entry: PerformanceEntry & { size: number; element: Node }) {
150124
const { duration, entryType, startTime, size } = entry;
151125

152126
const start = getAbsoluteTime(startTime);

src/eventBuffer.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class EventBufferArray implements IEventBuffer {
6363
}
6464

6565
finish() {
66-
return new Promise<string>((resolve) => {
66+
return new Promise<string>(resolve => {
6767
// Make a copy of the events array reference and immediately clear the
6868
// events member so that we do not lose new events while uploading
6969
// attachment.
@@ -94,11 +94,7 @@ export class EventBufferCompressionWorker implements IEventBuffer {
9494
/**
9595
* Post message to worker and wait for response before resolving promise.
9696
*/
97-
postMessage({
98-
id,
99-
method,
100-
args,
101-
}: WorkerRequest): Promise<WorkerResponse['response']> {
97+
postMessage({ id, method, args }: WorkerRequest): Promise<WorkerResponse['response']> {
10298
return new Promise((resolve, reject) => {
10399
const listener = ({ data }: MessageEvent) => {
104100
if (data.method !== method) {

src/flags.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@
1616
declare const __SENTRY_DEBUG__: boolean;
1717

1818
/** Flag that is true for debug builds, false otherwise. */
19-
export const IS_DEBUG_BUILD =
20-
typeof __SENTRY_DEBUG__ === 'undefined' ? true : __SENTRY_DEBUG__;
19+
export const IS_DEBUG_BUILD = typeof __SENTRY_DEBUG__ === 'undefined' ? true : __SENTRY_DEBUG__;

0 commit comments

Comments
 (0)