Skip to content

Commit

Permalink
Upgrade Rome to Biome (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
arendjr authored Sep 8, 2023
1 parent e252aaf commit 0474ad4
Show file tree
Hide file tree
Showing 11 changed files with 110 additions and 112 deletions.
2 changes: 1 addition & 1 deletion rome.json → biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "./node_modules/rome/configuration_schema.json",
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"files": {
"ignore": ["dist", "node_modules", ".yarn"]
},
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"scripts": {
"build": "yarn workspaces foreach -pt --verbose --exclude=\"*-example\" run build",
"lint": "rome ci packages/**/src",
"lint": "biome ci packages/**/src",
"test": "vitest",
"release-all": "yarn workspaces foreach -t --verbose --exclude=\"*-example\" --exclude=\"*-monorepo\" npm publish",
"release-all:beta": "yarn workspaces foreach -t --verbose --exclude=\"*-example\" --exclude=\"*-monorepo\" npm publish --tag beta",
Expand All @@ -34,7 +34,7 @@
"clean:parcel-plugin": "cd packages/parcel-transformer-autometrics && yarn clean"
},
"devDependencies": {
"rome": "^12.1.0",
"@biomejs/biome": "1.1.2",
"tsup": "^7.2.0",
"typescript": "^5.0.4",
"vitest": "^0.34.3"
Expand Down
4 changes: 2 additions & 2 deletions packages/autometrics/src/buildInfo.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { UpDownCounter } from "@opentelemetry/api";

import { BUILD_INFO_DESCRIPTION, BUILD_INFO_NAME } from "./constants";
import { debug } from "./logger";
import { getMeter } from "./instrumentation";
import { getRuntime, Runtime } from "./utils";
import { debug } from "./logger";
import { Runtime, getRuntime } from "./utils";

/**
* BuildInfo is used to create the `build_info` metric that helps to identify
Expand Down
2 changes: 1 addition & 1 deletion packages/autometrics/src/instrumentation.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Meter } from "@opentelemetry/api";
import { MeterProvider, MetricReader } from "@opentelemetry/sdk-metrics";

import { TemporaryMeter } from "./temporaryMeter";
import { createDefaultHistogramView } from "./histograms";
import { TemporaryMeter } from "./temporaryMeter";

const meterProvider = new MeterProvider({
views: [createDefaultHistogramView()],
Expand Down
26 changes: 12 additions & 14 deletions packages/autometrics/src/wrappers.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
import { Attributes, ValueType } from "@opentelemetry/api";

import {
ALSInstance,
getALSCaller,
getALSInstance,
getModulePath,
isFunction,
isObject,
isPromise,
} from "./utils";
import {
COUNTER_DESCRIPTION,
COUNTER_NAME,
Expand All @@ -18,8 +9,17 @@ import {
HISTOGRAM_NAME,
} from "./constants";
import { getMeter, metricsRecorded } from "./instrumentation";
import type { Objective } from "./objectives";
import { trace, warn } from "./logger";
import type { Objective } from "./objectives";
import {
ALSInstance,
getALSCaller,
getALSInstance,
getModulePath,
isFunction,
isObject,
isPromise,
} from "./utils";

let asyncLocalStorage: ALSInstance | undefined;
if (typeof window === "undefined") {
Expand All @@ -33,7 +33,7 @@ if (typeof window === "undefined") {
* This seems to be the preferred way for defining functions in TypeScript
* @internal
*/
// rome-ignore lint/suspicious/noExplicitAny:
// biome-ignore lint/suspicious/noExplicitAny:
export type FunctionSig = (...args: any[]) => any;

type AnyFunction<T extends FunctionSig> = (
Expand All @@ -44,9 +44,7 @@ type AnyFunction<T extends FunctionSig> = (
* This type signals to the language service plugin that it should show extra
* documentation along with the queries.
*/
/* rome-ignore lint/suspicious/noEmptyInterface: Converting this to a type
breaks the language server plugin */
interface AutometricsWrapper<T extends AnyFunction<T>> extends AnyFunction<T> {}
type AutometricsWrapper<T extends AnyFunction<T>> = AnyFunction<T>;

/**
* @group Wrapper and Decorator API
Expand Down
8 changes: 4 additions & 4 deletions packages/exporter-otlp-http/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
AggregationTemporalityPreference,
OTLPMetricExporter,
} from "@opentelemetry/exporter-metrics-otlp-http";
import {
BuildInfo,
amLogger,
createDefaultBuildInfo,
recordBuildInfo,
} from "@autometrics/autometrics";
import {
AggregationTemporalityPreference,
OTLPMetricExporter,
} from "@opentelemetry/exporter-metrics-otlp-http";
import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";

import { registerExporterInternal } from "./registerExporterInternal";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { registerExporter, ExporterOptions } from "@autometrics/autometrics";
import { ExporterOptions, registerExporter } from "@autometrics/autometrics";
import { MetricReader } from "@opentelemetry/sdk-metrics";

export let metricReader: MetricReader | undefined;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {
AggregationTemporality,
InstrumentType,
PushMetricExporter,
ResourceMetrics,
} from "@opentelemetry/sdk-metrics";
import { amLogger } from "@autometrics/autometrics";
import {
BindOnceFuture,
ExportResult,
ExportResultCode,
} from "@opentelemetry/core";
import { PrometheusSerializer } from "@opentelemetry/exporter-prometheus";
import { amLogger } from "@autometrics/autometrics";
import {
AggregationTemporality,
InstrumentType,
PushMetricExporter,
ResourceMetrics,
} from "@opentelemetry/sdk-metrics";

import type { InitOptions } from "./index";

Expand Down
10 changes: 5 additions & 5 deletions packages/parcel-transformer-autometrics/src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import {
EmitHint,
NewLineKind,
Node,
NodeFactory,
ObjectLiteralElementLike,
ObjectLiteralExpression,
ScriptTarget,
TransformationContext,
TransformerFactory,
Expand All @@ -13,13 +16,10 @@ import {
isFunctionExpression,
isIdentifier,
isObjectLiteralExpression,
isVariableDeclaration,
transform,
visitEachChild,
visitNode,
NodeFactory,
ObjectLiteralExpression,
isVariableDeclaration,
ObjectLiteralElementLike,
} from "typescript";

let moduleName: string;
Expand All @@ -29,7 +29,7 @@ const transformerFactory: TransformerFactory<Node> = (
const { factory } = context;
return (rootNode) => {
function visit(node: Node): Node {
// rome-ignore lint/style/noParameterAssign: it is what it is
// biome-ignore lint/style/noParameterAssign: it is what it is
node = visitEachChild(node, visit, context);

if (
Expand Down
6 changes: 3 additions & 3 deletions packages/typescript-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import ts, { server } from "typescript/lib/tsserverlibrary";

import {
getNodeAtCursor,
getNodeType,
getNodeIdentifier,
getNodeType,
isAutometricsWrappedOrDecorated,
} from "./astHelpers";
import {
createErrorRatioQuery,
createLatencyQuery,
createRequestRateQuery,
createErrorRatioQuery,
makePrometheusUrl,
} from "./queryHelpers";
import { createLogger, getProxy } from "./utils";
import { Tsserver } from "./types";
import { createLogger, getProxy } from "./utils";

type Config = {
prometheusUrl?: string;
Expand Down
144 changes: 72 additions & 72 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,77 @@ __metadata:
languageName: node
linkType: hard

"@biomejs/biome@npm:1.1.2":
version: 1.1.2
resolution: "@biomejs/biome@npm:1.1.2"
dependencies:
"@biomejs/cli-darwin-arm64": 1.1.2
"@biomejs/cli-darwin-x64": 1.1.2
"@biomejs/cli-linux-arm64": 1.1.2
"@biomejs/cli-linux-x64": 1.1.2
"@biomejs/cli-win32-arm64": 1.1.2
"@biomejs/cli-win32-x64": 1.1.2
dependenciesMeta:
"@biomejs/cli-darwin-arm64":
optional: true
"@biomejs/cli-darwin-x64":
optional: true
"@biomejs/cli-linux-arm64":
optional: true
"@biomejs/cli-linux-x64":
optional: true
"@biomejs/cli-win32-arm64":
optional: true
"@biomejs/cli-win32-x64":
optional: true
bin:
biome: bin/biome
checksum: d9c38a3f4b2962330e6f9bb46ea161480947e6aa8545e3bdde157182b4b7901f4600209e69a58489ae76eb279a4152a78f4507d6045a0f9ec7acb828c875175c
languageName: node
linkType: hard

"@biomejs/cli-darwin-arm64@npm:1.1.2":
version: 1.1.2
resolution: "@biomejs/cli-darwin-arm64@npm:1.1.2"
conditions: os=darwin & cpu=arm64
languageName: node
linkType: hard

"@biomejs/cli-darwin-x64@npm:1.1.2":
version: 1.1.2
resolution: "@biomejs/cli-darwin-x64@npm:1.1.2"
conditions: os=darwin & cpu=x64
languageName: node
linkType: hard

"@biomejs/cli-linux-arm64@npm:1.1.2":
version: 1.1.2
resolution: "@biomejs/cli-linux-arm64@npm:1.1.2"
conditions: os=linux & cpu=arm64
languageName: node
linkType: hard

"@biomejs/cli-linux-x64@npm:1.1.2":
version: 1.1.2
resolution: "@biomejs/cli-linux-x64@npm:1.1.2"
conditions: os=linux & cpu=x64
languageName: node
linkType: hard

"@biomejs/cli-win32-arm64@npm:1.1.2":
version: 1.1.2
resolution: "@biomejs/cli-win32-arm64@npm:1.1.2"
conditions: os=win32 & cpu=arm64
languageName: node
linkType: hard

"@biomejs/cli-win32-x64@npm:1.1.2":
version: 1.1.2
resolution: "@biomejs/cli-win32-x64@npm:1.1.2"
conditions: os=win32 & cpu=x64
languageName: node
linkType: hard

"@colors/colors@npm:1.5.0":
version: 1.5.0
resolution: "@colors/colors@npm:1.5.0"
Expand Down Expand Up @@ -1532,48 +1603,6 @@ __metadata:
languageName: node
linkType: hard

"@rometools/cli-darwin-arm64@npm:12.1.3":
version: 12.1.3
resolution: "@rometools/cli-darwin-arm64@npm:12.1.3"
conditions: os=darwin & cpu=arm64
languageName: node
linkType: hard

"@rometools/cli-darwin-x64@npm:12.1.3":
version: 12.1.3
resolution: "@rometools/cli-darwin-x64@npm:12.1.3"
conditions: os=darwin & cpu=x64
languageName: node
linkType: hard

"@rometools/cli-linux-arm64@npm:12.1.3":
version: 12.1.3
resolution: "@rometools/cli-linux-arm64@npm:12.1.3"
conditions: os=linux & cpu=arm64
languageName: node
linkType: hard

"@rometools/cli-linux-x64@npm:12.1.3":
version: 12.1.3
resolution: "@rometools/cli-linux-x64@npm:12.1.3"
conditions: os=linux & cpu=x64
languageName: node
linkType: hard

"@rometools/cli-win32-arm64@npm:12.1.3":
version: 12.1.3
resolution: "@rometools/cli-win32-arm64@npm:12.1.3"
conditions: os=win32 & cpu=arm64
languageName: node
linkType: hard

"@rometools/cli-win32-x64@npm:12.1.3":
version: 12.1.3
resolution: "@rometools/cli-win32-x64@npm:12.1.3"
conditions: os=win32 & cpu=x64
languageName: node
linkType: hard

"@sinclair/typebox@npm:^0.27.8":
version: 0.27.8
resolution: "@sinclair/typebox@npm:0.27.8"
Expand Down Expand Up @@ -2398,7 +2427,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "autometrics-monorepo@workspace:."
dependencies:
rome: ^12.1.0
"@biomejs/biome": 1.1.2
tsup: ^7.2.0
typescript: ^5.0.4
vitest: ^0.34.3
Expand Down Expand Up @@ -5933,35 +5962,6 @@ __metadata:
languageName: node
linkType: hard

"rome@npm:^12.1.0":
version: 12.1.3
resolution: "rome@npm:12.1.3"
dependencies:
"@rometools/cli-darwin-arm64": 12.1.3
"@rometools/cli-darwin-x64": 12.1.3
"@rometools/cli-linux-arm64": 12.1.3
"@rometools/cli-linux-x64": 12.1.3
"@rometools/cli-win32-arm64": 12.1.3
"@rometools/cli-win32-x64": 12.1.3
dependenciesMeta:
"@rometools/cli-darwin-arm64":
optional: true
"@rometools/cli-darwin-x64":
optional: true
"@rometools/cli-linux-arm64":
optional: true
"@rometools/cli-linux-x64":
optional: true
"@rometools/cli-win32-arm64":
optional: true
"@rometools/cli-win32-x64":
optional: true
bin:
rome: bin/rome
checksum: 341e5520a23277bdc2571db279e72fe9427a95f4e3025cd215a989d381fe6690f6aa1c0fb9abbd318a8bfd85ff1cec2304e92b732329c8a46c69e259eeb080cc
languageName: node
linkType: hard

"run-async@npm:^2.4.0":
version: 2.4.1
resolution: "run-async@npm:2.4.1"
Expand Down

0 comments on commit 0474ad4

Please sign in to comment.