Skip to content

Commit ccb7abe

Browse files
authored
build(client): Add biome scripts where missing (#23916)
1 parent 117a4d6 commit ccb7abe

Some content is hidden

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

55 files changed

+412
-233
lines changed

biome.jsonc

+9-8
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@
8383
// Generated by policy-check
8484
"**/assertionShortCodesMap.ts",
8585

86-
// This is a test file
87-
"tools/markdown-magic/test/include.md",
88-
8986
// These are actually templates, not pure YAML files
9087
"**/templates/*.yaml",
9188

@@ -113,11 +110,8 @@
113110
"common/lib/**",
114111
"docs/**",
115112
"server/**",
116-
"tools/api-markdown-documenter/**",
117113
"tools/benchmark/**",
118-
"tools/changelog-generator-wrapper/**",
119114
"tools/getkeys/**",
120-
"tools/markdown-magic/**",
121115
"tools/pipelines/**",
122116
"tools/test-tools/**"
123117
],
@@ -177,7 +171,8 @@
177171
}
178172
},
179173
{
180-
// JSONC WITHOUT TRAILING COMMAS JSONC is not a standard, and support for trailing commas is not universal. For
174+
// JSONC WITHOUT TRAILING COMMAS
175+
// JSONC is not a standard, and support for trailing commas is not universal. For
181176
// simplicity and safety, we parse most JSONC files in a liberal way -- allowing comments and trailing commas, but
182177
// format them conservatively without trailing commas.
183178
//
@@ -189,7 +184,13 @@
189184
"**/api-extractor*.json",
190185

191186
// Tools reading tsdoc config files do not consistently support trailing commas.
192-
"**/tsdoc*.json"
187+
"**/tsdoc*.json",
188+
189+
// fence.json files don't support trailing commas
190+
"**/fence.json",
191+
192+
// These files contain comments, but are not JSONC files
193+
"tools/api-markdown-documenter/src/**/test/test-data/**"
193194
],
194195
"json": {
195196
"parser": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3+
"extends": ["../../../biome.jsonc"]
4+
}

packages/tools/changelog-generator-wrapper/package.json

+7-3
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@
2222
"build": "concurrently npm:build:compile npm:lint",
2323
"build:commonjs": "npm run tsc",
2424
"build:compile": "npm run build:commonjs",
25+
"check:biome": "biome check .",
26+
"check:format": "npm run check:biome",
2527
"clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\"",
2628
"eslint": "eslint --format stylish src",
2729
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
28-
"format": "npm run prettier:fix",
29-
"lint": "npm run prettier && npm run eslint",
30-
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
30+
"format": "npm run format:biome",
31+
"format:biome": "biome check . --write",
32+
"lint": "npm run eslint",
33+
"lint:fix": "npm run format && npm run eslint:fix",
3134
"prettier": "prettier --check . --cache --ignore-path ../../.prettierignore",
3235
"prettier:fix": "prettier --write . --cache --ignore-path ../../.prettierignore",
3336
"tsc": "echo \"No build required.\""
@@ -39,6 +42,7 @@
3942
"typescript": "~5.4.5"
4043
},
4144
"devDependencies": {
45+
"@biomejs/biome": "~1.9.3",
4246
"@fluidframework/build-common": "^2.0.3",
4347
"@fluidframework/eslint-config-fluid": "^5.7.3",
4448
"concurrently": "^8.2.1",

pnpm-lock.yaml

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3+
"extends": ["../../biome.jsonc"],
4+
"overrides": [
5+
{
6+
// JSONC WITHOUT TRAILING COMMAS
7+
// JSONC is not a standard, and support for trailing commas is not universal. For
8+
// simplicity and safety, we parse most JSONC files in a liberal way -- allowing comments and trailing commas, but
9+
// format them conservatively without trailing commas.
10+
//
11+
// See also: https://github.com/microsoft/vscode/issues/102061
12+
"include": [
13+
// These files contain comments, but are not JSONC files
14+
"**/test/test-data/**"
15+
],
16+
"json": {
17+
"parser": {
18+
"allowComments": true,
19+
"allowTrailingCommas": true
20+
},
21+
"formatter": {
22+
"trailingCommas": "none"
23+
}
24+
}
25+
}
26+
]
27+
}

tools/api-markdown-documenter/package.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,20 @@
3131
"build:examples": "tsc -p examples/tsconfig.json",
3232
"build:readme": "markdown-magic --files \"**/*.md\"",
3333
"build:tsc": "npm run tsc",
34+
"check:biome": "biome check .",
35+
"check:format": "npm run check:biome",
3436
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
3537
"ci:build:docs": "api-extractor run && copyfiles -u 1 \"./_api-extractor-temp/doc-models/*\" ../../_api-extractor-temp/",
3638
"clean": "rimraf --glob _api-extractor-temp nyc dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\"",
3739
"eslint": "eslint src",
3840
"eslint:fix": "eslint src --fix",
39-
"format": "npm run prettier:fix",
41+
"format": "npm run format:biome",
4042
"format-and-build": "npm run format && npm run build",
43+
"format:biome": "biome check . --write",
4144
"good-fences": "gf",
42-
"lint": "npm run prettier && npm run good-fences && npm run eslint",
45+
"lint": "npm run good-fences && npm run eslint",
4346
"lint:fences": "npm run good-fences",
44-
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
45-
"prettier": "prettier --check . --cache --ignore-path ../../.prettierignore",
46-
"prettier:fix": "prettier --write . --cache --ignore-path ../../.prettierignore",
47+
"lint:fix": "npm run eslint:fix",
4748
"rebuild": "npm run clean && npm run build",
4849
"test": "npm run test:mocha",
4950
"test:coverage": "c8 npm test:mocha",
@@ -85,6 +86,7 @@
8586
"unist-util-remove-position": "^5.0.0"
8687
},
8788
"devDependencies": {
89+
"@biomejs/biome": "^1.7.3",
8890
"@fluid-internal/mocha-test-setup": "~2.0.0-rc.3.0.3",
8991
"@fluid-tools/markdown-magic": "file:../markdown-magic",
9092
"@fluidframework/build-common": "^2.0.3",

tools/api-markdown-documenter/pnpm-lock.yaml

+93-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/api-markdown-documenter/src/LintApiModel.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ export interface LintApiModelConfiguration extends LoggingConfiguration {
4141
/**
4242
* {@link LintApiModelConfiguration} defaults.
4343
*/
44-
const defaultLintApiModelConfiguration: Required<Omit<LintApiModelConfiguration, "apiModel">> = {
45-
logger: defaultConsoleLogger,
46-
};
44+
const defaultLintApiModelConfiguration: Required<Omit<LintApiModelConfiguration, "apiModel">> =
45+
{
46+
logger: defaultConsoleLogger,
47+
};
4748

4849
// TODO: common TsdocError base (associatedItem, packageName)
4950

@@ -134,7 +135,7 @@ export async function lintApiModel(
134135
return anyErrors
135136
? {
136137
referenceErrors: errors.referenceErrors,
137-
}
138+
}
138139
: undefined;
139140
}
140141

tools/api-markdown-documenter/src/LoadModel.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ export interface LoadModelOptions extends LoggingConfiguration {
3434
/**
3535
* {@link LoadModelOptions} defaults.
3636
*/
37-
export const defaultLoadModelOptions: Required<Omit<LoadModelOptions, "modelDirectoryPath">> = {
38-
logger: defaultConsoleLogger,
39-
};
37+
export const defaultLoadModelOptions: Required<Omit<LoadModelOptions, "modelDirectoryPath">> =
38+
{
39+
logger: defaultConsoleLogger,
40+
};
4041

4142
/**
4243
* Reads API reports generated by {@link https://api-extractor.com/ | API-Extractor} (.api.json files)
@@ -131,10 +132,7 @@ function applyInheritDoc(apiItem: ApiItem, apiModel: ApiModel, logger: Logger):
131132
result.resolvedApiItem.tsdocComment &&
132133
result.resolvedApiItem !== apiItem
133134
) {
134-
copyInheritedDocumentation(
135-
apiItem.tsdocComment,
136-
result.resolvedApiItem.tsdocComment,
137-
);
135+
copyInheritedDocumentation(apiItem.tsdocComment, result.resolvedApiItem.tsdocComment);
138136
}
139137
}
140138
}
@@ -153,7 +151,10 @@ function applyInheritDoc(apiItem: ApiItem, apiModel: ApiModel, logger: Logger):
153151
* @remarks Copied from `@microsoft/api-documenter` as a workaround for an `API-Extractor` limitation tracked by
154152
* this issue: {@link https://github.com/microsoft/rushstack/issues/2062}.
155153
*/
156-
function copyInheritedDocumentation(targetComment: DocComment, sourceComment: DocComment): void {
154+
function copyInheritedDocumentation(
155+
targetComment: DocComment,
156+
sourceComment: DocComment,
157+
): void {
157158
targetComment.summarySection = sourceComment.summarySection;
158159
targetComment.remarksBlock = sourceComment.remarksBlock;
159160

tools/api-markdown-documenter/src/RenderHtml.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ import {
1313
transformApiModel,
1414
} from "./api-item-transforms/index.js";
1515
import type { DocumentNode } from "./documentation-domain/index.js";
16-
import { type RenderDocumentAsHtmlConfiguration, renderDocumentAsHtml } from "./renderers/index.js";
16+
import {
17+
type RenderDocumentAsHtmlConfiguration,
18+
renderDocumentAsHtml,
19+
} from "./renderers/index.js";
1720

1821
/**
1922
* API Model HTML rendering options.
@@ -30,7 +33,9 @@ export interface RenderApiModelAsHtmlOptions
3033
*
3134
* @alpha
3235
*/
33-
export async function renderApiModelAsHtml(options: RenderApiModelAsHtmlOptions): Promise<void> {
36+
export async function renderApiModelAsHtml(
37+
options: RenderApiModelAsHtmlOptions,
38+
): Promise<void> {
3439
const documents = transformApiModel(options);
3540

3641
return renderDocumentsAsHtml(documents, options);

tools/api-markdown-documenter/src/RenderMarkdown.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ import {
1313
transformApiModel,
1414
} from "./api-item-transforms/index.js";
1515
import type { DocumentNode } from "./documentation-domain/index.js";
16-
import { type MarkdownRenderConfiguration, renderDocumentAsMarkdown } from "./renderers/index.js";
16+
import {
17+
type MarkdownRenderConfiguration,
18+
renderDocumentAsMarkdown,
19+
} from "./renderers/index.js";
1720

1821
/**
1922
* API Model Markdown rendering options.

tools/api-markdown-documenter/src/api-item-transforms/TransformApiItem.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ import {
2727
import type { DocumentNode, SectionNode } from "../documentation-domain/index.js";
2828
import { getApiItemKind } from "../utilities/index.js";
2929

30-
import { doesItemRequireOwnDocument, shouldItemBeIncluded } from "./ApiItemTransformUtilities.js";
30+
import {
31+
doesItemRequireOwnDocument,
32+
shouldItemBeIncluded,
33+
} from "./ApiItemTransformUtilities.js";
3134
import { createDocument } from "./Utilities.js";
3235
import type { ApiItemTransformationConfiguration } from "./configuration/index.js";
3336
import { createBreadcrumbParagraph, wrapInSection } from "./helpers/index.js";

0 commit comments

Comments
 (0)