Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8de3cd6

Browse files
authored
chore: tweak biome config (#15864)
1 parent 1eba4c0 commit 8de3cd6

15 files changed

+1486
-1924
lines changed

Makefile

-2
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,6 @@ vpn/vpn.pb.go: vpn/vpn.proto
642642
site/src/api/typesGenerated.ts: $(wildcard scripts/apitypings/*) $(shell find ./codersdk $(FIND_EXCLUSIONS) -type f -name '*.go')
643643
# -C sets the directory for the go run command
644644
go run -C ./scripts/apitypings main.go > $@
645-
(cd ./site && npx biome format --write ./src/api/typesGenerated.ts)
646-
./scripts/pnpm_install.sh
647645

648646
site/e2e/provisionerGenerated.ts: provisionerd/proto/provisionerd.pb.go provisionersdk/proto/provisioner.pb.go
649647
cd site

site/.storybook/main.js

+32-34
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,40 @@
11
import turbosnap from "vite-plugin-turbosnap";
22

33
module.exports = {
4-
stories: ["../src/**/*.stories.tsx"],
4+
stories: ["../src/**/*.stories.tsx"],
55

6-
addons: [
7-
"@chromatic-com/storybook",
8-
{
9-
name: "@storybook/addon-essentials",
10-
options: {
11-
backgrounds: false,
12-
},
13-
},
14-
"@storybook/addon-links",
15-
"@storybook/addon-mdx-gfm",
16-
"@storybook/addon-themes",
17-
"@storybook/addon-actions",
18-
"@storybook/addon-interactions",
19-
"storybook-addon-remix-react-router",
20-
],
6+
addons: [
7+
"@chromatic-com/storybook",
8+
{
9+
name: "@storybook/addon-essentials",
10+
options: {
11+
backgrounds: false,
12+
},
13+
},
14+
"@storybook/addon-links",
15+
"@storybook/addon-mdx-gfm",
16+
"@storybook/addon-themes",
17+
"@storybook/addon-actions",
18+
"@storybook/addon-interactions",
19+
"storybook-addon-remix-react-router",
20+
],
2121

22-
staticDirs: ["../static"],
22+
staticDirs: ["../static"],
2323

24-
framework: {
25-
name: "@storybook/react-vite",
26-
options: {},
27-
},
24+
framework: {
25+
name: "@storybook/react-vite",
26+
options: {},
27+
},
2828

29-
async viteFinal(config, { configType }) {
30-
config.plugins = config.plugins || [];
31-
// return the customized config
32-
if (configType === "PRODUCTION") {
33-
// ignore @ts-ignore because it's not in the vite types yet
34-
config.plugins.push(
35-
turbosnap({
36-
rootDir: config.root || "",
37-
}),
38-
);
39-
}
40-
return config;
41-
},
29+
async viteFinal(config, { configType }) {
30+
config.plugins = config.plugins || [];
31+
if (configType === "PRODUCTION") {
32+
config.plugins.push(
33+
turbosnap({
34+
rootDir: config.root || "",
35+
}),
36+
);
37+
}
38+
return config;
39+
},
4240
};

site/.storybook/preview.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ import CssBaseline from "@mui/material/CssBaseline";
2222
import {
2323
ThemeProvider as MuiThemeProvider,
2424
StyledEngineProvider,
25+
// biome-ignore lint/nursery/noRestrictedImports: we extend the MUI theme
2526
} from "@mui/material/styles";
2627
import { DecoratorHelpers } from "@storybook/addon-themes";
2728
import isChromatic from "chromatic/isChromatic";
2829
import React, { StrictMode } from "react";
2930
import { HelmetProvider } from "react-helmet-async";
30-
import { parseQueryArgs, QueryClient, QueryClientProvider } from "react-query";
31+
import { QueryClient, QueryClientProvider, parseQueryArgs } from "react-query";
3132
import { withRouter } from "storybook-addon-remix-react-router";
3233
import "theme/globalFonts";
3334
import themes from "../src/theme";

site/biome.json renamed to site/biome.jsonc

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
{
22
"files": {
33
"ignore": [
4-
"e2e/provisionerGenerated.ts",
5-
"e2e/google/protobuf/timestampGenerated.ts",
6-
"src/api/countriesGenerated.ts",
7-
"src/api/rbacresourcesGenerated.ts"
4+
"build/",
5+
"node_modules/",
6+
"out/",
7+
"test-results/",
8+
"e2e/**/*Generated.ts",
9+
"src/api/*Generated.ts",
10+
"pnpm-lock.yaml"
811
]
912
},
1013
"linter": {
@@ -44,5 +47,6 @@
4447
}
4548
}
4649
}
47-
}
50+
},
51+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json"
4852
}

site/jest.config.ts

+66-66
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
11
module.exports = {
2-
// Use a big timeout for CI.
3-
testTimeout: 20_000,
4-
maxWorkers: 8,
5-
projects: [
6-
{
7-
displayName: "test",
8-
roots: ["<rootDir>"],
9-
setupFiles: ["./jest.polyfills.js"],
10-
setupFilesAfterEnv: ["./jest.setup.ts"],
11-
extensionsToTreatAsEsm: [".ts"],
12-
transform: {
13-
"^.+\\.(t|j)sx?$": [
14-
"@swc/jest",
15-
{
16-
jsc: {
17-
transform: {
18-
react: {
19-
runtime: "automatic",
20-
importSource: "@emotion/react",
21-
},
22-
},
23-
experimental: {
24-
plugins: [["jest_workaround", {}]],
25-
},
26-
},
27-
},
28-
],
29-
},
30-
testEnvironment: "jsdom",
31-
testEnvironmentOptions: {
32-
customExportConditions: [""],
33-
},
34-
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
35-
testPathIgnorePatterns: [
36-
"/node_modules/",
37-
"/e2e/",
38-
// TODO: This test is timing out after upgrade a few Jest dependencies
39-
// and I was not able to figure out why. When running it specifically, I
40-
// can see many act warnings that may can help us to find the issue.
41-
"/usePaginatedQuery.test.ts",
42-
],
43-
transformIgnorePatterns: [
44-
"<rootDir>/node_modules/@chartjs-adapter-date-fns",
45-
],
46-
moduleDirectories: ["node_modules", "<rootDir>/src"],
47-
moduleNameMapper: {
48-
"\\.css$": "<rootDir>/src/testHelpers/styleMock.ts",
49-
"^@fontsource": "<rootDir>/src/testHelpers/styleMock.ts",
50-
},
51-
},
52-
],
53-
collectCoverageFrom: [
54-
// included files
55-
"<rootDir>/**/*.ts",
56-
"<rootDir>/**/*.tsx",
57-
// excluded files
58-
"!<rootDir>/**/*.stories.tsx",
59-
"!<rootDir>/_jest/**/*.*",
60-
"!<rootDir>/api.ts",
61-
"!<rootDir>/coverage/**/*.*",
62-
"!<rootDir>/e2e/**/*.*",
63-
"!<rootDir>/jest-runner.eslint.config.js",
64-
"!<rootDir>/jest.config.js",
65-
"!<rootDir>/out/**/*.*",
66-
"!<rootDir>/storybook-static/**/*.*",
67-
],
2+
// Use a big timeout for CI.
3+
testTimeout: 20_000,
4+
maxWorkers: 8,
5+
projects: [
6+
{
7+
displayName: "test",
8+
roots: ["<rootDir>"],
9+
setupFiles: ["./jest.polyfills.js"],
10+
setupFilesAfterEnv: ["./jest.setup.ts"],
11+
extensionsToTreatAsEsm: [".ts"],
12+
transform: {
13+
"^.+\\.(t|j)sx?$": [
14+
"@swc/jest",
15+
{
16+
jsc: {
17+
transform: {
18+
react: {
19+
runtime: "automatic",
20+
importSource: "@emotion/react",
21+
},
22+
},
23+
experimental: {
24+
plugins: [["jest_workaround", {}]],
25+
},
26+
},
27+
},
28+
],
29+
},
30+
testEnvironment: "jsdom",
31+
testEnvironmentOptions: {
32+
customExportConditions: [""],
33+
},
34+
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
35+
testPathIgnorePatterns: [
36+
"/node_modules/",
37+
"/e2e/",
38+
// TODO: This test is timing out after upgrade a few Jest dependencies
39+
// and I was not able to figure out why. When running it specifically, I
40+
// can see many act warnings that may can help us to find the issue.
41+
"/usePaginatedQuery.test.ts",
42+
],
43+
transformIgnorePatterns: [
44+
"<rootDir>/node_modules/@chartjs-adapter-date-fns",
45+
],
46+
moduleDirectories: ["node_modules", "<rootDir>/src"],
47+
moduleNameMapper: {
48+
"\\.css$": "<rootDir>/src/testHelpers/styleMock.ts",
49+
"^@fontsource": "<rootDir>/src/testHelpers/styleMock.ts",
50+
},
51+
},
52+
],
53+
collectCoverageFrom: [
54+
// included files
55+
"<rootDir>/**/*.ts",
56+
"<rootDir>/**/*.tsx",
57+
// excluded files
58+
"!<rootDir>/**/*.stories.tsx",
59+
"!<rootDir>/_jest/**/*.*",
60+
"!<rootDir>/api.ts",
61+
"!<rootDir>/coverage/**/*.*",
62+
"!<rootDir>/e2e/**/*.*",
63+
"!<rootDir>/jest-runner.eslint.config.js",
64+
"!<rootDir>/jest.config.js",
65+
"!<rootDir>/out/**/*.*",
66+
"!<rootDir>/storybook-static/**/*.*",
67+
],
6868
};

site/jest.polyfills.js

+22-22
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,32 @@ const { TextDecoder, TextEncoder } = require("node:util");
1313
const { ReadableStream } = require("node:stream/web");
1414

1515
Object.defineProperties(globalThis, {
16-
TextDecoder: { value: TextDecoder },
17-
TextEncoder: { value: TextEncoder },
18-
ReadableStream: { value: ReadableStream },
16+
TextDecoder: { value: TextDecoder },
17+
TextEncoder: { value: TextEncoder },
18+
ReadableStream: { value: ReadableStream },
1919
});
2020

2121
const { Blob, File } = require("node:buffer");
2222
const { fetch, Headers, FormData, Request, Response } = require("undici");
2323

2424
Object.defineProperties(globalThis, {
25-
fetch: { value: fetch, writable: true },
26-
Blob: { value: Blob },
27-
File: { value: File },
28-
Headers: { value: Headers },
29-
FormData: { value: FormData },
30-
Request: { value: Request },
31-
Response: { value: Response },
32-
matchMedia: {
33-
value: (query) => ({
34-
matches: false,
35-
media: query,
36-
onchange: null,
37-
addListener: jest.fn(),
38-
removeListener: jest.fn(),
39-
addEventListener: jest.fn(),
40-
removeEventListener: jest.fn(),
41-
dispatchEvent: jest.fn(),
42-
}),
43-
},
25+
fetch: { value: fetch, writable: true },
26+
Blob: { value: Blob },
27+
File: { value: File },
28+
Headers: { value: Headers },
29+
FormData: { value: FormData },
30+
Request: { value: Request },
31+
Response: { value: Response },
32+
matchMedia: {
33+
value: (query) => ({
34+
matches: false,
35+
media: query,
36+
onchange: null,
37+
addListener: jest.fn(),
38+
removeListener: jest.fn(),
39+
addEventListener: jest.fn(),
40+
removeEventListener: jest.fn(),
41+
dispatchEvent: jest.fn(),
42+
}),
43+
},
4444
});

site/jest.setup.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import "@testing-library/jest-dom";
22
import "jest-location-mock";
3-
import { cleanup } from "@testing-library/react";
43
import crypto from "node:crypto";
5-
import { useMemo } from "react";
4+
import { cleanup } from "@testing-library/react";
65
import type { Region } from "api/typesGenerated";
76
import type { ProxyLatencyReport } from "contexts/useProxyLatency";
7+
import { useMemo } from "react";
88
import { server } from "testHelpers/server";
99

1010
// useProxyLatency does some http requests to determine latency.

site/package.json

+8-12
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
"license": "AGPL-3.0",
77
"scripts": {
88
"build": "NODE_ENV=production pnpm vite build",
9-
"check": "biome check --error-on-warnings e2e/ src/",
10-
"check:fix": "biome check --error-on-warnings --fix e2e/ src/",
9+
"check": "biome check --error-on-warnings .",
10+
"check:fix": "biome check --error-on-warnings --fix .",
1111
"check:all": "pnpm check && pnpm test",
1212
"chromatic": "chromatic",
1313
"dev": "vite",
14-
"format": "biome format --write e2e/ src/",
15-
"format:check": "biome format e2e/ src/",
14+
"format": "biome format --write .",
15+
"format:check": "biome format .",
1616
"lint": "pnpm run lint:check && pnpm run lint:types",
17-
"lint:check": " biome lint --error-on-warnings e2e/ src/",
18-
"lint:fix": " biome lint --error-on-warnings --write e2e/ src/",
17+
"lint:check": " biome lint --error-on-warnings .",
18+
"lint:fix": " biome lint --error-on-warnings --write .",
1919
"lint:types": "tsc -p .",
2020
"playwright:install": "playwright install --with-deps chromium",
2121
"playwright:test": "playwright test --config=e2e/playwright.config.ts",
@@ -117,7 +117,7 @@
117117
"yup": "1.4.0"
118118
},
119119
"devDependencies": {
120-
"@biomejs/biome": "1.9.3",
120+
"@biomejs/biome": "1.9.4",
121121
"@chromatic-com/storybook": "3.2.2",
122122
"@octokit/types": "12.3.0",
123123
"@playwright/test": "1.47.2",
@@ -184,11 +184,7 @@
184184
"vite-plugin-checker": "0.8.0",
185185
"vite-plugin-turbosnap": "1.0.3"
186186
},
187-
"browserslist": [
188-
"chrome 110",
189-
"firefox 111",
190-
"safari 16.0"
191-
],
187+
"browserslist": ["chrome 110", "firefox 111", "safari 16.0"],
192188
"resolutions": {
193189
"optionator": "0.9.3",
194190
"semver": "7.6.2"

0 commit comments

Comments
 (0)