Web: v9 storybook upgrade (#56925)

* Web: v9 storybook upgrade

* Move storybook eslint to builds package.json
This commit is contained in:
Lisa Kim
2025-07-18 14:15:48 -07:00
committed by GitHub
parent 82ba6acdea
commit 79d2827d10
48 changed files with 330 additions and 2001 deletions
+3 -9
View File
@@ -32,14 +32,8 @@
"devDependencies": {
"@gravitational/build": "workspace:*",
"@ianvs/prettier-plugin-sort-imports": "^4.4.1",
"@storybook/addon-actions": "^8.6.12",
"@storybook/addon-controls": "^8.6.12",
"@storybook/addon-toolbars": "^8.6.12",
"@storybook/components": "^8.6.12",
"@storybook/preview-api": "^8.6.12",
"@storybook/react": "^8.6.12",
"@storybook/react-vite": "^8.6.12",
"@storybook/test-runner": "^0.22.1",
"@storybook/react-vite": "^9.0.17",
"@storybook/addon-vitest": "^9.0.15",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.3.0",
"@testing-library/user-event": "^14.6.1",
@@ -62,7 +56,7 @@
"playwright": "^1.53.2",
"prettier": "^3.6.2",
"react-select-event": "^5.5.1",
"storybook": "^8.6.12",
"storybook": "^9.0.17",
"svgo": "^4.0.0",
"typescript": "^5.8.3",
"vite": "^6.3.5"
+270 -1937
View File
File diff suppressed because it is too large Load Diff
+1 -5
View File
@@ -43,11 +43,7 @@ const config: StorybookConfig = {
options: { builder: { viteConfigPath: 'web/.storybook/vite.config.mts' } },
},
staticDirs: ['public'],
addons: [
'@storybook/addon-toolbars',
'@storybook/addon-controls',
'@storybook/addon-actions',
],
addons: [],
viteFinal(config) {
return {
...config,
+1 -1
View File
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Preview } from '@storybook/react';
import { Preview } from '@storybook/react-vite';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { http, HttpResponse } from 'msw';
import { initialize, mswLoader } from 'msw-storybook-addon';
+5
View File
@@ -21,6 +21,7 @@ import jestPlugin from 'eslint-plugin-jest';
import jestDomPlugin from 'eslint-plugin-jest-dom';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import storybook from 'eslint-plugin-storybook';
import testingLibraryPlugin from 'eslint-plugin-testing-library';
import unusedImportsPlugin from 'eslint-plugin-unused-imports';
import globals from 'globals';
@@ -51,10 +52,14 @@ export default tseslint.config(
// WASM generated files
'**/ironrdp/pkg/**',
'web/packages/teleterm/build',
// allows for eslint-plugin-storybook to also lint
// configuration files inside the .storybook folder
'!.storybook',
],
},
eslint.configs.recommended,
...tseslint.configs.recommended,
...storybook.configs['flat/recommended'],
reactPlugin.configs.flat.recommended,
reactPlugin.configs.flat['jsx-runtime'],
{
+1
View File
@@ -25,6 +25,7 @@
"eslint-plugin-jest-dom": "^5.5.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-storybook": "^9.0.17",
"eslint-plugin-testing-library": "7.4.0",
"eslint-plugin-unused-imports": "^4.1.4",
"globals": "^16.3.0",
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import { Alert, AlertKind, AlertProps } from './Alert';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { action } from '@storybook/addon-actions';
import { action } from 'storybook/actions';
import { Restore } from 'design/Icon';
@@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { action } from '@storybook/addon-actions';
import { Meta, StoryFn, type StoryObj } from '@storybook/react';
import { Meta, StoryFn, type StoryObj } from '@storybook/react-vite';
import { action } from 'storybook/actions';
import styled from 'styled-components';
import { Flex, H2, Text } from 'design';
+1 -1
View File
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import styled from 'styled-components';
import Box from 'design/Box';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { StoryObj } from '@storybook/react';
import { StoryObj } from '@storybook/react-vite';
import Flex from 'design/Flex';
+1 -1
View File
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import { useState } from 'react';
import { TabBorder, TabContainer, TabsContainer } from './Tabs';
@@ -16,10 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { action } from '@storybook/addon-actions';
import { useArgs } from '@storybook/preview-api';
import type { Meta, StoryFn, StoryObj } from '@storybook/react';
import type { Meta, StoryFn, StoryObj } from '@storybook/react-vite';
import type { ReactNode } from 'react';
import { action } from 'storybook/actions';
import { useArgs } from 'storybook/preview-api';
import { Flex } from 'design';
@@ -16,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { action } from '@storybook/addon-actions';
import { useArgs } from '@storybook/preview-api';
import type { Meta, StoryFn, StoryObj } from '@storybook/react';
import type { Meta, StoryFn, StoryObj } from '@storybook/react-vite';
import { action } from 'storybook/actions';
import { useArgs } from 'storybook/preview-api';
import { Flex } from 'design';
@@ -16,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { action } from '@storybook/addon-actions';
import { useArgs } from '@storybook/preview-api';
import type { Meta, StoryFn, StoryObj } from '@storybook/react';
import type { Meta, StoryFn, StoryObj } from '@storybook/react-vite';
import { action } from 'storybook/actions';
import { useArgs } from 'storybook/preview-api';
import { Flex } from 'design';
import { ViewMode } from 'gen-proto-ts/teleport/userpreferences/v1/unified_resource_preferences_pb';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta, StoryObj } from '@storybook/react';
import { Meta, StoryObj } from '@storybook/react-vite';
import { DemoTerminal as Component } from './DemoTerminal';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import DialogConfirmation from 'design/DialogConfirmation';
import {
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import { useState } from 'react';
import { Box, ButtonPrimary } from 'design';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta, StoryObj } from '@storybook/react';
import { Meta, StoryObj } from '@storybook/react-vite';
import { MemoryRouter } from 'react-router';
import styled from 'styled-components';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta, StoryObj } from '@storybook/react';
import { Meta, StoryObj } from '@storybook/react-vite';
import { ButtonBorder, Flex } from 'design';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import { SlidingSidePanel } from 'shared/components/SlidingSidePanel';
import { InfoGuideContainer } from 'shared/components/SlidingSidePanel/InfoGuide';
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import { MemoryRouter } from 'react-router';
import {
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta, StoryObj } from '@storybook/react';
import { Meta, StoryObj } from '@storybook/react-vite';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { createMemoryHistory } from 'history';
import { MemoryRouter, Route, Router } from 'react-router';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta, StoryObj } from '@storybook/react';
import { Meta, StoryObj } from '@storybook/react-vite';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { MemoryRouter } from 'react-router';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import { DiscoverGuideId } from 'teleport/services/userPreferences/discoverPreference';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { StoryObj } from '@storybook/react';
import { StoryObj } from '@storybook/react-vite';
import { delay, http, HttpResponse } from 'msw';
import { PropsWithChildren } from 'react';
import { withoutQuery } from 'web/packages/build/storybook';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { StoryObj } from '@storybook/react';
import { StoryObj } from '@storybook/react-vite';
import { delay, http, HttpResponse } from 'msw';
import { PropsWithChildren } from 'react';
import { withoutQuery } from 'web/packages/build/storybook';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import { createMemoryHistory } from 'history';
import { Flex } from 'design';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { StoryObj } from '@storybook/react';
import { StoryObj } from '@storybook/react-vite';
import { delay, http, HttpResponse } from 'msw';
import { useEffect, useState } from 'react';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import { MemoryRouter } from 'react-router';
import { Flex, Stack, Text } from 'design';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import type { StoryObj } from '@storybook/react';
import type { StoryObj } from '@storybook/react-vite';
import { delay } from 'msw';
import type { TraitsOption } from 'shared/components/TraitsEditor';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import type { StoryObj } from '@storybook/react';
import type { StoryObj } from '@storybook/react-vite';
import { delay } from 'msw';
import { TeleportProviderBasic } from 'teleport/mocks/providers';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import { useEffect, useState } from 'react';
import { Attempt } from 'shared/hooks/useAttemptNext';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import type { StoryObj } from '@storybook/react';
import type { StoryObj } from '@storybook/react-vite';
import { delay } from 'msw';
import { TeleportProviderBasic } from 'teleport/mocks/providers';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import { useState } from 'react';
import Box from 'design/Box';
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import { makeErrorAttempt, makeProcessingAttempt } from 'shared/hooks/useAsync';
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import {
makeApp,
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { ArgTypes } from '@storybook/react';
import { ArgTypes } from '@storybook/react-vite';
import { FC, PropsWithChildren } from 'react';
import Dialog from 'design/Dialog';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import { wait } from 'shared/utils/wait';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import { Box, Flex, Text } from 'design';
import { HoverTooltip } from 'design/Tooltip';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import { ComponentProps } from 'react';
import {
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import { Flex } from 'design';
import { usePromiseRejectedOnUnmount, wait } from 'shared/utils/wait';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import { makeRootCluster } from 'teleterm/services/tshd/testHelpers';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import { createRef } from 'react';
import { makeRootCluster } from 'teleterm/services/tshd/testHelpers';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import { useLayoutEffect } from 'react';
import { Flex, Text } from 'design';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import { PropsWithChildren, useEffect } from 'react';
import { Box } from 'design';
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta } from '@storybook/react';
import { Meta } from '@storybook/react-vite';
import { makeRootCluster } from 'teleterm/services/tshd/testHelpers';
import { MockAppContextProvider } from 'teleterm/ui/fixtures/MockAppContextProvider';
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Meta, StoryObj } from '@storybook/react';
import { Meta, StoryObj } from '@storybook/react-vite';
import { useEffect } from 'react';
import { Box } from 'design';