Skip to content

Commit bf2e098

Browse files
committed
Merge branch 'main' into lilac/vite-7
2 parents c02a27a + 1d1a16e commit bf2e098

File tree

464 files changed

+2073
-2111
lines changed

Some content is hidden

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

464 files changed

+2073
-2111
lines changed

.github/workflows/typos.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ HELO = "HELO"
2828
LKE = "LKE"
2929
byt = "byt"
3030
typ = "typ"
31+
Inferrable = "Inferrable"
3132

3233
[files]
3334
extend-exclude = [
@@ -47,5 +48,5 @@ extend-exclude = [
4748
"provisioner/terraform/testdata/**",
4849
# notifications' golden files confuse the detector because of quoted-printable encoding
4950
"coderd/notifications/testdata/**",
50-
"agent/agentcontainers/testdata/devcontainercli/**"
51+
"agent/agentcontainers/testdata/devcontainercli/**",
5152
]

.vscode/settings.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"[javascript][javascriptreact][json][jsonc][typescript][typescriptreact]": {
5050
"editor.defaultFormatter": "biomejs.biome",
5151
"editor.codeActionsOnSave": {
52-
"quickfix.biome": "explicit"
52+
"source.fixAll.biome": "explicit"
5353
// "source.organizeImports.biome": "explicit"
5454
}
5555
},
@@ -60,5 +60,7 @@
6060
"typos.config": ".github/workflows/typos.toml",
6161
"[markdown]": {
6262
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
63-
}
63+
},
64+
"biome.configurationPath": "./site/biome.jsonc",
65+
"biome.lsp.bin": "./site/node_modules/.bin/biome"
6466
}

biome.jsonc

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"vcs": {
3+
"enabled": true,
4+
"clientKind": "git",
5+
"useIgnoreFile": true,
6+
"defaultBranch": "main"
7+
},
8+
"files": {
9+
"includes": [
10+
"**",
11+
"!**/pnpm-lock.yaml"
12+
],
13+
"ignoreUnknown": true
14+
},
15+
"linter": {
16+
"rules": {
17+
"a11y": {
18+
"noSvgWithoutTitle": "off",
19+
"useButtonType": "off",
20+
"useSemanticElements": "off",
21+
"noStaticElementInteractions": "off"
22+
},
23+
"correctness": {
24+
"noUnusedImports": "warn",
25+
"useUniqueElementIds": "off", // TODO: This is new but we want to fix it
26+
"noNestedComponentDefinitions": "off", // TODO: Investigate, since it is used by shadcn components
27+
"noUnusedVariables": {
28+
"level": "warn",
29+
"options": {
30+
"ignoreRestSiblings": true
31+
}
32+
}
33+
},
34+
"style": {
35+
"noNonNullAssertion": "off",
36+
"noParameterAssign": "off",
37+
"useDefaultParameterLast": "off",
38+
"useSelfClosingElements": "off",
39+
"useAsConstAssertion": "error",
40+
"useEnumInitializers": "error",
41+
"useSingleVarDeclarator": "error",
42+
"noUnusedTemplateLiteral": "error",
43+
"useNumberNamespace": "error",
44+
"noInferrableTypes": "error",
45+
"noUselessElse": "error",
46+
"noRestrictedImports": {
47+
"level": "error",
48+
"options": {
49+
"paths": {
50+
"@mui/material": "Use @mui/material/<name> instead. See: https://material-ui.com/guides/minimizing-bundle-size/.",
51+
"@mui/icons-material": "Use @mui/icons-material/<name> instead. See: https://material-ui.com/guides/minimizing-bundle-size/.",
52+
"@mui/material/Avatar": "Use components/Avatar/Avatar instead.",
53+
"@mui/material/Alert": "Use components/Alert/Alert instead.",
54+
"@mui/material/Popover": "Use components/Popover/Popover instead.",
55+
"@mui/material/Typography": "Use native HTML elements instead. Eg: <span>, <p>, <h1>, etc.",
56+
"@mui/material/Box": "Use a <div> instead.",
57+
"@mui/material/styles": "Import from @emotion/react instead.",
58+
"lodash": "Use lodash/<name> instead."
59+
}
60+
}
61+
}
62+
},
63+
"suspicious": {
64+
"noArrayIndexKey": "off",
65+
"noThenProperty": "off",
66+
"noTemplateCurlyInString": "off",
67+
"useIterableCallbackReturn": "off",
68+
"noUnknownAtRules": "off", // Allow Tailwind directives
69+
"noConsole": {
70+
"level": "error",
71+
"options": {
72+
"allow": [
73+
"error",
74+
"info",
75+
"warn"
76+
]
77+
}
78+
}
79+
},
80+
"complexity": {
81+
"noImportantStyles": "off" // TODO: check and fix !important styles
82+
}
83+
}
84+
},
85+
"$schema": "https://biomejs.dev/schemas/2.2.0/schema.json"
86+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"storybook": "pnpm run -C site/ storybook"
1010
},
1111
"devDependencies": {
12+
"@biomejs/biome": "2.2.0",
1213
"markdown-table-formatter": "^1.6.1",
1314
"markdownlint-cli2": "^0.16.0",
1415
"quicktype": "^23.0.0"

pnpm-lock.yaml

Lines changed: 91 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/.storybook/preview.jsx renamed to site/.storybook/preview.tsx

Lines changed: 22 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,10 @@
1-
// @ts-check
2-
/**
3-
* @file Defines the main configuration file for all of our Storybook tests.
4-
* This file must be a JSX/JS file, but we can at least add some type safety via
5-
* the ts-check directive.
6-
* @see {@link https://storybook.js.org/docs/configure#configure-story-rendering}
7-
*
8-
* @typedef {import("react").ReactElement} ReactElement
9-
* @typedef {import("react").PropsWithChildren} PropsWithChildren
10-
* @typedef {import("react").FC<PropsWithChildren>} FC
11-
*
12-
* @typedef {import("@storybook/react-vite").StoryContext} StoryContext
13-
* @typedef {import("@storybook/react-vite").Preview} Preview
14-
*
15-
* @typedef {(Story: FC, Context: StoryContext) => React.JSX.Element} Decorator A
16-
* Storybook decorator function used to inject baseline data dependencies into
17-
* our React components during testing.
18-
*/
191
import "../src/index.css";
202
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
213
import CssBaseline from "@mui/material/CssBaseline";
224
import {
235
ThemeProvider as MuiThemeProvider,
246
StyledEngineProvider,
25-
// biome-ignore lint/nursery/noRestrictedImports: we extend the MUI theme
7+
// biome-ignore lint/style/noRestrictedImports: we extend the MUI theme
268
} from "@mui/material/styles";
279
import { DecoratorHelpers } from "@storybook/addon-themes";
2810
import isChromatic from "chromatic/isChromatic";
@@ -31,15 +13,12 @@ import { HelmetProvider } from "react-helmet-async";
3113
import { QueryClient, QueryClientProvider } from "react-query";
3214
import { withRouter } from "storybook-addon-remix-react-router";
3315
import "theme/globalFonts";
16+
import type { Decorator, Loader, Parameters } from "@storybook/react-vite";
3417
import themes from "../src/theme";
3518

3619
DecoratorHelpers.initializeThemeState(Object.keys(themes), "dark");
3720

38-
/** @type {readonly Decorator[]} */
39-
export const decorators = [withRouter, withQuery, withHelmet, withTheme];
40-
41-
/** @type {Preview["parameters"]} */
42-
export const parameters = {
21+
export const parameters: Parameters = {
4322
options: {
4423
storySort: {
4524
method: "alphabetical",
@@ -83,33 +62,15 @@ export const parameters = {
8362
},
8463
};
8564

86-
/**
87-
* There's a mismatch on the React Helmet return type that causes issues when
88-
* mounting the component in JS files only. Have to do type assertion, which is
89-
* especially ugly in JSDoc
90-
*/
91-
const SafeHelmetProvider = /** @type {FC} */ (
92-
/** @type {unknown} */ (HelmetProvider)
93-
);
94-
95-
/** @type {Decorator} */
96-
function withHelmet(Story) {
65+
const withHelmet: Decorator = (Story) => {
9766
return (
98-
<SafeHelmetProvider>
67+
<HelmetProvider>
9968
<Story />
100-
</SafeHelmetProvider>
69+
</HelmetProvider>
10170
);
102-
}
103-
104-
/**
105-
* This JSX file isn't part of the main project, so it doesn't get to use the
106-
* ambient types defined in `storybook.d.ts` to provide extra type-safety.
107-
* Extracting main key to avoid typos.
108-
*/
109-
const queryParametersKey = "queries";
71+
};
11072

111-
/** @type {Decorator} */
112-
function withQuery(Story, { parameters }) {
73+
const withQuery: Decorator = (Story, { parameters }) => {
11374
const queryClient = new QueryClient({
11475
defaultOptions: {
11576
queries: {
@@ -119,8 +80,8 @@ function withQuery(Story, { parameters }) {
11980
},
12081
});
12182

122-
if (parameters[queryParametersKey]) {
123-
for (const query of parameters[queryParametersKey]) {
83+
if (parameters.queries) {
84+
for (const query of parameters.queries) {
12485
queryClient.setQueryData(query.key, query.data);
12586
}
12687
}
@@ -130,10 +91,9 @@ function withQuery(Story, { parameters }) {
13091
<Story />
13192
</QueryClientProvider>
13293
);
133-
}
94+
};
13495

135-
/** @type {Decorator} */
136-
function withTheme(Story, context) {
96+
const withTheme: Decorator = (Story, context) => {
13797
const selectedTheme = DecoratorHelpers.pluckThemeFromContext(context);
13898
const { themeOverride } = DecoratorHelpers.useThemeParameters();
13999
const selected = themeOverride || selectedTheme || "dark";
@@ -156,12 +116,20 @@ function withTheme(Story, context) {
156116
</StyledEngineProvider>
157117
</StrictMode>
158118
);
159-
}
119+
};
120+
121+
export const decorators: Decorator[] = [
122+
withRouter,
123+
withQuery,
124+
withHelmet,
125+
withTheme,
126+
];
160127

161128
// Try to fix storybook rendering fonts inconsistently
162129
// https://www.chromatic.com/docs/font-loading/#solution-c-check-fonts-have-loaded-in-a-loader
163130
const fontLoader = async () => ({
164131
fonts: await document.fonts.ready,
165132
});
166133

167-
export const loaders = isChromatic() && document.fonts ? [fontLoader] : [];
134+
export const loaders: Loader[] =
135+
isChromatic() && document.fonts ? [fontLoader] : [];

0 commit comments

Comments
 (0)