Skip to content

Commit abe9a1a

Browse files
authored
Merge pull request #358 from chromaui/norbert/sb9-upgrade
Upgrade to SB9 alpha
2 parents 5b4fba3 + 0c4b8e5 commit abe9a1a

File tree

188 files changed

+4108
-6001
lines changed

Some content is hidden

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

188 files changed

+4108
-6001
lines changed

.eslintignore

-3
This file was deleted.

.eslintrc.cjs

-29
This file was deleted.

.prettierrc

-3
This file was deleted.

.prettierrc.mjs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export default {
2+
printWidth: 100,
3+
tabWidth: 2,
4+
semi: true,
5+
singleQuote: true,
6+
trailingComma: 'es5',
7+
bracketSpacing: true,
8+
};

.storybook/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const config: StorybookConfig = {
4242
staticDirs: ["../public"],
4343
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
4444
refs: {
45-
"@storybook/components": {
45+
"storybook/internal/components": {
4646
title: "Storybook Components",
4747
url: "https://next--635781f3500dd2c49e189caf.chromatic.com/",
4848
expanded: false,

.storybook/preview.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { action } from "@storybook/addon-actions";
2-
import { ManagerContext } from "@storybook/manager-api";
2+
import { ManagerContext } from "storybook/internal/manager-api";
33
import type { Decorator, Loader, Preview } from "@storybook/react";
44
import { fn } from "@storybook/test";
55
import {
@@ -10,7 +10,7 @@ import {
1010
styled,
1111
themes,
1212
useTheme,
13-
} from "@storybook/theming";
13+
} from "storybook/internal/theming";
1414
import { HttpResponse, graphql } from "msw";
1515
import { initialize, mswLoader } from "msw-storybook-addon";
1616
import React from "react";

eslint.config.mjs

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import simpleImportSort from 'eslint-plugin-simple-import-sort';
2+
import tsParser from '@typescript-eslint/parser';
3+
import path from 'node:path';
4+
import { fileURLToPath } from 'node:url';
5+
import js from '@eslint/js';
6+
import { FlatCompat } from '@eslint/eslintrc';
7+
8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = path.dirname(__filename);
10+
const compat = new FlatCompat({
11+
baseDirectory: __dirname,
12+
recommendedConfig: js.configs.recommended,
13+
allConfig: js.configs.all,
14+
});
15+
16+
export default [
17+
...compat.extends(
18+
'plugin:@typescript-eslint/recommended',
19+
'plugin:react-hooks/recommended',
20+
'plugin:storybook/recommended',
21+
'plugin:prettier/recommended'
22+
),
23+
{
24+
files: ['**/*.ts', '**/*.tsx'],
25+
plugins: {
26+
'simple-import-sort': simpleImportSort,
27+
},
28+
29+
languageOptions: {
30+
parser: tsParser,
31+
ecmaVersion: 5,
32+
sourceType: 'script',
33+
34+
parserOptions: {
35+
project: ['./tsconfig.json'],
36+
},
37+
},
38+
39+
rules: {
40+
'@typescript-eslint/explicit-module-boundary-types': 'off',
41+
'@typescript-eslint/no-explicit-any': 'warn',
42+
'@typescript-eslint/no-unused-vars': 'warn',
43+
'eslint-comments/disable-enable-pair': 'off',
44+
'simple-import-sort/imports': 'error',
45+
'simple-import-sort/exports': 'error',
46+
'import/named': 'off',
47+
'import/order': 'off',
48+
49+
// "import/no-extraneous-dependencies": ["error", {
50+
// devDependencies: true,
51+
// }],
52+
53+
'@typescript-eslint/ban-ts-comment': [
54+
'error',
55+
{
56+
'ts-expect-error': 'allow-with-description',
57+
'ts-ignore': 'allow-with-description',
58+
'ts-nocheck': 'allow-with-description',
59+
'ts-check': 'allow-with-description',
60+
minimumDescriptionLength: 3,
61+
},
62+
],
63+
64+
'jest/no-deprecated-functions': 'off',
65+
},
66+
},
67+
];

package.json

+26-34
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"build:watch": "run-p 'build --watch' 'codegen --watch'",
4141
"chromatic": "chromatic --config-file production.config.json",
4242
"codegen": "graphql-codegen",
43-
"lint": "eslint src --max-warnings 0 --report-unused-disable-directives",
43+
"lint": "eslint src --report-unused-disable-directives",
4444
"prerelease": "zx scripts/prepublish-checks.mjs",
4545
"release": "yarn run build && auto shipit",
4646
"start": "run-p build:watch 'storybook --quiet'",
@@ -53,7 +53,7 @@
5353
"jackspeak": "2.1.1"
5454
},
5555
"dependencies": {
56-
"chromatic": "^11.15.0",
56+
"chromatic": "^11.26.1",
5757
"filesize": "^10.0.12",
5858
"jsonfile": "^6.1.0",
5959
"react-confetti": "^6.1.0",
@@ -65,63 +65,55 @@
6565
"@graphql-codegen/cli": "^5.0.3",
6666
"@graphql-typed-document-node/core": "^3.2.0",
6767
"@parcel/watcher": "^2.4.1",
68-
"@storybook/addon-actions": "^8.4.0-beta.5",
69-
"@storybook/addon-designs": "^8.0.0",
70-
"@storybook/addon-essentials": "^8.4.0-beta.5",
71-
"@storybook/addon-interactions": "^8.4.0-beta.5",
72-
"@storybook/addon-mdx-gfm": "^8.4.0-beta.5",
73-
"@storybook/blocks": "^8.4.0-beta.5",
74-
"@storybook/channels": "^8.4.0-beta.5",
75-
"@storybook/client-logger": "^8.4.0-beta.5",
76-
"@storybook/components": "^8.4.0-beta.5",
77-
"@storybook/core-events": "^8.4.0-beta.5",
78-
"@storybook/eslint-config-storybook": "^3.1.2",
79-
"@storybook/icons": "^1.2.8",
80-
"@storybook/manager": "^8.4.0-beta.5",
81-
"@storybook/manager-api": "^8.4.0-beta.5",
82-
"@storybook/preview": "^8.4.0-beta.5",
83-
"@storybook/react": "^8.4.0-beta.5",
84-
"@storybook/react-vite": "^8.4.0-beta.5",
85-
"@storybook/telemetry": "^8.4.0-beta.5",
86-
"@storybook/test": "^8.4.0-beta.5",
68+
"@storybook/addon-actions": "^9.0.0 || ^9.0.0-0",
69+
"@storybook/addon-designs": "^8.2.0",
70+
"@storybook/addon-essentials": "^9.0.0 || ^9.0.0-0",
71+
"@storybook/addon-interactions": "^9.0.0 || ^9.0.0-0",
72+
"@storybook/addon-mdx-gfm": "^9.0.0 || ^9.0.0-0",
73+
"@storybook/blocks": "^9.0.0 || ^9.0.0-0",
74+
"@storybook/icons": "^1.3.2",
75+
"@storybook/react": "^9.0.0 || ^9.0.0-0",
76+
"@storybook/react-vite": "^9.0.0 || ^9.0.0-0",
77+
"@storybook/test": "^9.0.0 || ^9.0.0-0",
8778
"@storybook/testing-library": "^0.2.2",
88-
"@storybook/theming": "^8.4.0-beta.5",
89-
"@storybook/types": "^8.4.0-beta.5",
9079
"@types/jsonfile": "^6.1.1",
91-
"@types/node": "^18.15.0",
80+
"@types/node": "^22.13.5",
9281
"@types/pluralize": "^0.0.29",
9382
"@types/react": "^18.3.11",
9483
"@types/react-dom": "^18.3.0",
95-
"@typescript-eslint/eslint-plugin": "^5.59.11",
96-
"@typescript-eslint/parser": "^5.59.11",
84+
"@typescript-eslint/eslint-plugin": "^8.25.0",
85+
"@typescript-eslint/parser": "^8.25.0",
9786
"@urql/exchange-auth": "^2.1.6",
9887
"@vitejs/plugin-react": "^3.1.0",
9988
"@vitest/coverage-v8": "^2.1.8",
10089
"auto": "^11.0.5",
10190
"boxen": "^5.0.1",
10291
"date-fns": "^2.30.0",
10392
"dedent": "^0.7.0",
104-
"eslint": "^8.42.0",
105-
"eslint-plugin-jest": "^27.2.1",
106-
"eslint-plugin-simple-import-sort": "^10.0.0",
107-
"eslint-plugin-storybook": "^0.6.15",
93+
"eslint": "^9.21.0",
94+
"eslint-config-prettier": "^10.0.2",
95+
"eslint-plugin-jest": "^28.11.0",
96+
"eslint-plugin-prettier": "^5.2.3",
97+
"eslint-plugin-react-hooks": "^5.0.0",
98+
"eslint-plugin-simple-import-sort": "^12.1.1",
99+
"eslint-plugin-storybook": "^0.11.3",
108100
"graphql": "^16.8.1",
109101
"msw": "^2.0.0",
110-
"msw-storybook-addon": "2.0.0--canary.122.b3ed3b1.0",
102+
"msw-storybook-addon": "2.0.4",
111103
"npm-run-all": "^4.1.5",
112104
"pluralize": "^8.0.0",
113105
"polished": "^4.2.2",
114-
"prettier": "^2.8.8",
106+
"prettier": "^3.5.2",
115107
"prompts": "^2.4.2",
116108
"prop-types": "^15.8.1",
117109
"react": "^18.3.1",
118110
"react-dom": "^18.3.1",
119111
"react-joyride": "^2.7.2",
120112
"rimraf": "^3.0.2",
121-
"storybook": "^8.4.0-beta.5",
113+
"storybook": "^9.0.0 || ^9.0.0-0",
122114
"ts-dedent": "^2.2.0",
123115
"tsup": "^6.6.3",
124-
"typescript": "^4.9.5",
116+
"typescript": "^5.7.3",
125117
"urql": "^4.0.3",
126118
"uuid": "^9.0.0",
127119
"vite": "^4.1.4",

preset.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = require("./dist/preset.js");
1+
module.exports = require('./dist/preset.js');

src/AuthContext.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React, { createContext } from "react";
1+
import React, { createContext } from 'react';
22

3-
import { useRequiredContext } from "./utils/useRequiredContext";
3+
import { useRequiredContext } from './utils/useRequiredContext';
44

55
interface AuthState {
66
accessToken: string | null;
@@ -19,4 +19,4 @@ export const AuthProvider = ({
1919
return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;
2020
};
2121

22-
export const useAuthState = () => useRequiredContext(AuthContext, "AuthState");
22+
export const useAuthState = () => useRequiredContext(AuthContext, 'AuthState');

src/Panel.tsx

+34-35
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import type { API } from "@storybook/manager-api";
2-
import { useChannel, useStorybookState } from "@storybook/manager-api";
3-
import React, { useCallback, useEffect, useState } from "react";
1+
import React, { useCallback, useEffect, useState } from 'react';
2+
import type { API } from 'storybook/internal/manager-api';
3+
import { useChannel, useStorybookState } from 'storybook/internal/manager-api';
44

5-
import { AuthProvider } from "./AuthContext";
6-
import { Spinner } from "./components/design-system";
5+
import { AuthProvider } from './AuthContext';
6+
import { Spinner } from './components/design-system';
77
import {
88
ADDON_ID,
99
GIT_INFO,
@@ -13,27 +13,27 @@ import {
1313
LOCAL_BUILD_PROGRESS,
1414
REMOVE_ADDON,
1515
TELEMETRY,
16-
} from "./constants";
17-
import { Authentication } from "./screens/Authentication/Authentication";
18-
import { GitNotFound } from "./screens/Errors/GitNotFound";
19-
import { LinkedProject } from "./screens/LinkProject/LinkedProject";
20-
import { LinkingProjectFailed } from "./screens/LinkProject/LinkingProjectFailed";
21-
import { LinkProject } from "./screens/LinkProject/LinkProject";
22-
import { NoDevServer } from "./screens/NoDevServer/NoDevServer";
23-
import { NoNetwork } from "./screens/NoNetwork/NoNetwork";
24-
import { UninstallProvider } from "./screens/Uninstalled/UninstallContext";
25-
import { Uninstalled } from "./screens/Uninstalled/Uninstalled";
26-
import { ControlsProvider } from "./screens/VisualTests/ControlsContext";
27-
import { RunBuildProvider } from "./screens/VisualTests/RunBuildContext";
28-
import { VisualTests } from "./screens/VisualTests/VisualTests";
29-
import { GitInfoPayload, LocalBuildProgress, UpdateStatusFunction } from "./types";
30-
import { createClient, GraphQLClientProvider, useAccessToken } from "./utils/graphQLClient";
31-
import { TelemetryProvider } from "./utils/TelemetryContext";
32-
import { useBuildEvents } from "./utils/useBuildEvents";
33-
import { useChannelFetch } from "./utils/useChannelFetch";
34-
import { useProjectId } from "./utils/useProjectId";
35-
import { clearSessionState, useSessionState } from "./utils/useSessionState";
36-
import { useSharedState } from "./utils/useSharedState";
16+
} from './constants';
17+
import { Authentication } from './screens/Authentication/Authentication';
18+
import { GitNotFound } from './screens/Errors/GitNotFound';
19+
import { LinkedProject } from './screens/LinkProject/LinkedProject';
20+
import { LinkingProjectFailed } from './screens/LinkProject/LinkingProjectFailed';
21+
import { LinkProject } from './screens/LinkProject/LinkProject';
22+
import { NoDevServer } from './screens/NoDevServer/NoDevServer';
23+
import { NoNetwork } from './screens/NoNetwork/NoNetwork';
24+
import { UninstallProvider } from './screens/Uninstalled/UninstallContext';
25+
import { Uninstalled } from './screens/Uninstalled/Uninstalled';
26+
import { ControlsProvider } from './screens/VisualTests/ControlsContext';
27+
import { RunBuildProvider } from './screens/VisualTests/RunBuildContext';
28+
import { VisualTests } from './screens/VisualTests/VisualTests';
29+
import { GitInfoPayload, LocalBuildProgress, UpdateStatusFunction } from './types';
30+
import { createClient, GraphQLClientProvider, useAccessToken } from './utils/graphQLClient';
31+
import { TelemetryProvider } from './utils/TelemetryContext';
32+
import { useBuildEvents } from './utils/useBuildEvents';
33+
import { useChannelFetch } from './utils/useChannelFetch';
34+
import { useProjectId } from './utils/useProjectId';
35+
import { clearSessionState, useSessionState } from './utils/useSessionState';
36+
import { useSharedState } from './utils/useSharedState';
3737

3838
interface PanelProps {
3939
active: boolean;
@@ -45,7 +45,7 @@ export const Panel = ({ active, api }: PanelProps) => {
4545
const setAccessToken = useCallback(
4646
(token: string | null) => {
4747
updateAccessToken(token);
48-
if (!token) clearSessionState("authenticationScreen", "exchangeParameters");
48+
if (!token) clearSessionState('authenticationScreen', 'exchangeParameters');
4949
},
5050
[updateAccessToken]
5151
);
@@ -55,11 +55,11 @@ export const Panel = ({ active, api }: PanelProps) => {
5555
useEffect(() => {
5656
const online = () => setOnline(true);
5757
const offline = () => setOnline(false);
58-
window.addEventListener("online", online);
59-
window.addEventListener("offline", offline);
58+
window.addEventListener('online', online);
59+
window.addEventListener('offline', offline);
6060
return () => {
61-
window.removeEventListener("online", online);
62-
window.removeEventListener("offline", offline);
61+
window.removeEventListener('online', online);
62+
window.removeEventListener('offline', offline);
6363
};
6464
}, []);
6565

@@ -87,7 +87,7 @@ export const Panel = ({ active, api }: PanelProps) => {
8787
} = useProjectId();
8888

8989
// If the user creates a project in a dialog (either during login or later, it get set here)
90-
const [createdProjectId, setCreatedProjectId] = useSessionState<string>("createdProjectId");
90+
const [createdProjectId, setCreatedProjectId] = useSessionState<string>('createdProjectId');
9191
const [addonUninstalled, setAddonUninstalled] = useSharedState<boolean>(REMOVE_ADDON);
9292

9393
const trackEvent = useCallback((data: any) => emit(TELEMETRY, data), [emit]);
@@ -104,7 +104,7 @@ export const Panel = ({ active, api }: PanelProps) => {
104104
>
105105
<ControlsProvider>
106106
<RunBuildProvider watchState={{ isRunning, startBuild, stopBuild }}>
107-
<div hidden={!active} style={{ containerType: "size", height: "100%" }}>
107+
<div hidden={!active} style={{ containerType: 'size', height: '100%' }}>
108108
{children}
109109
</div>
110110
</RunBuildProvider>
@@ -119,7 +119,7 @@ export const Panel = ({ active, api }: PanelProps) => {
119119
return withProviders(null);
120120
}
121121

122-
if (globalThis.CONFIG_TYPE !== "DEVELOPMENT") {
122+
if (globalThis.CONFIG_TYPE !== 'DEVELOPMENT') {
123123
return withProviders(<NoDevServer />);
124124
}
125125

@@ -157,7 +157,6 @@ export const Panel = ({ active, api }: PanelProps) => {
157157
);
158158

159159
if (gitInfoError || !gitInfo) {
160-
// eslint-disable-next-line no-console
161160
console.error(gitInfoError);
162161
return withProviders(<GitNotFound />);
163162
}

0 commit comments

Comments
 (0)