Skip to content

Commit

Permalink
build(client,build-tools): Upgrade biome to 1.6.2 (#20285)
Browse files Browse the repository at this point in the history
[Version
1.6.2](https://github.com/biomejs/biome/releases/tag/cli%2Fv1.6.2)
includes a fix we'll want for formatting client code, which is [support
for module syntax in .cts
files](biomejs/biome#2114).
  • Loading branch information
tylerbutler authored Mar 22, 2024
1 parent afe35a4 commit c2a04ca
Show file tree
Hide file tree
Showing 181 changed files with 583 additions and 581 deletions.
2 changes: 1 addition & 1 deletion azure/packages/azure-local-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"tinylicious": "^4.0.0"
},
"devDependencies": {
"@biomejs/biome": "^1.6.1",
"@biomejs/biome": "^1.6.2",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^5.1.0",
Expand Down
2 changes: 1 addition & 1 deletion azure/packages/azure-service-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.13.3",
"@biomejs/biome": "^1.6.1",
"@biomejs/biome": "^1.6.2",
"@fluid-tools/build-cli": "^0.34.0",
"@fluidframework/azure-service-utils-previous": "npm:@fluidframework/[email protected]",
"@fluidframework/build-common": "^2.0.3",
Expand Down
2 changes: 1 addition & 1 deletion azure/packages/test/scenario-runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"uuid": "^9.0.0"
},
"devDependencies": {
"@biomejs/biome": "^1.6.1",
"@biomejs/biome": "^1.6.2",
"@fluid-tools/build-cli": "^0.34.0",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.34.0",
Expand Down
2 changes: 1 addition & 1 deletion build-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"temp-directory": "nyc/.nyc_output"
},
"devDependencies": {
"@biomejs/biome": "^1.6.1",
"@biomejs/biome": "^1.6.2",
"@commitlint/cli": "^17.6.6",
"@commitlint/config-conventional": "^17.6.6",
"@commitlint/cz-commitlint": "^17.5.0",
Expand Down
4 changes: 2 additions & 2 deletions build-tools/packages/build-cli/src/BasePackageCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,6 @@ function listNames(strings: string[] | undefined): string {
return strings === undefined
? ""
: strings.length > 10
? `${strings.length}`
: `${strings.length} (${strings.join(", ")})`;
? `${strings.length}`
: `${strings.length} (${strings.join(", ")})`;
}
4 changes: 2 additions & 2 deletions build-tools/packages/build-cli/src/commands/bump/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export default class DepsCommand extends BaseCommand<typeof DepsCommand> {
/* prerelease */ flags.prerelease,
/* writeChanges */ !flags.testMode,
this.logger,
)
)
: await npmCheckUpdates(
context,
flags.releaseGroup ?? flags.package, // if undefined the whole repo will be checked
Expand All @@ -233,7 +233,7 @@ export default class DepsCommand extends BaseCommand<typeof DepsCommand> {
/* prerelease */ flags.prerelease,
/* writeChanges */ !flags.testMode,
this.logger,
);
);

if (updatedPackages.length > 0) {
if (shouldInstall) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default class GenerateChangeLogCommand extends BaseCommand<
const packagesToCheck = isReleaseGroup(releaseGroup)
? context.packagesInReleaseGroup(releaseGroup)
: // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
[context.fullPackageMap.get(releaseGroup)!];
[context.fullPackageMap.get(releaseGroup)!];

const installed = await FluidRepo.ensureInstalled(packagesToCheck);

Expand Down
4 changes: 2 additions & 2 deletions build-tools/packages/build-cli/src/commands/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ export default class ReleaseCommand extends StateMachineCommand<typeof ReleaseCo
const userPolicyCheckChoice = argv.includes("--policyCheck")
? true
: argv.includes("--no-policyCheck")
? false
: undefined;
? false
: undefined;

const branchPolicyCheckDefault = getRunPolicyCheckDefault(
releaseGroup,
Expand Down
14 changes: 7 additions & 7 deletions build-tools/packages/build-cli/src/commands/release/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ export abstract class ReleaseReportBaseCommand<
return date === undefined
? false
: this.numberBusinessDaysToConsiderRecent === undefined
? true
: differenceInBusinessDays(Date.now(), date) < this.numberBusinessDaysToConsiderRecent;
? true
: differenceInBusinessDays(Date.now(), date) < this.numberBusinessDaysToConsiderRecent;
}

/**
Expand Down Expand Up @@ -402,10 +402,10 @@ export default class ReleaseReportCommand extends ReleaseReportBaseCommand<
flags.highest === true
? "version"
: flags.mostRecent === true
? "date"
: flags.interactive
? "interactive"
: this.defaultMode;
? "date"
: flags.interactive
? "interactive"
: this.defaultMode;
assert(mode !== undefined, `mode is undefined`);

this.releaseGroupName = flags.releaseGroup;
Expand Down Expand Up @@ -672,7 +672,7 @@ async function writeReport(
const version =
releaseGroup === undefined
? // Use container-runtime as a proxy for the client release group.
report["@fluidframework/container-runtime"].version
report["@fluidframework/container-runtime"].version
: context.getVersion(releaseGroup);

const reportName = generateReportFileName(kind, version, releaseGroup);
Expand Down
4 changes: 2 additions & 2 deletions build-tools/packages/build-cli/src/commands/typetests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ If targeting prerelease versions, skipping versions, or using skipping some alte
(this.flags.remove
? VersionOptions.Clear
: this.flags.previous
? VersionOptions.Previous
: VersionOptions.ClearIfDisabled);
? VersionOptions.Previous
: VersionOptions.ClearIfDisabled);
updatePackageJsonFile(pkg.directory, (json) => {
if (this.flags.disable) {
json.typeValidation ??= { broken: {} };
Expand Down
2 changes: 1 addition & 1 deletion build-tools/packages/build-cli/src/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const parsePackageSelectionFlags = (
releaseGroups: (flags.releaseGroup as ReleaseGroup[]) ?? [],
releaseGroupRoots: (flags.releaseGroupRoot as ReleaseGroup[]) ?? [],
directory: flags.dir,
};
};

return options;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export const checkDependenciesInstalled: StateHandlerFunction = async (
const packagesToCheck = isReleaseGroup(releaseGroup)
? context.packagesInReleaseGroup(releaseGroup)
: // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
[context.fullPackageMap.get(releaseGroup)!];
[context.fullPackageMap.get(releaseGroup)!];

const installed = await FluidRepo.ensureInstalled(packagesToCheck);

Expand Down
6 changes: 3 additions & 3 deletions build-tools/packages/build-cli/src/handlers/doFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const doBumpReleasedDependencies: StateHandlerFunction = async (
isReleaseGroup(releaseGroup)
? context.packagesInReleaseGroup(releaseGroup)
: // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
[context.fullPackageMap.get(releaseGroup)!],
[context.fullPackageMap.get(releaseGroup)!],
);
// There were updates, which is considered a failure.
BaseStateHandler.signalFailure(machine, state);
Expand Down Expand Up @@ -159,9 +159,9 @@ export const doReleaseGroupBump: StateHandlerFunction = async (

const rgRepo = isReleaseGroup(releaseGroup)
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
context.repo.releaseGroups.get(releaseGroup)!
context.repo.releaseGroups.get(releaseGroup)!
: // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
context.fullPackageMap.get(releaseGroup)!;
context.fullPackageMap.get(releaseGroup)!;

const scheme = detectVersionScheme(releaseVersion);
const newVersion = bumpVersionScheme(releaseVersion, bumpType, scheme);
Expand Down
4 changes: 2 additions & 2 deletions build-tools/packages/build-cli/src/library/branches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ export function generateBumpDepsCommitMessage(
bumpedDep === "prerelease"
? "released prerelease packages"
: isReleaseGroup(bumpedDep)
? `${bumpedDep} release group`
: PackageName.getUnscopedName(bumpedDep);
? `${bumpedDep} release group`
: PackageName.getUnscopedName(bumpedDep);

const releaseGroupSegment = isReleaseGroup(releaseGroup)
? ` in the ${releaseGroup} release group`
Expand Down
6 changes: 3 additions & 3 deletions build-tools/packages/build-cli/src/library/layerGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,9 @@ export class LayerGraph {
const suffix = packageNode.indirectDependencies.has(depPackageNode)
? " [constraint=false color=lightgrey]"
: packageNode.layerNode !== depPackageNode.layerNode &&
packageNode.level - depPackageNode.level > 3
? " [constraint=false]"
: "";
packageNode.level - depPackageNode.level > 3
? " [constraint=false]"
: "";
dotEdges.push(`"${packageNode.dotName}"->"${depPackageNode.dotName}"${suffix}`);
}
return true;
Expand Down
12 changes: 6 additions & 6 deletions build-tools/packages/build-cli/src/library/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ export async function npmCheckUpdates(
releaseGroup === undefined // run on the whole repo
? [...context.repo.releaseGroups.keys()]
: isReleaseGroup(releaseGroup) // run on just this release group
? [releaseGroup]
: undefined;
? [releaseGroup]
: undefined;

const packagesToCheck =
releaseGroup === undefined // run on the whole repo
? [...context.independentPackages] // include all independent packages
: isReleaseGroup(releaseGroup)
? [] // run on a release group so no independent packages should be included
: [context.fullPackageMap.get(releaseGroup)]; // the releaseGroup argument must be a package
? [] // run on a release group so no independent packages should be included
: [context.fullPackageMap.get(releaseGroup)]; // the releaseGroup argument must be a package

if (releaseGroupsToCheck !== undefined) {
for (const group of releaseGroupsToCheck) {
Expand Down Expand Up @@ -769,12 +769,12 @@ export async function npmCheckUpdatesHomegrown(
const selectionCriteria: PackageSelectionCriteria =
releaseGroup === undefined
? // if releaseGroup is undefined it means we should update all packages and release groups
AllPackagesSelectionCriteria
AllPackagesSelectionCriteria
: {
independentPackages: false,
releaseGroups: [releaseGroup as ReleaseGroup],
releaseGroupRoots: [releaseGroup as ReleaseGroup],
};
};

// Remove the filtered release group from the list if needed
if (releaseGroupFilter !== undefined) {
Expand Down
4 changes: 2 additions & 2 deletions build-tools/packages/build-cli/src/library/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ export const getRanges = (version: ReleaseVersion, scheme?: VersionScheme): Rele
minor: getVersionRange(version, "minor"),
tilde: getVersionRange(version, "~"),
caret: getVersionRange(version, "^"),
}
}
: {
patch: `~${version}`,
minor: `^${version}`,
tilde: `~${version}`,
caret: `^${version}`,
};
};
};

interface PackageCaretRange {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ function checkTaskDeps(
return missingTaskDependencies.length > 0
? `'${taskName}' task is missing the following dependency: \n\t${missingTaskDependencies.join(
"\n\t",
)}`
)}`
: undefined;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ export const handlers: Handler[] = [
return missingDeps.length > 0
? `${file} is missing the following dependencies or devDependencies: \n\t${missingDeps.join(
"\n\t",
)}`
)}`
: undefined;
},
},
Expand Down Expand Up @@ -992,7 +992,7 @@ export const handlers: Handler[] = [
return scriptsUsingInconsistentArgs.length > 0
? `${file} using inconsistent arguments in the following scripts:\n\t${scriptsUsingInconsistentArgs.join(
"\n\t",
)}`
)}`
: undefined;
},
resolver: (file: string): { resolved: boolean; message?: string } => {
Expand Down Expand Up @@ -1379,7 +1379,7 @@ export const handlers: Handler[] = [
exportsRoot?.default?.default === undefined
? undefined
: // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument
normalizePathField(exportsRoot?.default?.default);
normalizePathField(exportsRoot?.default?.default);

// CJS-only packages should use default, not import or require.
if (isCJSOnly) {
Expand All @@ -1404,7 +1404,7 @@ export const handlers: Handler[] = [
exportsRoot?.import?.default === undefined
? undefined
: // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument
normalizePathField(exportsRoot?.import?.default);
normalizePathField(exportsRoot?.import?.default);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const moduleField = normalizePathField(json.module!);
if (importField !== moduleField) {
Expand All @@ -1417,7 +1417,7 @@ export const handlers: Handler[] = [
exportsRoot?.require?.default === undefined
? undefined
: // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument
normalizePathField(exportsRoot?.require?.default);
normalizePathField(exportsRoot?.require?.default);
const mainField = normalizePathField(json.main);
if (requireField !== mainField) {
return `${json.name} has both CJS and ESM entrypoints. Incorrect 'require' entry in 'exports' field in package.json. Expected '${mainField}', got '${requireField}'`;
Expand Down
4 changes: 2 additions & 2 deletions build-tools/packages/build-tools/src/common/monoRepo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ export class MonoRepo {
return this.packageManager === "pnpm"
? "pnpm i"
: this.packageManager === "yarn"
? "npm run install-strict"
: "npm i --no-package-lock --no-shrinkwrap";
? "npm run install-strict"
: "npm i --no-package-lock --no-shrinkwrap";
}

public get fluidBuildConfig(): IFluidBuildConfig | undefined {
Expand Down
10 changes: 5 additions & 5 deletions build-tools/packages/build-tools/src/common/npmPackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ export class Package {
this.packageManager = existsSync(pnpmWorkspacePath)
? "pnpm"
: existsSync(yarnLockPath)
? "yarn"
: "npm";
? "yarn"
: "npm";
traceInit(`${this.nameColored}: Package loaded`);
Object.assign(this, additionalProperties);
}
Expand Down Expand Up @@ -228,8 +228,8 @@ export class Package {
return this.packageManager === "pnpm"
? "pnpm i"
: this.packageManager === "yarn"
? "npm run install-strict"
: "npm i";
? "npm run install-strict"
: "npm i";
}

private get color() {
Expand Down Expand Up @@ -362,7 +362,7 @@ async function queueExec<TItem, TResult>(
`[${++numDone}/${p.length}] ${messageCallback(item)} - ${elapsedTime.toFixed(3)}s`,
);
return result;
}
}
: exec;
const q = queue(async (taskExec: TaskExec<TItem, TResult>) => {
try {
Expand Down
6 changes: 3 additions & 3 deletions build-tools/packages/build-tools/src/fluidBuild/fluidBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ async function main() {
options.fullSymlink
? "full"
: options.fullSymlink === false
? "isolated"
: "non-dependent"
? "isolated"
: "non-dependent"
} mode`,
);

Expand Down Expand Up @@ -139,7 +139,7 @@ async function main() {
? ` (${Math.floor(timer.getTotalTime() / 60000)}m ${(
(timer.getTotalTime() % 60000) /
1000
).toFixed(3)}s)`
).toFixed(3)}s)`
: "";
log(`Total time: ${(timer.getTotalTime() / 1000).toFixed(3)}s${timeInMinutes}`);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class FlubCheckLayerTask extends LeafWithDoneFileTask {
packageJson: Array.from(this.node.buildContext.repoPackageMap.values()).map(
(pkg) => pkg.packageJson,
),
})
})
: undefined;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export abstract class LeafTask extends Task {
message: "Worker error",
cmd: this.executionCommand,
code: workerResult.code,
},
},
stdout: workerResult.stdout ?? "",
stderr: workerResult.stderr ?? "",
worker: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ type TypeOnly<T> = T extends number
type TypeOnly<T> = T extends number
? number
: T extends string
? string
: T extends boolean | bigint | symbol
? T
: {
? string
: T extends boolean | bigint | symbol
? T
: {
[P in keyof T]: TypeOnly<T[P]>;
};
};

// Checks //
// Confirm typeOnly and general compatibility in TypeScript works as expected.
Expand Down
Loading

0 comments on commit c2a04ca

Please sign in to comment.