Skip to content

Commit

Permalink
build: update biome to v1.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Jan 16, 2024
1 parent 2974df6 commit 474548e
Show file tree
Hide file tree
Showing 20 changed files with 133 additions and 89 deletions.
17 changes: 12 additions & 5 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
"useIgnoreFile": true,
"defaultBranch": "develop"
},
"organizeImports": {
"enabled": true
Expand All @@ -17,13 +18,15 @@
"noUnusedVariables": "error",
"noPrecisionLoss": "error"
},
"complexity": {
"useRegexLiterals": "error"
},
"suspicious": {
"all": false,
"noControlCharactersInRegex": "error"
},
"nursery": {
"noUnusedImports": "error",
"useRegexLiterals": "error"
"noUnusedImports": "error"
},
"performance": {
"all": true,
Expand All @@ -47,8 +50,8 @@
"dev-packages/browser-integration-tests/suites/**/*.json",
"dev-packages/browser-integration-tests/loader-suites/**/*.js",
"dev-packages/browser-integration-tests/suites/stacktraces/**/*.js",
"**/fixtures/*/*.json",
"**/*.min.js"
"fixtures/*/*.json",
"*.min.js"
]
},
"javascript": {
Expand All @@ -66,6 +69,10 @@
"json": {
"formatter": {
"enabled": true
},
"parser": {
"allowComments": true,
"allowTrailingCommas": true
}
}
}
11 changes: 4 additions & 7 deletions dev-packages/browser-integration-tests/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,10 @@ export const countEnvelopes = async (

page.on('request', requestHandler);

setTimeout(
() => {
page.off('request', requestHandler);
resolve(reqCount);
},
options?.timeout || 1000,
);
setTimeout(() => {
page.off('request', requestHandler);
resolve(reqCount);
}, options?.timeout || 1000);
});

if (options?.url) {
Expand Down
24 changes: 12 additions & 12 deletions dev-packages/node-integration-tests/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ export class TestEnv {
private _axiosConfig: AxiosRequestConfig | undefined = undefined;
private _terminator: HttpTerminator;

public constructor(public readonly server: http.Server, public readonly url: string) {
public constructor(
public readonly server: http.Server,
public readonly url: string,
) {
this.server = server;
this.url = url;
this._terminator = createHttpTerminator({ server: this.server, gracefulTerminationTimeout: 0 });
Expand Down Expand Up @@ -300,19 +303,16 @@ export class TestEnv {
return false;
});

setTimeout(
() => {
nock.removeInterceptor(mock);
setTimeout(() => {
nock.removeInterceptor(mock);

nock.cleanAll();
nock.cleanAll();

// eslint-disable-next-line @typescript-eslint/no-floating-promises
this._closeServer().then(() => {
resolve(reqCount);
});
},
options.timeout || 1000,
);
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this._closeServer().then(() => {
resolve(reqCount);
});
}, options.timeout || 1000);
});
}

Expand Down
10 changes: 8 additions & 2 deletions dev-packages/overhead-metrics/src/perf/cpu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,21 @@ export { CpuUsageSampler, CpuUsage };
export type CpuUsageSerialized = Partial<{ snapshots: JsonObject<number>; average: number }>;

class CpuUsage {
public constructor(public snapshots: TimeBasedMap<number>, public average: number) {}
public constructor(
public snapshots: TimeBasedMap<number>,
public average: number,
) {}

public static fromJSON(data: CpuUsageSerialized): CpuUsage {
return new CpuUsage(TimeBasedMap.fromJSON<number>(data.snapshots || {}), data.average as number);
}
}

class MetricsDataPoint {
public constructor(public timestamp: number, public activeTime: number) {}
public constructor(
public timestamp: number,
public activeTime: number,
) {}
}

class CpuUsageSampler {
Expand Down
5 changes: 4 additions & 1 deletion dev-packages/overhead-metrics/src/results/analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ export interface AnalyzerItemValues {
const AnalyzerItemValueNotAvailable = 'n/a';

class AnalyzerItemNumberValues implements AnalyzerItemValues {
public constructor(private _unit: AnalyzerItemUnit, private _values: (number | undefined)[]) {}
public constructor(
private _unit: AnalyzerItemUnit,
private _values: (number | undefined)[],
) {}

public value(index: number): string {
if (!this._has(index)) return AnalyzerItemValueNotAvailable;
Expand Down
5 changes: 4 additions & 1 deletion dev-packages/overhead-metrics/src/scenarios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ export class JankTestScenario implements Scenario {
}

export class BookingAppScenario implements Scenario {
public constructor(private _indexFile: string, private _count: number) {}
public constructor(
private _indexFile: string,
private _count: number,
) {}

/**
*
Expand Down
12 changes: 10 additions & 2 deletions dev-packages/overhead-metrics/src/vitals/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,23 @@ import { LCP } from './lcp.js';
export { WebVitals, WebVitalsCollector };

class WebVitals {
public constructor(public lcp: number | undefined, public cls: number | undefined, public fid: number | undefined) {}
public constructor(
public lcp: number | undefined,
public cls: number | undefined,
public fid: number | undefined,
) {}

public static fromJSON(data: Partial<WebVitals>): WebVitals {
return new WebVitals(data.lcp as number, data.cls as number, data.fid as number);
}
}

class WebVitalsCollector {
private constructor(private _lcp: LCP, private _cls: CLS, private _fid: FID) {}
private constructor(
private _lcp: LCP,
private _cls: CLS,
private _fid: FID,
) {}

public static async create(page: playwright.Page): Promise<WebVitalsCollector> {
const result = new WebVitalsCollector(new LCP(page), new CLS(page), new FID(page));
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"dev-packages/rollup-utils"
],
"devDependencies": {
"@biomejs/biome": "^1.4.0",
"@biomejs/biome": "^1.5.2",
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-node-resolve": "^13.1.3",
"@rollup/plugin-replace": "^3.0.1",
Expand Down
5 changes: 4 additions & 1 deletion packages/angular/test/errorhandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ class CustomError extends Error {
}

class ErrorLikeShapedClass implements Partial<Error> {
constructor(public name: string, public message: string) {}
constructor(
public name: string,
public message: string,
) {}
}

function createErrorEvent(message: string, innerError: any): ErrorEvent {
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/integrations/trycatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function _wrapEventTarget(target: string): void {
return;
}

fill(proto, 'addEventListener', function (original: VoidFunction,): (
fill(proto, 'addEventListener', function (original: VoidFunction): (
eventName: string,
fn: EventListenerObject,
options?: boolean | AddEventListenerOptions,
Expand Down
11 changes: 4 additions & 7 deletions packages/integrations/scripts/buildBundles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,10 @@ async function buildBundle(integration: string, jsVersion: string): Promise<void

if (runParallel) {
// We're building a bundle for each integration and each JavaScript version.
const tasks = getIntegrations().reduce(
(tasks, integration) => {
tasks.push(buildBundle(integration, 'es5'), buildBundle(integration, 'es6'));
return tasks;
},
[] as Promise<void>[],
);
const tasks = getIntegrations().reduce((tasks, integration) => {
tasks.push(buildBundle(integration, 'es5'), buildBundle(integration, 'es6'));
return tasks;
}, [] as Promise<void>[]);

Promise.all(tasks)
// eslint-disable-next-line no-console
Expand Down
4 changes: 3 additions & 1 deletion packages/nextjs/src/common/wrapPageComponentWithSentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ interface FunctionComponent {
}

interface ClassComponent {
new (...args: unknown[]): {
new (
...args: unknown[]
): {
props?: unknown;
render(...args: unknown[]): unknown;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ export const startServer = async (server: Server) => {
};

export class NextTestEnv extends TestEnv {
private constructor(public readonly server: http.Server, public readonly url: string) {
private constructor(
public readonly server: http.Server,
public readonly url: string,
) {
super(server, url);
}

Expand Down
5 changes: 4 additions & 1 deletion packages/node/test/integrations/localvariables.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ interface ThrowOn {
class MockDebugSession implements DebugSession {
private _onPause?: (message: InspectorNotification<Debugger.PausedEventDataType>, callback: () => void) => void;

constructor(private readonly _vars: Record<string, Record<string, unknown>>, private readonly _throwOn?: ThrowOn) {}
constructor(
private readonly _vars: Record<string, Record<string, unknown>>,
private readonly _throwOn?: ThrowOn,
) {}

public configureAndConnect(
onPause: (message: InspectorNotification<Debugger.PausedEventDataType>, callback: () => void) => void,
Expand Down
5 changes: 4 additions & 1 deletion packages/remix/test/integration/test/server/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import { TestEnv } from '../../../../../../../dev-packages/node-integration-test
export * from '../../../../../../../dev-packages/node-integration-tests/utils';

export class RemixTestEnv extends TestEnv {
private constructor(public readonly server: http.Server, public readonly url: string) {
private constructor(
public readonly server: http.Server,
public readonly url: string,
) {
super(server, url);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/replay-worker/src/worker.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// This is replaced at build-time with the content from _worker.ts, wrapped as a string.
// This is just a placeholder so that types etc. are correct.
export default ('' as string);
export default '' as string;
6 changes: 1 addition & 5 deletions packages/tracing-internal/tsconfig.types.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
// the fact that it introduces a dependency on `@sentry/browser` which doesn't exist anywhere else in the SDK, which
// then prevents us from building that and this at the same time when doing a parallellized build from the repo root
// level.
"exclude": [
"src/index.bundle.ts",
"src/index.bundle.feedback.ts",
"src/index.bundle.replay.ts"
],
"exclude": ["src/index.bundle.ts", "src/index.bundle.feedback.ts", "src/index.bundle.replay.ts"],
"compilerOptions": {
"declaration": true,
"declarationMap": true,
Expand Down
5 changes: 4 additions & 1 deletion packages/utils/src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ export class SentryError extends Error {

public logLevel: ConsoleLevel;

public constructor(public message: string, logLevel: ConsoleLevel = 'warn') {
public constructor(
public message: string,
logLevel: ConsoleLevel = 'warn',
) {
super(message);

this.name = new.target.prototype.constructor.name;
Expand Down
4 changes: 1 addition & 3 deletions packages/utils/src/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ export function urlEncode(object: { [key: string]: any }): string {
* @returns An Event or Error turned into an object - or the value argurment itself, when value is neither an Event nor
* an Error.
*/
export function convertToPlainObject<V>(
value: V,
):
export function convertToPlainObject<V>(value: V):
| {
[ownProps: string]: unknown;
type: string;
Expand Down
Loading

0 comments on commit 474548e

Please sign in to comment.