From 746448e57c789b5eaae879eb71a25b8fd8c07020 Mon Sep 17 00:00:00 2001 From: jang_yoonsu Date: Mon, 22 Apr 2024 23:13:01 +0900 Subject: [PATCH 01/86] Fix error message handling final slash in title --- code/lib/manager-api/src/lib/stories.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/code/lib/manager-api/src/lib/stories.ts b/code/lib/manager-api/src/lib/stories.ts index 9d6b1817e677..368edacc598a 100644 --- a/code/lib/manager-api/src/lib/stories.ts +++ b/code/lib/manager-api/src/lib/stories.ts @@ -194,13 +194,7 @@ export const transformStoryIndexToStoriesHash = ( const id = sanitize(parent ? `${parent}-${name}` : name!); if (parent === id) { - throw new Error( - dedent` - Invalid part '${name}', leading to id === parentId ('${id}'), inside title '${title}' - - Did you create a path that uses the separator char accidentally, such as 'Vue ' where '/' is a separator char? See https://github.com/storybookjs/storybook/issues/6128 - ` - ); + throw new Error(dedent`Invalid title ${title} ending in slash.`); } list.push(id); return list; From 80144601f69d338f9b2df552de47916277bd98f9 Mon Sep 17 00:00:00 2001 From: jang_yoonsu Date: Sat, 4 May 2024 20:12:57 +0900 Subject: [PATCH 02/86] fix: clarify error messaging for title validation in path generation --- code/lib/manager-api/src/lib/stories.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/code/lib/manager-api/src/lib/stories.ts b/code/lib/manager-api/src/lib/stories.ts index 368edacc598a..3569cd29756e 100644 --- a/code/lib/manager-api/src/lib/stories.ts +++ b/code/lib/manager-api/src/lib/stories.ts @@ -193,9 +193,19 @@ export const transformStoryIndexToStoriesHash = ( const parent = idx > 0 && list[idx - 1]; const id = sanitize(parent ? `${parent}-${name}` : name!); - if (parent === id) { + if (name.trim() === '') { throw new Error(dedent`Invalid title ${title} ending in slash.`); } + + if (parent === id) { + throw new Error( + dedent` + Invalid part '${name}', leading to id === parentId ('${id}'), inside title '${title}' + + Did you create a path that uses the separator char accidentally, such as 'Vue ' where '/' is a separator char? See https://github.com/storybookjs/storybook/issues/6128 + ` + ); + } list.push(id); return list; }, [] as string[]); From 310015d9b2f343c177a9664501c75e5ce84a66e4 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 2 Jul 2024 15:51:04 +0200 Subject: [PATCH 03/86] wip --- .vscode/settings.json | 12 +++++++++++- code/.eslintrc.js | 7 +++++++ code/builders/builder-webpack5/src/demo.ts | 5 +++++ code/builders/builder-webpack5/tsconfig.json | 17 +++++++++++++++-- code/core/src/demo.ts | 5 +++++ code/core/src/types/index.ts | 2 ++ code/core/tsconfig.json | 7 ++++++- code/lib/cli/core/types/index.d.ts | 2 ++ code/package.json | 1 + code/yarn.lock | 8 ++++++++ scripts/eslint-plugin-local-rules/index.js | 1 + .../storybook-monorepo-imports.js | 18 ++++++++++++++++++ 12 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 code/builders/builder-webpack5/src/demo.ts create mode 100644 code/core/src/demo.ts create mode 100644 scripts/eslint-plugin-local-rules/storybook-monorepo-imports.js diff --git a/.vscode/settings.json b/.vscode/settings.json index 153d5a3d72b0..e0e731b3072e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -51,5 +51,15 @@ }, "prettier.ignorePath": "./code/.prettierignore", "typescript.tsdk": "./code/node_modules/typescript/lib", - "storyExplorer.storybookConfigDir": "./code/ui/.storybook" + "storyExplorer.storybookConfigDir": "./code/.storybook", + "javascript.preferences.importModuleSpecifier": "project-relative", + "js/ts.implicitProjectConfig.target": "ESNext", + "typescript.format.enable": false, + "typescript.preferences.importModuleSpecifier": "project-relative", + "javascript.preferences.quoteStyle": "single", + "typescript.preferences.preferTypeOnlyAutoImports": true, + "typescript.preferences.quoteStyle": "single", + "typescript.preferGoToSourceDefinition": true, + + } \ No newline at end of file diff --git a/code/.eslintrc.js b/code/.eslintrc.js index fbe9539ad32f..8a41ae78db14 100644 --- a/code/.eslintrc.js +++ b/code/.eslintrc.js @@ -208,6 +208,13 @@ module.exports = { 'local-rules/no-uncategorized-errors': 'warn', }, }, + { + files: ['**/*.ts', '!**/*.test.*', '!**/*.spec.*'], + excludedFiles: ['**/*.test.*'], + rules: { + 'local-rules/storybook-monorepo-imports': 'error', + }, + }, { files: ['**/core-events/src/**/*'], excludedFiles: ['**/*.test.*'], diff --git a/code/builders/builder-webpack5/src/demo.ts b/code/builders/builder-webpack5/src/demo.ts new file mode 100644 index 000000000000..17ea47389e76 --- /dev/null +++ b/code/builders/builder-webpack5/src/demo.ts @@ -0,0 +1,5 @@ +import { VALENTINE } from '@storybook/core/types'; + +const x = VALENTINE; + +const y = STORY_; diff --git a/code/builders/builder-webpack5/tsconfig.json b/code/builders/builder-webpack5/tsconfig.json index 5b3f3a56a68d..eee4223fecef 100644 --- a/code/builders/builder-webpack5/tsconfig.json +++ b/code/builders/builder-webpack5/tsconfig.json @@ -2,7 +2,20 @@ "extends": "../../tsconfig.json", "compilerOptions": { "strict": true, - "skipLibCheck": true + "skipLibCheck": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + // "@storybook/core/*": ["./"] + }, + // "plugins": [ + // { + // "name": "ts-plugin-sort-import-suggestions", + // "moveUpPatterns": ["storybook/internal"], + // "moveDownPatterns": ["@storybook/core"], + // } + // ] }, - "include": ["src/**/*"] + "include": ["src/**/*"], + // "exclude": ["code/core/**", "**/code/core/**", "../../**/core/**", "@storybook/core"] } diff --git a/code/core/src/demo.ts b/code/core/src/demo.ts new file mode 100644 index 000000000000..3362f81e061d --- /dev/null +++ b/code/core/src/demo.ts @@ -0,0 +1,5 @@ +// import { STORY_ERRORED } from '@storybook/core/core-events'; + +const x = STORY_ERRO; + +throw new Error('bla'); diff --git a/code/core/src/types/index.ts b/code/core/src/types/index.ts index 1941cbe86872..39fa756d719b 100644 --- a/code/core/src/types/index.ts +++ b/code/core/src/types/index.ts @@ -13,3 +13,5 @@ export * from './modules/composedStory'; export * from './modules/channelApi'; export * from './modules/frameworks'; export * from './modules/renderers'; + +export const VALENTINE = '💖'; diff --git a/code/core/tsconfig.json b/code/core/tsconfig.json index abdc7834b511..73a81a433dec 100644 --- a/code/core/tsconfig.json +++ b/code/core/tsconfig.json @@ -7,7 +7,12 @@ "moduleResolution": "Bundler", "resolveJsonModule": true, "target": "ES2022", - "module": "ES2022" + "module": "ES2022", + "baseUrl": ".", + "paths": { + // "storybook/internal/*": ["./src/*"], + "@storybook/core/*": ["./src/*"] + } }, "include": ["src/**/*", "scripts/**/*", "*.d.ts"] } diff --git a/code/lib/cli/core/types/index.d.ts b/code/lib/cli/core/types/index.d.ts index 8a3c5408f17d..aa474b9f5a04 100644 --- a/code/lib/cli/core/types/index.d.ts +++ b/code/lib/cli/core/types/index.d.ts @@ -1,2 +1,4 @@ export * from '@storybook/core/types'; export type * from '@storybook/core/types'; + +// export const VALENTINE = '💖'; diff --git a/code/package.json b/code/package.json index 112c922640d5..09f1b405796a 100644 --- a/code/package.json +++ b/code/package.json @@ -203,6 +203,7 @@ "storybook": "workspace:^", "svelte": "^5.0.0-next.65", "ts-dedent": "^2.0.0", + "ts-plugin-sort-import-suggestions": "^1.0.4", "typescript": "^5.4.3", "util": "^0.12.4", "vite": "^4.0.0", diff --git a/code/yarn.lock b/code/yarn.lock index d1d7d566a177..c7e301e46e6b 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -6557,6 +6557,7 @@ __metadata: storybook: "workspace:^" svelte: "npm:^5.0.0-next.65" ts-dedent: "npm:^2.0.0" + ts-plugin-sort-import-suggestions: "npm:^1.0.4" typescript: "npm:^5.4.3" util: "npm:^0.12.4" vite: "npm:^4.0.0" @@ -26718,6 +26719,13 @@ __metadata: languageName: node linkType: hard +"ts-plugin-sort-import-suggestions@npm:^1.0.4": + version: 1.0.4 + resolution: "ts-plugin-sort-import-suggestions@npm:1.0.4" + checksum: 10c0/1817bdba9861b934af6aeb9403703047041e1944aadf91fde2dfc4ddcc3913bc48570eead52defb34622de94b68488b47e79492da304a6ca604c9a097b2dbe2d + languageName: node + linkType: hard + "ts-pnp@npm:^1.1.6": version: 1.2.0 resolution: "ts-pnp@npm:1.2.0" diff --git a/scripts/eslint-plugin-local-rules/index.js b/scripts/eslint-plugin-local-rules/index.js index 50e3a567fb6c..e78a30dc784b 100644 --- a/scripts/eslint-plugin-local-rules/index.js +++ b/scripts/eslint-plugin-local-rules/index.js @@ -2,5 +2,6 @@ module.exports = { rules: { 'no-uncategorized-errors': require('./no-uncategorized-errors'), 'no-duplicated-error-codes': require('./no-duplicated-error-codes'), + 'storybook-monorepo-imports': require('./storybook-monorepo-imports'), }, }; diff --git a/scripts/eslint-plugin-local-rules/storybook-monorepo-imports.js b/scripts/eslint-plugin-local-rules/storybook-monorepo-imports.js new file mode 100644 index 000000000000..eb47edb9fee7 --- /dev/null +++ b/scripts/eslint-plugin-local-rules/storybook-monorepo-imports.js @@ -0,0 +1,18 @@ +module.exports = { + meta: { + type: 'problem', + docs: { + description: 'Ensure the imports-paths of packages in the monorepo is correct', + category: 'Best Practices', + recommended: true, + }, + fixable: 'code', + }, + fix: function (fixer) { + console.log('FIX'); + }, + create(context) { + console.log('CREATE'); + return {}; + }, +}; From d20eab73d02709f631162eeeedf7cc4af80c5d12 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 2 Jul 2024 20:03:28 +0200 Subject: [PATCH 04/86] make fixable and importable --- .vscode/settings.json | 12 +++--- code/addons/a11y/tsconfig.json | 6 ++- code/addons/actions/tsconfig.json | 6 ++- code/addons/backgrounds/tsconfig.json | 6 ++- code/addons/controls/tsconfig.json | 6 ++- code/addons/docs/tsconfig.json | 6 ++- code/addons/essentials/tsconfig.json | 6 ++- code/addons/gfm/tsconfig.json | 6 ++- code/addons/highlight/tsconfig.json | 6 ++- code/addons/interactions/tsconfig.json | 6 ++- code/addons/jest/tsconfig.json | 6 ++- code/addons/links/tsconfig.json | 6 ++- code/addons/measure/tsconfig.json | 6 ++- code/addons/onboarding/tsconfig.json | 6 ++- code/addons/outline/tsconfig.json | 6 ++- code/addons/storysource/tsconfig.json | 6 ++- code/addons/themes/tsconfig.json | 6 ++- code/addons/toolbars/tsconfig.json | 6 ++- code/addons/viewport/tsconfig.json | 6 ++- code/builders/builder-vite/tsconfig.json | 6 ++- code/builders/builder-webpack5/src/demo.ts | 5 --- code/builders/builder-webpack5/tsconfig.json | 11 +---- code/core/src/demo.ts | 5 --- code/frameworks/angular/tsconfig.build.json | 6 ++- code/frameworks/ember/tsconfig.json | 6 ++- code/frameworks/html-vite/tsconfig.json | 6 ++- code/frameworks/html-webpack5/tsconfig.json | 6 ++- code/frameworks/nextjs/tsconfig.json | 6 ++- code/frameworks/preact-vite/tsconfig.json | 6 ++- code/frameworks/preact-webpack5/tsconfig.json | 6 ++- code/frameworks/react-vite/tsconfig.json | 6 ++- code/frameworks/react-webpack5/tsconfig.json | 6 ++- code/frameworks/server-webpack5/tsconfig.json | 6 ++- code/frameworks/svelte-vite/tsconfig.json | 6 ++- code/frameworks/svelte-webpack5/tsconfig.json | 6 ++- code/frameworks/sveltekit/tsconfig.json | 6 ++- code/frameworks/vue3-vite/tsconfig.json | 6 ++- code/frameworks/vue3-webpack5/tsconfig.json | 6 ++- .../web-components-vite/tsconfig.json | 6 ++- .../web-components-webpack5/tsconfig.json | 6 ++- code/lib/blocks/src/blocks/Source.tsx | 4 +- code/lib/blocks/tsconfig.json | 6 ++- code/lib/cli/tsconfig.json | 6 ++- code/lib/codemod/tsconfig.json | 6 ++- code/lib/core-webpack/tsconfig.json | 6 ++- code/lib/csf-plugin/tsconfig.json | 6 ++- code/lib/instrumenter/tsconfig.json | 6 ++- code/lib/react-dom-shim/tsconfig.json | 6 ++- code/lib/source-loader/tsconfig.json | 6 ++- code/lib/test/tsconfig.json | 9 +++- code/presets/create-react-app/tsconfig.json | 6 ++- code/presets/html-webpack/tsconfig.json | 6 ++- code/presets/preact-webpack/tsconfig.json | 6 ++- code/presets/react-webpack/tsconfig.json | 6 ++- code/presets/server-webpack/tsconfig.json | 6 ++- code/presets/svelte-webpack/tsconfig.json | 6 ++- code/presets/vue3-webpack/tsconfig.json | 6 ++- code/renderers/html/tsconfig.json | 6 ++- code/renderers/preact/tsconfig.json | 6 ++- code/renderers/react/tsconfig.json | 6 ++- code/renderers/server/tsconfig.json | 6 ++- code/renderers/svelte/tsconfig.json | 6 ++- code/renderers/vue3/tsconfig.json | 6 ++- code/renderers/web-components/tsconfig.json | 6 ++- .../storybook-monorepo-imports.js | 41 ++++++++++++++++--- 65 files changed, 342 insertions(+), 93 deletions(-) delete mode 100644 code/builders/builder-webpack5/src/demo.ts delete mode 100644 code/core/src/demo.ts diff --git a/.vscode/settings.json b/.vscode/settings.json index e0e731b3072e..0e868eb99e6a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,8 +18,8 @@ "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit" }, - "editor.tabSize": 2, "editor.formatOnSave": true, + "editor.tabSize": 2, "eslint.format.enable": true, "eslint.options": { "cache": true, @@ -49,17 +49,15 @@ "files.associations": { "*.js": "javascriptreact" }, - "prettier.ignorePath": "./code/.prettierignore", - "typescript.tsdk": "./code/node_modules/typescript/lib", - "storyExplorer.storybookConfigDir": "./code/.storybook", "javascript.preferences.importModuleSpecifier": "project-relative", + "javascript.preferences.quoteStyle": "single", "js/ts.implicitProjectConfig.target": "ESNext", + "prettier.ignorePath": "./code/.prettierignore", + "storyExplorer.storybookConfigDir": "./code/.storybook", "typescript.format.enable": false, "typescript.preferences.importModuleSpecifier": "project-relative", - "javascript.preferences.quoteStyle": "single", "typescript.preferences.preferTypeOnlyAutoImports": true, "typescript.preferences.quoteStyle": "single", "typescript.preferGoToSourceDefinition": true, - - + "typescript.tsdk": "./code/node_modules/typescript/lib" } \ No newline at end of file diff --git a/code/addons/a11y/tsconfig.json b/code/addons/a11y/tsconfig.json index 1dc5a72190bd..bf6b4a62f30b 100644 --- a/code/addons/a11y/tsconfig.json +++ b/code/addons/a11y/tsconfig.json @@ -2,7 +2,11 @@ "extends": "../../tsconfig.json", "compilerOptions": { "skipLibCheck": true, - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/addons/actions/tsconfig.json b/code/addons/actions/tsconfig.json index a4429176e35f..ab6a3c179a1c 100644 --- a/code/addons/actions/tsconfig.json +++ b/code/addons/actions/tsconfig.json @@ -1,7 +1,11 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/addons/backgrounds/tsconfig.json b/code/addons/backgrounds/tsconfig.json index b5a2f9a70918..dd4669189ef8 100644 --- a/code/addons/backgrounds/tsconfig.json +++ b/code/addons/backgrounds/tsconfig.json @@ -2,6 +2,10 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } } } diff --git a/code/addons/controls/tsconfig.json b/code/addons/controls/tsconfig.json index a4429176e35f..ab6a3c179a1c 100644 --- a/code/addons/controls/tsconfig.json +++ b/code/addons/controls/tsconfig.json @@ -1,7 +1,11 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/addons/docs/tsconfig.json b/code/addons/docs/tsconfig.json index 1dc5a72190bd..bf6b4a62f30b 100644 --- a/code/addons/docs/tsconfig.json +++ b/code/addons/docs/tsconfig.json @@ -2,7 +2,11 @@ "extends": "../../tsconfig.json", "compilerOptions": { "skipLibCheck": true, - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/addons/essentials/tsconfig.json b/code/addons/essentials/tsconfig.json index a4429176e35f..ab6a3c179a1c 100644 --- a/code/addons/essentials/tsconfig.json +++ b/code/addons/essentials/tsconfig.json @@ -1,7 +1,11 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/addons/gfm/tsconfig.json b/code/addons/gfm/tsconfig.json index 1dc5a72190bd..bf6b4a62f30b 100644 --- a/code/addons/gfm/tsconfig.json +++ b/code/addons/gfm/tsconfig.json @@ -2,7 +2,11 @@ "extends": "../../tsconfig.json", "compilerOptions": { "skipLibCheck": true, - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/addons/highlight/tsconfig.json b/code/addons/highlight/tsconfig.json index e0354bb7bcc7..c3ed69f1c0ca 100644 --- a/code/addons/highlight/tsconfig.json +++ b/code/addons/highlight/tsconfig.json @@ -2,7 +2,11 @@ "extends": "../../tsconfig.json", "compilerOptions": { "types": ["webpack-env"], - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/addons/interactions/tsconfig.json b/code/addons/interactions/tsconfig.json index a6f65038a17b..fc27f50e7aef 100644 --- a/code/addons/interactions/tsconfig.json +++ b/code/addons/interactions/tsconfig.json @@ -2,7 +2,11 @@ "extends": "../../tsconfig.json", "compilerOptions": { "skipLibCheck": true, - "strict": false + "strict": false, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/addons/jest/tsconfig.json b/code/addons/jest/tsconfig.json index a4429176e35f..ab6a3c179a1c 100644 --- a/code/addons/jest/tsconfig.json +++ b/code/addons/jest/tsconfig.json @@ -1,7 +1,11 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/addons/links/tsconfig.json b/code/addons/links/tsconfig.json index 5b3f3a56a68d..6cab664e04f2 100644 --- a/code/addons/links/tsconfig.json +++ b/code/addons/links/tsconfig.json @@ -2,7 +2,11 @@ "extends": "../../tsconfig.json", "compilerOptions": { "strict": true, - "skipLibCheck": true + "skipLibCheck": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/addons/measure/tsconfig.json b/code/addons/measure/tsconfig.json index b5a2f9a70918..dd4669189ef8 100644 --- a/code/addons/measure/tsconfig.json +++ b/code/addons/measure/tsconfig.json @@ -2,6 +2,10 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } } } diff --git a/code/addons/onboarding/tsconfig.json b/code/addons/onboarding/tsconfig.json index a4429176e35f..ab6a3c179a1c 100644 --- a/code/addons/onboarding/tsconfig.json +++ b/code/addons/onboarding/tsconfig.json @@ -1,7 +1,11 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/addons/outline/tsconfig.json b/code/addons/outline/tsconfig.json index b5a2f9a70918..dd4669189ef8 100644 --- a/code/addons/outline/tsconfig.json +++ b/code/addons/outline/tsconfig.json @@ -2,6 +2,10 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } } } diff --git a/code/addons/storysource/tsconfig.json b/code/addons/storysource/tsconfig.json index 1dc5a72190bd..bf6b4a62f30b 100644 --- a/code/addons/storysource/tsconfig.json +++ b/code/addons/storysource/tsconfig.json @@ -2,7 +2,11 @@ "extends": "../../tsconfig.json", "compilerOptions": { "skipLibCheck": true, - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/addons/themes/tsconfig.json b/code/addons/themes/tsconfig.json index b5a2f9a70918..dd4669189ef8 100644 --- a/code/addons/themes/tsconfig.json +++ b/code/addons/themes/tsconfig.json @@ -2,6 +2,10 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } } } diff --git a/code/addons/toolbars/tsconfig.json b/code/addons/toolbars/tsconfig.json index a4429176e35f..ab6a3c179a1c 100644 --- a/code/addons/toolbars/tsconfig.json +++ b/code/addons/toolbars/tsconfig.json @@ -1,7 +1,11 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/addons/viewport/tsconfig.json b/code/addons/viewport/tsconfig.json index b5a2f9a70918..dd4669189ef8 100644 --- a/code/addons/viewport/tsconfig.json +++ b/code/addons/viewport/tsconfig.json @@ -2,6 +2,10 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } } } diff --git a/code/builders/builder-vite/tsconfig.json b/code/builders/builder-vite/tsconfig.json index d3576aa8f726..9980bc7405fe 100644 --- a/code/builders/builder-vite/tsconfig.json +++ b/code/builders/builder-vite/tsconfig.json @@ -3,7 +3,11 @@ "compilerOptions": { "strict": true, "resolveJsonModule": true, - "skipLibCheck": true + "skipLibCheck": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/builders/builder-webpack5/src/demo.ts b/code/builders/builder-webpack5/src/demo.ts deleted file mode 100644 index 17ea47389e76..000000000000 --- a/code/builders/builder-webpack5/src/demo.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { VALENTINE } from '@storybook/core/types'; - -const x = VALENTINE; - -const y = STORY_; diff --git a/code/builders/builder-webpack5/tsconfig.json b/code/builders/builder-webpack5/tsconfig.json index eee4223fecef..46b7715c6818 100644 --- a/code/builders/builder-webpack5/tsconfig.json +++ b/code/builders/builder-webpack5/tsconfig.json @@ -6,16 +6,7 @@ "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"], - // "@storybook/core/*": ["./"] - }, - // "plugins": [ - // { - // "name": "ts-plugin-sort-import-suggestions", - // "moveUpPatterns": ["storybook/internal"], - // "moveDownPatterns": ["@storybook/core"], - // } - // ] + } }, "include": ["src/**/*"], - // "exclude": ["code/core/**", "**/code/core/**", "../../**/core/**", "@storybook/core"] } diff --git a/code/core/src/demo.ts b/code/core/src/demo.ts deleted file mode 100644 index 3362f81e061d..000000000000 --- a/code/core/src/demo.ts +++ /dev/null @@ -1,5 +0,0 @@ -// import { STORY_ERRORED } from '@storybook/core/core-events'; - -const x = STORY_ERRO; - -throw new Error('bla'); diff --git a/code/frameworks/angular/tsconfig.build.json b/code/frameworks/angular/tsconfig.build.json index 75efd9abab35..4fa1e6969ae3 100644 --- a/code/frameworks/angular/tsconfig.build.json +++ b/code/frameworks/angular/tsconfig.build.json @@ -16,7 +16,11 @@ "pretty": true, "noErrorTruncation": true, "listEmittedFiles": false, - "noUnusedLocals": false + "noUnusedLocals": false, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*", "src/**/*.json"] } diff --git a/code/frameworks/ember/tsconfig.json b/code/frameworks/ember/tsconfig.json index 77832da6336d..700cb8335a96 100644 --- a/code/frameworks/ember/tsconfig.json +++ b/code/frameworks/ember/tsconfig.json @@ -2,7 +2,11 @@ "extends": "../../tsconfig.json", "compilerOptions": { "strict": true, - "resolveJsonModule": true + "resolveJsonModule": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/frameworks/html-vite/tsconfig.json b/code/frameworks/html-vite/tsconfig.json index 145cb7320607..e1f6529ff503 100644 --- a/code/frameworks/html-vite/tsconfig.json +++ b/code/frameworks/html-vite/tsconfig.json @@ -4,7 +4,11 @@ "rootDir": "./src", "types": ["node"], "resolveJsonModule": true, - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"], "exclude": ["src/**/*.test.*", "src/**/__testfixtures__/**"] diff --git a/code/frameworks/html-webpack5/tsconfig.json b/code/frameworks/html-webpack5/tsconfig.json index a4429176e35f..ab6a3c179a1c 100644 --- a/code/frameworks/html-webpack5/tsconfig.json +++ b/code/frameworks/html-webpack5/tsconfig.json @@ -1,7 +1,11 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/frameworks/nextjs/tsconfig.json b/code/frameworks/nextjs/tsconfig.json index 26be65113f88..5b1aa3dfffe7 100644 --- a/code/frameworks/nextjs/tsconfig.json +++ b/code/frameworks/nextjs/tsconfig.json @@ -3,7 +3,11 @@ "compilerOptions": { "strict": true, "resolveJsonModule": true, - "skipLibCheck": true + "skipLibCheck": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*", "template/**/*"] } diff --git a/code/frameworks/preact-vite/tsconfig.json b/code/frameworks/preact-vite/tsconfig.json index 4f493067c0f5..c1c960bdd5c5 100644 --- a/code/frameworks/preact-vite/tsconfig.json +++ b/code/frameworks/preact-vite/tsconfig.json @@ -6,7 +6,11 @@ "resolveJsonModule": true, "jsx": "react-jsx", "jsxImportSource": "preact", - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/frameworks/preact-webpack5/tsconfig.json b/code/frameworks/preact-webpack5/tsconfig.json index 77832da6336d..700cb8335a96 100644 --- a/code/frameworks/preact-webpack5/tsconfig.json +++ b/code/frameworks/preact-webpack5/tsconfig.json @@ -2,7 +2,11 @@ "extends": "../../tsconfig.json", "compilerOptions": { "strict": true, - "resolveJsonModule": true + "resolveJsonModule": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/frameworks/react-vite/tsconfig.json b/code/frameworks/react-vite/tsconfig.json index 3bfb79fdded7..5c3c7e4fd62c 100644 --- a/code/frameworks/react-vite/tsconfig.json +++ b/code/frameworks/react-vite/tsconfig.json @@ -4,7 +4,11 @@ "rootDir": "./src", "types": ["node"], "resolveJsonModule": true, - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/frameworks/react-webpack5/tsconfig.json b/code/frameworks/react-webpack5/tsconfig.json index 77832da6336d..700cb8335a96 100644 --- a/code/frameworks/react-webpack5/tsconfig.json +++ b/code/frameworks/react-webpack5/tsconfig.json @@ -2,7 +2,11 @@ "extends": "../../tsconfig.json", "compilerOptions": { "strict": true, - "resolveJsonModule": true + "resolveJsonModule": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/frameworks/server-webpack5/tsconfig.json b/code/frameworks/server-webpack5/tsconfig.json index a4429176e35f..ab6a3c179a1c 100644 --- a/code/frameworks/server-webpack5/tsconfig.json +++ b/code/frameworks/server-webpack5/tsconfig.json @@ -1,7 +1,11 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/frameworks/svelte-vite/tsconfig.json b/code/frameworks/svelte-vite/tsconfig.json index 3bfb79fdded7..5c3c7e4fd62c 100644 --- a/code/frameworks/svelte-vite/tsconfig.json +++ b/code/frameworks/svelte-vite/tsconfig.json @@ -4,7 +4,11 @@ "rootDir": "./src", "types": ["node"], "resolveJsonModule": true, - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/frameworks/svelte-webpack5/tsconfig.json b/code/frameworks/svelte-webpack5/tsconfig.json index 77832da6336d..700cb8335a96 100644 --- a/code/frameworks/svelte-webpack5/tsconfig.json +++ b/code/frameworks/svelte-webpack5/tsconfig.json @@ -2,7 +2,11 @@ "extends": "../../tsconfig.json", "compilerOptions": { "strict": true, - "resolveJsonModule": true + "resolveJsonModule": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/frameworks/sveltekit/tsconfig.json b/code/frameworks/sveltekit/tsconfig.json index 3bfb79fdded7..5c3c7e4fd62c 100644 --- a/code/frameworks/sveltekit/tsconfig.json +++ b/code/frameworks/sveltekit/tsconfig.json @@ -4,7 +4,11 @@ "rootDir": "./src", "types": ["node"], "resolveJsonModule": true, - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/frameworks/vue3-vite/tsconfig.json b/code/frameworks/vue3-vite/tsconfig.json index bbd5d9a38f99..439f0f47ad33 100644 --- a/code/frameworks/vue3-vite/tsconfig.json +++ b/code/frameworks/vue3-vite/tsconfig.json @@ -5,7 +5,11 @@ "types": ["node"], "skipLibCheck": true, "resolveJsonModule": true, - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/frameworks/vue3-webpack5/tsconfig.json b/code/frameworks/vue3-webpack5/tsconfig.json index a7475d986d4d..dbe8fbcd1702 100644 --- a/code/frameworks/vue3-webpack5/tsconfig.json +++ b/code/frameworks/vue3-webpack5/tsconfig.json @@ -3,7 +3,11 @@ "compilerOptions": { "resolveJsonModule": true, "skipLibCheck": true, - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/frameworks/web-components-vite/tsconfig.json b/code/frameworks/web-components-vite/tsconfig.json index 3bfb79fdded7..5c3c7e4fd62c 100644 --- a/code/frameworks/web-components-vite/tsconfig.json +++ b/code/frameworks/web-components-vite/tsconfig.json @@ -4,7 +4,11 @@ "rootDir": "./src", "types": ["node"], "resolveJsonModule": true, - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/frameworks/web-components-webpack5/tsconfig.json b/code/frameworks/web-components-webpack5/tsconfig.json index a4429176e35f..ab6a3c179a1c 100644 --- a/code/frameworks/web-components-webpack5/tsconfig.json +++ b/code/frameworks/web-components-webpack5/tsconfig.json @@ -1,7 +1,11 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/lib/blocks/src/blocks/Source.tsx b/code/lib/blocks/src/blocks/Source.tsx index 9c68b8a058ab..fda733fc8a5b 100644 --- a/code/lib/blocks/src/blocks/Source.tsx +++ b/code/lib/blocks/src/blocks/Source.tsx @@ -1,7 +1,7 @@ import type { ComponentProps, FC } from 'react'; import React, { useContext } from 'react'; -import type { StoryId, PreparedStory, ModuleExport, Args } from '@storybook/core/types'; -import { SourceType } from '@storybook/core/docs-tools'; +import type { StoryId, PreparedStory, ModuleExport, Args } from 'storybook/internal/types'; +import { SourceType } from 'storybook/internal/docs-tools'; import type { SourceCodeProps } from '../components/Source'; import { Source as PureSource, SourceError } from '../components/Source'; diff --git a/code/lib/blocks/tsconfig.json b/code/lib/blocks/tsconfig.json index 061b6a531157..5e293a7b8fac 100644 --- a/code/lib/blocks/tsconfig.json +++ b/code/lib/blocks/tsconfig.json @@ -4,7 +4,11 @@ "module": "esnext", "skipLibCheck": true, "rootDir": "./src", - "strict": false + "strict": false, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/lib/cli/tsconfig.json b/code/lib/cli/tsconfig.json index 9c5db279ca2d..b761a5d21447 100644 --- a/code/lib/cli/tsconfig.json +++ b/code/lib/cli/tsconfig.json @@ -5,7 +5,11 @@ "strict": true, "skipLibCheck": true, "resolveJsonModule": true, - "noEmit": true + "noEmit": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/lib/codemod/tsconfig.json b/code/lib/codemod/tsconfig.json index 77d9af2cd661..583e2d37fbe9 100644 --- a/code/lib/codemod/tsconfig.json +++ b/code/lib/codemod/tsconfig.json @@ -3,7 +3,11 @@ "compilerOptions": { "skipLibCheck": true, "allowJs": true, - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"], "exclude": ["node_modules", "__testfixtures__", "__tests__"] diff --git a/code/lib/core-webpack/tsconfig.json b/code/lib/core-webpack/tsconfig.json index a4429176e35f..ab6a3c179a1c 100644 --- a/code/lib/core-webpack/tsconfig.json +++ b/code/lib/core-webpack/tsconfig.json @@ -1,7 +1,11 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/lib/csf-plugin/tsconfig.json b/code/lib/csf-plugin/tsconfig.json index 5b3f3a56a68d..6cab664e04f2 100644 --- a/code/lib/csf-plugin/tsconfig.json +++ b/code/lib/csf-plugin/tsconfig.json @@ -2,7 +2,11 @@ "extends": "../../tsconfig.json", "compilerOptions": { "strict": true, - "skipLibCheck": true + "skipLibCheck": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/lib/instrumenter/tsconfig.json b/code/lib/instrumenter/tsconfig.json index b5a2f9a70918..dd4669189ef8 100644 --- a/code/lib/instrumenter/tsconfig.json +++ b/code/lib/instrumenter/tsconfig.json @@ -2,6 +2,10 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } } } diff --git a/code/lib/react-dom-shim/tsconfig.json b/code/lib/react-dom-shim/tsconfig.json index 7378641b0d33..b8ecaeae3779 100644 --- a/code/lib/react-dom-shim/tsconfig.json +++ b/code/lib/react-dom-shim/tsconfig.json @@ -2,7 +2,11 @@ "extends": "../../tsconfig.json", "compilerOptions": { "strict": true, - "types": ["node"] + "types": ["node"], + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/lib/source-loader/tsconfig.json b/code/lib/source-loader/tsconfig.json index b5a2f9a70918..dd4669189ef8 100644 --- a/code/lib/source-loader/tsconfig.json +++ b/code/lib/source-loader/tsconfig.json @@ -2,6 +2,10 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } } } diff --git a/code/lib/test/tsconfig.json b/code/lib/test/tsconfig.json index 52d43eaaa9b9..dd4669189ef8 100644 --- a/code/lib/test/tsconfig.json +++ b/code/lib/test/tsconfig.json @@ -1,4 +1,11 @@ { "extends": "../../tsconfig.json", - "include": ["src/**/*"] + "include": ["src/**/*"], + "compilerOptions": { + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } + } } diff --git a/code/presets/create-react-app/tsconfig.json b/code/presets/create-react-app/tsconfig.json index a4429176e35f..ab6a3c179a1c 100644 --- a/code/presets/create-react-app/tsconfig.json +++ b/code/presets/create-react-app/tsconfig.json @@ -1,7 +1,11 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/presets/html-webpack/tsconfig.json b/code/presets/html-webpack/tsconfig.json index a4429176e35f..ab6a3c179a1c 100644 --- a/code/presets/html-webpack/tsconfig.json +++ b/code/presets/html-webpack/tsconfig.json @@ -1,7 +1,11 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/presets/preact-webpack/tsconfig.json b/code/presets/preact-webpack/tsconfig.json index 77832da6336d..700cb8335a96 100644 --- a/code/presets/preact-webpack/tsconfig.json +++ b/code/presets/preact-webpack/tsconfig.json @@ -2,7 +2,11 @@ "extends": "../../tsconfig.json", "compilerOptions": { "strict": true, - "resolveJsonModule": true + "resolveJsonModule": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/presets/react-webpack/tsconfig.json b/code/presets/react-webpack/tsconfig.json index 77832da6336d..700cb8335a96 100644 --- a/code/presets/react-webpack/tsconfig.json +++ b/code/presets/react-webpack/tsconfig.json @@ -2,7 +2,11 @@ "extends": "../../tsconfig.json", "compilerOptions": { "strict": true, - "resolveJsonModule": true + "resolveJsonModule": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/presets/server-webpack/tsconfig.json b/code/presets/server-webpack/tsconfig.json index a4429176e35f..ab6a3c179a1c 100644 --- a/code/presets/server-webpack/tsconfig.json +++ b/code/presets/server-webpack/tsconfig.json @@ -1,7 +1,11 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/presets/svelte-webpack/tsconfig.json b/code/presets/svelte-webpack/tsconfig.json index 77832da6336d..700cb8335a96 100644 --- a/code/presets/svelte-webpack/tsconfig.json +++ b/code/presets/svelte-webpack/tsconfig.json @@ -2,7 +2,11 @@ "extends": "../../tsconfig.json", "compilerOptions": { "strict": true, - "resolveJsonModule": true + "resolveJsonModule": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/presets/vue3-webpack/tsconfig.json b/code/presets/vue3-webpack/tsconfig.json index a7475d986d4d..dbe8fbcd1702 100644 --- a/code/presets/vue3-webpack/tsconfig.json +++ b/code/presets/vue3-webpack/tsconfig.json @@ -3,7 +3,11 @@ "compilerOptions": { "resolveJsonModule": true, "skipLibCheck": true, - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*"] } diff --git a/code/renderers/html/tsconfig.json b/code/renderers/html/tsconfig.json index daa7b13b26b2..d69c545df1ab 100644 --- a/code/renderers/html/tsconfig.json +++ b/code/renderers/html/tsconfig.json @@ -1,7 +1,11 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*", "template/**/*"] } diff --git a/code/renderers/preact/tsconfig.json b/code/renderers/preact/tsconfig.json index bd6414b1a14d..a303608a05db 100644 --- a/code/renderers/preact/tsconfig.json +++ b/code/renderers/preact/tsconfig.json @@ -2,7 +2,11 @@ "extends": "../../tsconfig.json", "compilerOptions": { "strict": true, - "resolveJsonModule": true + "resolveJsonModule": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*", "template/**/*"] } diff --git a/code/renderers/react/tsconfig.json b/code/renderers/react/tsconfig.json index 357b84b3ab23..3dc361340c07 100644 --- a/code/renderers/react/tsconfig.json +++ b/code/renderers/react/tsconfig.json @@ -4,7 +4,11 @@ "strict": true, "skipLibCheck": true, "resolveJsonModule": true, - "allowJs": true + "allowJs": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*", "template/**/*"] } diff --git a/code/renderers/server/tsconfig.json b/code/renderers/server/tsconfig.json index e5b6521be93e..c8e4d360fcfb 100644 --- a/code/renderers/server/tsconfig.json +++ b/code/renderers/server/tsconfig.json @@ -2,6 +2,10 @@ "extends": "../../tsconfig.json", "include": ["src/**/*", "template/**/*"], "compilerOptions": { - "strict": false + "strict": false, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } } } diff --git a/code/renderers/svelte/tsconfig.json b/code/renderers/svelte/tsconfig.json index 95355eedfc5a..97bded06d465 100644 --- a/code/renderers/svelte/tsconfig.json +++ b/code/renderers/svelte/tsconfig.json @@ -4,7 +4,11 @@ "module": "ESNext", "skipLibCheck": true, "strict": true, - "resolveJsonModule": true + "resolveJsonModule": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*", "src/**/*.svelte", "template/**/*", "template/**/*.svelte"] } diff --git a/code/renderers/vue3/tsconfig.json b/code/renderers/vue3/tsconfig.json index d5b59e915abb..e5e8770d3912 100644 --- a/code/renderers/vue3/tsconfig.json +++ b/code/renderers/vue3/tsconfig.json @@ -4,7 +4,11 @@ "strict": true, "resolveJsonModule": true, "skipLibCheck": true, - "allowJs": true + "allowJs": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "vueCompilerOptions": { "target": 3 diff --git a/code/renderers/web-components/tsconfig.json b/code/renderers/web-components/tsconfig.json index d5dc307ae91d..9caee813f9af 100644 --- a/code/renderers/web-components/tsconfig.json +++ b/code/renderers/web-components/tsconfig.json @@ -2,7 +2,11 @@ "extends": "../../tsconfig.json", "compilerOptions": { "resolveJsonModule": true, - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "storybook/internal/*": ["../../lib/cli/core/*"], + } }, "include": ["src/**/*", "template/**/*"] } diff --git a/scripts/eslint-plugin-local-rules/storybook-monorepo-imports.js b/scripts/eslint-plugin-local-rules/storybook-monorepo-imports.js index eb47edb9fee7..ee29e6d9f641 100644 --- a/scripts/eslint-plugin-local-rules/storybook-monorepo-imports.js +++ b/scripts/eslint-plugin-local-rules/storybook-monorepo-imports.js @@ -1,3 +1,6 @@ +const path = require('path'); +const cache = {}; + module.exports = { meta: { type: 'problem', @@ -8,11 +11,39 @@ module.exports = { }, fixable: 'code', }, - fix: function (fixer) { - console.log('FIX'); - }, create(context) { - console.log('CREATE'); - return {}; + return { + ImportDeclaration: (node) => { + const fileName = context.getPhysicalFilename(); + const isInCLI = !!fileName.includes(path.join('code', 'lib', 'cli')); + const isInCore = !!fileName.includes(path.join('code', 'core')); + + if (node.source.value.startsWith('@storybook/core/') && !isInCLI && !isInCore) { + const newPath = node.source.value + .replace('@storybook/core', 'storybook/internal') + .replace('/src', ''); + context.report({ + node: node, + message: `Cannot import from @storybook/core in this package. Use storybook/internal instead.`, + fix: (fixer) => { + return fixer.replaceText(node.source, `'${newPath}'`); + }, + }); + } + + if (node.source.value.startsWith('storybook/internal/') && isInCore) { + const newPath = node.source.value + .replace('storybook/internal', '@storybook/core') + .replace('/src', ''); + context.report({ + node: node, + message: `Cannot import from storybook/internal in this package. Use @storybook/core instead.`, + fix: (fixer) => { + return fixer.replaceText(node.source, `'${newPath}'`); + }, + }); + } + }, + }; }, }; From 76d8da3bbc5069c4f04c8a684b5dd71cc0411fb6 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 2 Jul 2024 20:19:13 +0200 Subject: [PATCH 05/86] cleanup tsconfig.json --- code/addons/a11y/tsconfig.json | 12 ++++--- code/addons/actions/tsconfig.json | 11 +++--- code/addons/backgrounds/tsconfig.json | 13 ++++--- code/addons/controls/tsconfig.json | 9 +++-- code/addons/docs/tsconfig.json | 10 +++--- code/addons/essentials/tsconfig.json | 9 +++-- code/addons/gfm/tsconfig.json | 10 +++--- code/addons/highlight/tsconfig.json | 12 ++++--- code/addons/interactions/tsconfig.json | 10 +++--- code/addons/jest/tsconfig.json | 9 +++-- code/addons/links/tsconfig.json | 6 ++-- code/addons/measure/tsconfig.json | 4 +-- code/addons/onboarding/tsconfig.json | 9 +++-- code/addons/outline/tsconfig.json | 4 +-- code/addons/storysource/tsconfig.json | 10 +++--- code/addons/themes/tsconfig.json | 4 +-- code/addons/toolbars/tsconfig.json | 9 +++-- code/addons/viewport/tsconfig.json | 4 +-- code/builders/builder-vite/tsconfig.json | 7 ++-- code/builders/builder-webpack5/tsconfig.json | 6 ++-- .../src/common/utils/interpret-require.ts | 2 +- code/core/tsconfig.build.json | 5 ++- code/core/tsconfig.check.json | 5 ++- code/core/tsconfig.json | 5 ++- code/frameworks/angular/tsconfig.build.json | 2 +- code/frameworks/ember/tsconfig.json | 10 +++--- code/frameworks/html-vite/tsconfig.json | 5 ++- code/frameworks/html-webpack5/tsconfig.json | 9 +++-- code/frameworks/nextjs/tsconfig.json | 7 ++-- code/frameworks/preact-vite/tsconfig.json | 5 ++- code/frameworks/preact-webpack5/tsconfig.json | 10 +++--- code/frameworks/react-vite/tsconfig.json | 5 ++- code/frameworks/react-webpack5/tsconfig.json | 10 +++--- code/frameworks/server-webpack5/tsconfig.json | 9 +++-- code/frameworks/svelte-vite/tsconfig.json | 5 ++- code/frameworks/svelte-webpack5/tsconfig.json | 10 +++--- code/frameworks/sveltekit/tsconfig.json | 5 ++- code/frameworks/vue3-vite/tsconfig.json | 7 ++-- code/frameworks/vue3-webpack5/tsconfig.json | 11 +++--- .../web-components-vite/tsconfig.json | 5 ++- .../web-components-webpack5/tsconfig.json | 9 +++-- code/lib/blocks/tsconfig.json | 4 +-- code/lib/cli/tsconfig.json | 7 ++-- code/lib/codemod/tsconfig.json | 18 ++++++---- code/lib/core-webpack/tsconfig.json | 9 +++-- code/lib/csf-plugin/tsconfig.json | 6 ++-- code/lib/instrumenter/tsconfig.json | 4 +-- code/lib/react-dom-shim/tsconfig.json | 4 +-- code/lib/source-loader/tsconfig.json | 4 +-- code/lib/test/tsconfig.json | 4 +-- code/presets/create-react-app/tsconfig.json | 9 +++-- code/presets/html-webpack/tsconfig.json | 9 +++-- code/presets/preact-webpack/tsconfig.json | 10 +++--- code/presets/react-webpack/tsconfig.json | 10 +++--- code/presets/server-webpack/tsconfig.json | 9 +++-- code/presets/svelte-webpack/tsconfig.json | 10 +++--- code/presets/vue3-webpack/tsconfig.json | 11 +++--- code/renderers/html/tsconfig.json | 10 ++++-- code/renderers/preact/tsconfig.json | 11 +++--- code/renderers/react/tsconfig.json | 12 ++++--- code/renderers/server/tsconfig.json | 14 +++++--- code/renderers/svelte/tsconfig.json | 7 ++-- code/renderers/vue3/tsconfig.json | 18 ++++++---- code/renderers/web-components/tsconfig.json | 11 +++--- code/tsconfig.json | 35 ++++++++++++------- 65 files changed, 322 insertions(+), 233 deletions(-) diff --git a/code/addons/a11y/tsconfig.json b/code/addons/a11y/tsconfig.json index bf6b4a62f30b..b5ee1de46797 100644 --- a/code/addons/a11y/tsconfig.json +++ b/code/addons/a11y/tsconfig.json @@ -1,12 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "skipLibCheck": true, - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] -} + "include": [ + "src/**/*" + ] +} \ No newline at end of file diff --git a/code/addons/actions/tsconfig.json b/code/addons/actions/tsconfig.json index ab6a3c179a1c..b5ee1de46797 100644 --- a/code/addons/actions/tsconfig.json +++ b/code/addons/actions/tsconfig.json @@ -1,11 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] -} + "include": [ + "src/**/*" + ] +} \ No newline at end of file diff --git a/code/addons/backgrounds/tsconfig.json b/code/addons/backgrounds/tsconfig.json index dd4669189ef8..b5ee1de46797 100644 --- a/code/addons/backgrounds/tsconfig.json +++ b/code/addons/backgrounds/tsconfig.json @@ -1,11 +1,14 @@ { "extends": "../../tsconfig.json", - "include": ["src/**/*"], "compilerOptions": { - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } - } -} + }, + "include": [ + "src/**/*" + ] +} \ No newline at end of file diff --git a/code/addons/controls/tsconfig.json b/code/addons/controls/tsconfig.json index ab6a3c179a1c..a447bb9b0331 100644 --- a/code/addons/controls/tsconfig.json +++ b/code/addons/controls/tsconfig.json @@ -1,11 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/addons/docs/tsconfig.json b/code/addons/docs/tsconfig.json index bf6b4a62f30b..a447bb9b0331 100644 --- a/code/addons/docs/tsconfig.json +++ b/code/addons/docs/tsconfig.json @@ -1,12 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "skipLibCheck": true, - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/addons/essentials/tsconfig.json b/code/addons/essentials/tsconfig.json index ab6a3c179a1c..a447bb9b0331 100644 --- a/code/addons/essentials/tsconfig.json +++ b/code/addons/essentials/tsconfig.json @@ -1,11 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/addons/gfm/tsconfig.json b/code/addons/gfm/tsconfig.json index bf6b4a62f30b..a447bb9b0331 100644 --- a/code/addons/gfm/tsconfig.json +++ b/code/addons/gfm/tsconfig.json @@ -1,12 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "skipLibCheck": true, - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/addons/highlight/tsconfig.json b/code/addons/highlight/tsconfig.json index c3ed69f1c0ca..b5ee1de46797 100644 --- a/code/addons/highlight/tsconfig.json +++ b/code/addons/highlight/tsconfig.json @@ -1,12 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "types": ["webpack-env"], - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] -} + "include": [ + "src/**/*" + ] +} \ No newline at end of file diff --git a/code/addons/interactions/tsconfig.json b/code/addons/interactions/tsconfig.json index fc27f50e7aef..a447bb9b0331 100644 --- a/code/addons/interactions/tsconfig.json +++ b/code/addons/interactions/tsconfig.json @@ -1,12 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "skipLibCheck": true, - "strict": false, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/addons/jest/tsconfig.json b/code/addons/jest/tsconfig.json index ab6a3c179a1c..a447bb9b0331 100644 --- a/code/addons/jest/tsconfig.json +++ b/code/addons/jest/tsconfig.json @@ -1,11 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/addons/links/tsconfig.json b/code/addons/links/tsconfig.json index 6cab664e04f2..a84636449555 100644 --- a/code/addons/links/tsconfig.json +++ b/code/addons/links/tsconfig.json @@ -1,11 +1,11 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "skipLibCheck": true, + + "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } }, "include": ["src/**/*"] diff --git a/code/addons/measure/tsconfig.json b/code/addons/measure/tsconfig.json index dd4669189ef8..5d3a4e53d2f6 100644 --- a/code/addons/measure/tsconfig.json +++ b/code/addons/measure/tsconfig.json @@ -2,10 +2,10 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "strict": true, + "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } } } diff --git a/code/addons/onboarding/tsconfig.json b/code/addons/onboarding/tsconfig.json index ab6a3c179a1c..a447bb9b0331 100644 --- a/code/addons/onboarding/tsconfig.json +++ b/code/addons/onboarding/tsconfig.json @@ -1,11 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/addons/outline/tsconfig.json b/code/addons/outline/tsconfig.json index dd4669189ef8..5d3a4e53d2f6 100644 --- a/code/addons/outline/tsconfig.json +++ b/code/addons/outline/tsconfig.json @@ -2,10 +2,10 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "strict": true, + "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } } } diff --git a/code/addons/storysource/tsconfig.json b/code/addons/storysource/tsconfig.json index bf6b4a62f30b..a447bb9b0331 100644 --- a/code/addons/storysource/tsconfig.json +++ b/code/addons/storysource/tsconfig.json @@ -1,12 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "skipLibCheck": true, - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/addons/themes/tsconfig.json b/code/addons/themes/tsconfig.json index dd4669189ef8..5d3a4e53d2f6 100644 --- a/code/addons/themes/tsconfig.json +++ b/code/addons/themes/tsconfig.json @@ -2,10 +2,10 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "strict": true, + "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } } } diff --git a/code/addons/toolbars/tsconfig.json b/code/addons/toolbars/tsconfig.json index ab6a3c179a1c..a447bb9b0331 100644 --- a/code/addons/toolbars/tsconfig.json +++ b/code/addons/toolbars/tsconfig.json @@ -1,11 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/addons/viewport/tsconfig.json b/code/addons/viewport/tsconfig.json index dd4669189ef8..5d3a4e53d2f6 100644 --- a/code/addons/viewport/tsconfig.json +++ b/code/addons/viewport/tsconfig.json @@ -2,10 +2,10 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "strict": true, + "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } } } diff --git a/code/builders/builder-vite/tsconfig.json b/code/builders/builder-vite/tsconfig.json index 9980bc7405fe..a84636449555 100644 --- a/code/builders/builder-vite/tsconfig.json +++ b/code/builders/builder-vite/tsconfig.json @@ -1,12 +1,11 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "resolveJsonModule": true, - "skipLibCheck": true, + + "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } }, "include": ["src/**/*"] diff --git a/code/builders/builder-webpack5/tsconfig.json b/code/builders/builder-webpack5/tsconfig.json index 46b7715c6818..4fe3a6934e78 100644 --- a/code/builders/builder-webpack5/tsconfig.json +++ b/code/builders/builder-webpack5/tsconfig.json @@ -1,11 +1,11 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "skipLibCheck": true, + + "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } }, "include": ["src/**/*"], diff --git a/code/core/src/common/utils/interpret-require.ts b/code/core/src/common/utils/interpret-require.ts index 9ecbd240a1f4..b8171ebc2b50 100644 --- a/code/core/src/common/utils/interpret-require.ts +++ b/code/core/src/common/utils/interpret-require.ts @@ -19,7 +19,7 @@ export function interopRequireDefault(filePath: string) { tsconfigRaw: `{ "compilerOptions": { "strict": false, - "skipLibCheck": true, + }, }`, }); diff --git a/code/core/tsconfig.build.json b/code/core/tsconfig.build.json index 6ba36add8129..45c25a297d34 100644 --- a/code/core/tsconfig.build.json +++ b/code/core/tsconfig.build.json @@ -1,11 +1,10 @@ { "extends": "../tsconfig.json", "compilerOptions": { - "skipLibCheck": true, - "strict": true, + + "skipDefaultLibCheck": true, "moduleResolution": "Bundler", - "resolveJsonModule": true, "rootDir": ".", "target": "ES2022", "module": "ES2022" diff --git a/code/core/tsconfig.check.json b/code/core/tsconfig.check.json index 91a2ee6744ba..1eb4fe3cf1d8 100644 --- a/code/core/tsconfig.check.json +++ b/code/core/tsconfig.check.json @@ -1,11 +1,10 @@ { "extends": "../tsconfig.json", "compilerOptions": { - "skipLibCheck": true, - "strict": true, + + "skipDefaultLibCheck": true, "moduleResolution": "Bundler", - "resolveJsonModule": true, "target": "ES2022", "module": "ES2022" }, diff --git a/code/core/tsconfig.json b/code/core/tsconfig.json index 73a81a433dec..33af4607d922 100644 --- a/code/core/tsconfig.json +++ b/code/core/tsconfig.json @@ -1,11 +1,10 @@ { "extends": "../tsconfig.json", "compilerOptions": { - "skipLibCheck": true, - "strict": true, + + "skipDefaultLibCheck": true, "moduleResolution": "Bundler", - "resolveJsonModule": true, "target": "ES2022", "module": "ES2022", "baseUrl": ".", diff --git a/code/frameworks/angular/tsconfig.build.json b/code/frameworks/angular/tsconfig.build.json index 4fa1e6969ae3..56df86958588 100644 --- a/code/frameworks/angular/tsconfig.build.json +++ b/code/frameworks/angular/tsconfig.build.json @@ -19,7 +19,7 @@ "noUnusedLocals": false, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } }, "include": ["src/**/*", "src/**/*.json"] diff --git a/code/frameworks/ember/tsconfig.json b/code/frameworks/ember/tsconfig.json index 700cb8335a96..a447bb9b0331 100644 --- a/code/frameworks/ember/tsconfig.json +++ b/code/frameworks/ember/tsconfig.json @@ -1,12 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "resolveJsonModule": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/frameworks/html-vite/tsconfig.json b/code/frameworks/html-vite/tsconfig.json index e1f6529ff503..a855e78d4f0e 100644 --- a/code/frameworks/html-vite/tsconfig.json +++ b/code/frameworks/html-vite/tsconfig.json @@ -3,11 +3,10 @@ "compilerOptions": { "rootDir": "./src", "types": ["node"], - "resolveJsonModule": true, - "strict": true, + "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } }, "include": ["src/**/*"], diff --git a/code/frameworks/html-webpack5/tsconfig.json b/code/frameworks/html-webpack5/tsconfig.json index ab6a3c179a1c..a447bb9b0331 100644 --- a/code/frameworks/html-webpack5/tsconfig.json +++ b/code/frameworks/html-webpack5/tsconfig.json @@ -1,11 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/frameworks/nextjs/tsconfig.json b/code/frameworks/nextjs/tsconfig.json index 5b1aa3dfffe7..c2b2cbeef86e 100644 --- a/code/frameworks/nextjs/tsconfig.json +++ b/code/frameworks/nextjs/tsconfig.json @@ -1,12 +1,11 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "resolveJsonModule": true, - "skipLibCheck": true, + + "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } }, "include": ["src/**/*", "template/**/*"] diff --git a/code/frameworks/preact-vite/tsconfig.json b/code/frameworks/preact-vite/tsconfig.json index c1c960bdd5c5..4bfdfb0b0ebc 100644 --- a/code/frameworks/preact-vite/tsconfig.json +++ b/code/frameworks/preact-vite/tsconfig.json @@ -3,13 +3,12 @@ "compilerOptions": { "rootDir": "./src", "types": ["node"], - "resolveJsonModule": true, "jsx": "react-jsx", "jsxImportSource": "preact", - "strict": true, + "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } }, "include": ["src/**/*"] diff --git a/code/frameworks/preact-webpack5/tsconfig.json b/code/frameworks/preact-webpack5/tsconfig.json index 700cb8335a96..a447bb9b0331 100644 --- a/code/frameworks/preact-webpack5/tsconfig.json +++ b/code/frameworks/preact-webpack5/tsconfig.json @@ -1,12 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "resolveJsonModule": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/frameworks/react-vite/tsconfig.json b/code/frameworks/react-vite/tsconfig.json index 5c3c7e4fd62c..65c2a458c1a5 100644 --- a/code/frameworks/react-vite/tsconfig.json +++ b/code/frameworks/react-vite/tsconfig.json @@ -3,11 +3,10 @@ "compilerOptions": { "rootDir": "./src", "types": ["node"], - "resolveJsonModule": true, - "strict": true, + "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } }, "include": ["src/**/*"] diff --git a/code/frameworks/react-webpack5/tsconfig.json b/code/frameworks/react-webpack5/tsconfig.json index 700cb8335a96..a447bb9b0331 100644 --- a/code/frameworks/react-webpack5/tsconfig.json +++ b/code/frameworks/react-webpack5/tsconfig.json @@ -1,12 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "resolveJsonModule": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/frameworks/server-webpack5/tsconfig.json b/code/frameworks/server-webpack5/tsconfig.json index ab6a3c179a1c..a447bb9b0331 100644 --- a/code/frameworks/server-webpack5/tsconfig.json +++ b/code/frameworks/server-webpack5/tsconfig.json @@ -1,11 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/frameworks/svelte-vite/tsconfig.json b/code/frameworks/svelte-vite/tsconfig.json index 5c3c7e4fd62c..65c2a458c1a5 100644 --- a/code/frameworks/svelte-vite/tsconfig.json +++ b/code/frameworks/svelte-vite/tsconfig.json @@ -3,11 +3,10 @@ "compilerOptions": { "rootDir": "./src", "types": ["node"], - "resolveJsonModule": true, - "strict": true, + "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } }, "include": ["src/**/*"] diff --git a/code/frameworks/svelte-webpack5/tsconfig.json b/code/frameworks/svelte-webpack5/tsconfig.json index 700cb8335a96..a447bb9b0331 100644 --- a/code/frameworks/svelte-webpack5/tsconfig.json +++ b/code/frameworks/svelte-webpack5/tsconfig.json @@ -1,12 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "resolveJsonModule": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/frameworks/sveltekit/tsconfig.json b/code/frameworks/sveltekit/tsconfig.json index 5c3c7e4fd62c..65c2a458c1a5 100644 --- a/code/frameworks/sveltekit/tsconfig.json +++ b/code/frameworks/sveltekit/tsconfig.json @@ -3,11 +3,10 @@ "compilerOptions": { "rootDir": "./src", "types": ["node"], - "resolveJsonModule": true, - "strict": true, + "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } }, "include": ["src/**/*"] diff --git a/code/frameworks/vue3-vite/tsconfig.json b/code/frameworks/vue3-vite/tsconfig.json index 439f0f47ad33..a9d1292735ed 100644 --- a/code/frameworks/vue3-vite/tsconfig.json +++ b/code/frameworks/vue3-vite/tsconfig.json @@ -3,12 +3,11 @@ "compilerOptions": { "rootDir": "./src", "types": ["node"], - "skipLibCheck": true, - "resolveJsonModule": true, - "strict": true, + + "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } }, "include": ["src/**/*"] diff --git a/code/frameworks/vue3-webpack5/tsconfig.json b/code/frameworks/vue3-webpack5/tsconfig.json index dbe8fbcd1702..a447bb9b0331 100644 --- a/code/frameworks/vue3-webpack5/tsconfig.json +++ b/code/frameworks/vue3-webpack5/tsconfig.json @@ -1,13 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "resolveJsonModule": true, - "skipLibCheck": true, - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/frameworks/web-components-vite/tsconfig.json b/code/frameworks/web-components-vite/tsconfig.json index 5c3c7e4fd62c..65c2a458c1a5 100644 --- a/code/frameworks/web-components-vite/tsconfig.json +++ b/code/frameworks/web-components-vite/tsconfig.json @@ -3,11 +3,10 @@ "compilerOptions": { "rootDir": "./src", "types": ["node"], - "resolveJsonModule": true, - "strict": true, + "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } }, "include": ["src/**/*"] diff --git a/code/frameworks/web-components-webpack5/tsconfig.json b/code/frameworks/web-components-webpack5/tsconfig.json index ab6a3c179a1c..a447bb9b0331 100644 --- a/code/frameworks/web-components-webpack5/tsconfig.json +++ b/code/frameworks/web-components-webpack5/tsconfig.json @@ -1,11 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/lib/blocks/tsconfig.json b/code/lib/blocks/tsconfig.json index 5e293a7b8fac..366385927d05 100644 --- a/code/lib/blocks/tsconfig.json +++ b/code/lib/blocks/tsconfig.json @@ -2,12 +2,10 @@ "extends": "../../tsconfig.json", "compilerOptions": { "module": "esnext", - "skipLibCheck": true, "rootDir": "./src", - "strict": false, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } }, "include": ["src/**/*"] diff --git a/code/lib/cli/tsconfig.json b/code/lib/cli/tsconfig.json index b761a5d21447..b0b45928772f 100644 --- a/code/lib/cli/tsconfig.json +++ b/code/lib/cli/tsconfig.json @@ -2,13 +2,12 @@ "extends": "../../tsconfig.json", "compilerOptions": { "types": ["node"], - "strict": true, - "skipLibCheck": true, - "resolveJsonModule": true, + + "noEmit": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } }, "include": ["src/**/*"] diff --git a/code/lib/codemod/tsconfig.json b/code/lib/codemod/tsconfig.json index 583e2d37fbe9..8463318cdf9f 100644 --- a/code/lib/codemod/tsconfig.json +++ b/code/lib/codemod/tsconfig.json @@ -1,14 +1,20 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "skipLibCheck": true, "allowJs": true, - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"], - "exclude": ["node_modules", "__testfixtures__", "__tests__"] -} + "exclude": [ + "node_modules", + "__testfixtures__", + "__tests__" + ], + "include": [ + "src/**/*" + ] +} \ No newline at end of file diff --git a/code/lib/core-webpack/tsconfig.json b/code/lib/core-webpack/tsconfig.json index ab6a3c179a1c..a447bb9b0331 100644 --- a/code/lib/core-webpack/tsconfig.json +++ b/code/lib/core-webpack/tsconfig.json @@ -1,11 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/lib/csf-plugin/tsconfig.json b/code/lib/csf-plugin/tsconfig.json index 6cab664e04f2..a84636449555 100644 --- a/code/lib/csf-plugin/tsconfig.json +++ b/code/lib/csf-plugin/tsconfig.json @@ -1,11 +1,11 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "skipLibCheck": true, + + "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } }, "include": ["src/**/*"] diff --git a/code/lib/instrumenter/tsconfig.json b/code/lib/instrumenter/tsconfig.json index dd4669189ef8..5d3a4e53d2f6 100644 --- a/code/lib/instrumenter/tsconfig.json +++ b/code/lib/instrumenter/tsconfig.json @@ -2,10 +2,10 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "strict": true, + "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } } } diff --git a/code/lib/react-dom-shim/tsconfig.json b/code/lib/react-dom-shim/tsconfig.json index b8ecaeae3779..a630f412e8d5 100644 --- a/code/lib/react-dom-shim/tsconfig.json +++ b/code/lib/react-dom-shim/tsconfig.json @@ -1,11 +1,11 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, + "types": ["node"], "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } }, "include": ["src/**/*"] diff --git a/code/lib/source-loader/tsconfig.json b/code/lib/source-loader/tsconfig.json index dd4669189ef8..5d3a4e53d2f6 100644 --- a/code/lib/source-loader/tsconfig.json +++ b/code/lib/source-loader/tsconfig.json @@ -2,10 +2,10 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "strict": true, + "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } } } diff --git a/code/lib/test/tsconfig.json b/code/lib/test/tsconfig.json index dd4669189ef8..5d3a4e53d2f6 100644 --- a/code/lib/test/tsconfig.json +++ b/code/lib/test/tsconfig.json @@ -2,10 +2,10 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "strict": true, + "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } } } diff --git a/code/presets/create-react-app/tsconfig.json b/code/presets/create-react-app/tsconfig.json index ab6a3c179a1c..a447bb9b0331 100644 --- a/code/presets/create-react-app/tsconfig.json +++ b/code/presets/create-react-app/tsconfig.json @@ -1,11 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/presets/html-webpack/tsconfig.json b/code/presets/html-webpack/tsconfig.json index ab6a3c179a1c..a447bb9b0331 100644 --- a/code/presets/html-webpack/tsconfig.json +++ b/code/presets/html-webpack/tsconfig.json @@ -1,11 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/presets/preact-webpack/tsconfig.json b/code/presets/preact-webpack/tsconfig.json index 700cb8335a96..a447bb9b0331 100644 --- a/code/presets/preact-webpack/tsconfig.json +++ b/code/presets/preact-webpack/tsconfig.json @@ -1,12 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "resolveJsonModule": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/presets/react-webpack/tsconfig.json b/code/presets/react-webpack/tsconfig.json index 700cb8335a96..a447bb9b0331 100644 --- a/code/presets/react-webpack/tsconfig.json +++ b/code/presets/react-webpack/tsconfig.json @@ -1,12 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "resolveJsonModule": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/presets/server-webpack/tsconfig.json b/code/presets/server-webpack/tsconfig.json index ab6a3c179a1c..a447bb9b0331 100644 --- a/code/presets/server-webpack/tsconfig.json +++ b/code/presets/server-webpack/tsconfig.json @@ -1,11 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/presets/svelte-webpack/tsconfig.json b/code/presets/svelte-webpack/tsconfig.json index 700cb8335a96..a447bb9b0331 100644 --- a/code/presets/svelte-webpack/tsconfig.json +++ b/code/presets/svelte-webpack/tsconfig.json @@ -1,12 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "resolveJsonModule": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/presets/vue3-webpack/tsconfig.json b/code/presets/vue3-webpack/tsconfig.json index dbe8fbcd1702..a447bb9b0331 100644 --- a/code/presets/vue3-webpack/tsconfig.json +++ b/code/presets/vue3-webpack/tsconfig.json @@ -1,13 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "resolveJsonModule": true, - "skipLibCheck": true, - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } diff --git a/code/renderers/html/tsconfig.json b/code/renderers/html/tsconfig.json index d69c545df1ab..e9c2245a73ea 100644 --- a/code/renderers/html/tsconfig.json +++ b/code/renderers/html/tsconfig.json @@ -1,11 +1,15 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*", "template/**/*"] + "include": [ + "src/**/*", + "template/**/*" + ] } diff --git a/code/renderers/preact/tsconfig.json b/code/renderers/preact/tsconfig.json index a303608a05db..e9c2245a73ea 100644 --- a/code/renderers/preact/tsconfig.json +++ b/code/renderers/preact/tsconfig.json @@ -1,12 +1,15 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "resolveJsonModule": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*", "template/**/*"] + "include": [ + "src/**/*", + "template/**/*" + ] } diff --git a/code/renderers/react/tsconfig.json b/code/renderers/react/tsconfig.json index 3dc361340c07..d8c2c384f8c0 100644 --- a/code/renderers/react/tsconfig.json +++ b/code/renderers/react/tsconfig.json @@ -1,14 +1,16 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "skipLibCheck": true, - "resolveJsonModule": true, "allowJs": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*", "template/**/*"] + "include": [ + "src/**/*", + "template/**/*" + ] } diff --git a/code/renderers/server/tsconfig.json b/code/renderers/server/tsconfig.json index c8e4d360fcfb..8bc369c99fa1 100644 --- a/code/renderers/server/tsconfig.json +++ b/code/renderers/server/tsconfig.json @@ -1,11 +1,15 @@ { "extends": "../../tsconfig.json", - "include": ["src/**/*", "template/**/*"], "compilerOptions": { - "strict": false, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } - } -} + }, + "include": [ + "src/**/*", + "template/**/*" + ] +} \ No newline at end of file diff --git a/code/renderers/svelte/tsconfig.json b/code/renderers/svelte/tsconfig.json index 97bded06d465..4f47dc0fbcf8 100644 --- a/code/renderers/svelte/tsconfig.json +++ b/code/renderers/svelte/tsconfig.json @@ -2,12 +2,11 @@ "extends": "../../tsconfig.json", "compilerOptions": { "module": "ESNext", - "skipLibCheck": true, - "strict": true, - "resolveJsonModule": true, + + "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": ["../../lib/cli/core/*"] } }, "include": ["src/**/*", "src/**/*.svelte", "template/**/*", "template/**/*.svelte"] diff --git a/code/renderers/vue3/tsconfig.json b/code/renderers/vue3/tsconfig.json index e5e8770d3912..a3e93921921b 100644 --- a/code/renderers/vue3/tsconfig.json +++ b/code/renderers/vue3/tsconfig.json @@ -1,17 +1,21 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true, - "resolveJsonModule": true, - "skipLibCheck": true, "allowJs": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, + "include": [ + "src/**/*", + "src/**/*.vue", + "template/**/*", + "template/**/*.vue" + ], "vueCompilerOptions": { "target": 3 - }, - "include": ["src/**/*", "src/**/*.vue", "template/**/*", "template/**/*.vue"] -} + } +} \ No newline at end of file diff --git a/code/renderers/web-components/tsconfig.json b/code/renderers/web-components/tsconfig.json index 9caee813f9af..e9c2245a73ea 100644 --- a/code/renderers/web-components/tsconfig.json +++ b/code/renderers/web-components/tsconfig.json @@ -1,12 +1,15 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "resolveJsonModule": true, - "strict": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*", "template/**/*"] + "include": [ + "src/**/*", + "template/**/*" + ] } diff --git a/code/tsconfig.json b/code/tsconfig.json index 800b83594d3a..4b44860d18d3 100644 --- a/code/tsconfig.json +++ b/code/tsconfig.json @@ -1,23 +1,32 @@ { "compileOnSave": false, "compilerOptions": { - "ignoreDeprecations": "5.0", + "allowSyntheticDefaultImports": true, "baseUrl": ".", - "incremental": false, - "noImplicitAny": true, + "esModuleInterop": true, "forceConsistentCasingInFileNames": true, + "ignoreDeprecations": "5.0", + "incremental": false, + "isolatedModules": true, "jsx": "react", - "moduleResolution": "Node", - "target": "ES2020", + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "module": "CommonJS", + "moduleResolution": "Node", + "noImplicitAny": true, + "noUnusedLocals": true, "skipLibCheck": true, - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "isolatedModules": true, + "strict": true, "strictBindCallApply": true, - "lib": ["dom", "dom.iterable", "esnext"], - "noUnusedLocals": true, - "strict": true + "target": "ES2020" }, - "exclude": ["dist", "**/dist", "node_modules", "**/node_modules"] -} + "exclude": [ + "dist", + "**/dist", + "node_modules", + "**/node_modules" + ] +} \ No newline at end of file From 7325f9611b14a44a38db77cb4df0b7ab4a36a339 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 2 Jul 2024 20:21:59 +0200 Subject: [PATCH 06/86] cleanup --- code/core/src/types/index.ts | 2 -- code/lib/cli/core/types/index.d.ts | 2 -- 2 files changed, 4 deletions(-) diff --git a/code/core/src/types/index.ts b/code/core/src/types/index.ts index 39fa756d719b..1941cbe86872 100644 --- a/code/core/src/types/index.ts +++ b/code/core/src/types/index.ts @@ -13,5 +13,3 @@ export * from './modules/composedStory'; export * from './modules/channelApi'; export * from './modules/frameworks'; export * from './modules/renderers'; - -export const VALENTINE = '💖'; diff --git a/code/lib/cli/core/types/index.d.ts b/code/lib/cli/core/types/index.d.ts index aa474b9f5a04..8a3c5408f17d 100644 --- a/code/lib/cli/core/types/index.d.ts +++ b/code/lib/cli/core/types/index.d.ts @@ -1,4 +1,2 @@ export * from '@storybook/core/types'; export type * from '@storybook/core/types'; - -// export const VALENTINE = '💖'; From 15b445daa0724880a9dffc2f6aab2670604bebed Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 2 Jul 2024 20:24:39 +0200 Subject: [PATCH 07/86] fixes --- code/builders/builder-webpack5/tsconfig.json | 12 +++++++----- .../storybook-monorepo-imports.js | 8 +++++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/code/builders/builder-webpack5/tsconfig.json b/code/builders/builder-webpack5/tsconfig.json index 4fe3a6934e78..b5ee1de46797 100644 --- a/code/builders/builder-webpack5/tsconfig.json +++ b/code/builders/builder-webpack5/tsconfig.json @@ -1,12 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - - "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] + "storybook/internal/*": [ + "../../lib/cli/core/*" + ] } }, - "include": ["src/**/*"], -} + "include": [ + "src/**/*" + ] +} \ No newline at end of file diff --git a/scripts/eslint-plugin-local-rules/storybook-monorepo-imports.js b/scripts/eslint-plugin-local-rules/storybook-monorepo-imports.js index ee29e6d9f641..19ed85394df9 100644 --- a/scripts/eslint-plugin-local-rules/storybook-monorepo-imports.js +++ b/scripts/eslint-plugin-local-rules/storybook-monorepo-imports.js @@ -16,9 +16,15 @@ module.exports = { ImportDeclaration: (node) => { const fileName = context.getPhysicalFilename(); const isInCLI = !!fileName.includes(path.join('code', 'lib', 'cli')); + const isInCodeod = !!fileName.includes(path.join('code', 'lib', 'codemod')); const isInCore = !!fileName.includes(path.join('code', 'core')); - if (node.source.value.startsWith('@storybook/core/') && !isInCLI && !isInCore) { + if ( + node.source.value.startsWith('@storybook/core/') && + !isInCLI && + !isInCore && + !isInCodeod + ) { const newPath = node.source.value .replace('@storybook/core', 'storybook/internal') .replace('/src', ''); From 75f8de2d54b0aa3f2fad4fdcfd3f417add18cc2c Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 2 Jul 2024 21:50:06 +0200 Subject: [PATCH 08/86] fixes --- code/addons/links/tsconfig.json | 5 ++--- code/core/tsconfig.json | 13 +++++-------- code/lib/blocks/src/blocks/ArgTypes.tsx | 6 ++++++ code/lib/blocks/src/blocks/Controls.tsx | 3 +++ code/lib/blocks/src/blocks/Description.tsx | 1 + code/lib/blocks/src/blocks/DocsContainer.tsx | 1 + code/lib/blocks/src/blocks/Source.tsx | 6 ++++++ code/lib/blocks/src/blocks/SourceContainer.tsx | 1 + code/lib/blocks/src/blocks/Story.tsx | 4 ++++ code/lib/blocks/src/blocks/Subtitle.tsx | 1 + code/lib/blocks/src/blocks/Title.tsx | 2 ++ .../blocks/src/blocks/external/ExternalDocs.tsx | 1 + code/lib/blocks/src/blocks/mdx.tsx | 1 + .../blocks/src/components/ArgsTable/ArgsTable.tsx | 7 +++++++ code/lib/blocks/src/components/Preview.tsx | 4 ++++ code/lib/blocks/src/components/Source.tsx | 1 + code/lib/blocks/src/components/Story.tsx | 1 + code/lib/blocks/src/controls/Color.tsx | 12 ++++++++++++ code/lib/blocks/src/controls/Date.tsx | 2 ++ code/lib/blocks/src/controls/Files.tsx | 2 ++ code/lib/blocks/src/controls/Number.tsx | 9 ++++++++- code/lib/blocks/src/controls/Object.tsx | 14 ++++++++++++-- code/lib/blocks/src/controls/Range.tsx | 2 ++ code/lib/blocks/src/controls/Text.tsx | 1 + 24 files changed, 86 insertions(+), 14 deletions(-) diff --git a/code/addons/links/tsconfig.json b/code/addons/links/tsconfig.json index a84636449555..54246c6c83a9 100644 --- a/code/addons/links/tsconfig.json +++ b/code/addons/links/tsconfig.json @@ -1,11 +1,10 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - - "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] + "storybook/internal/*": ["../../lib/cli/core/*"], + "react": ["../../node_modules/react"] } }, "include": ["src/**/*"] diff --git a/code/core/tsconfig.json b/code/core/tsconfig.json index 33af4607d922..5f12dd31bb3e 100644 --- a/code/core/tsconfig.json +++ b/code/core/tsconfig.json @@ -1,17 +1,14 @@ { "extends": "../tsconfig.json", "compilerOptions": { - - - "skipDefaultLibCheck": true, - "moduleResolution": "Bundler", - "target": "ES2022", - "module": "ES2022", "baseUrl": ".", + "module": "ES2022", + "moduleResolution": "Bundler", "paths": { - // "storybook/internal/*": ["./src/*"], "@storybook/core/*": ["./src/*"] - } + }, + "skipDefaultLibCheck": true, + "target": "ES2022" }, "include": ["src/**/*", "scripts/**/*", "*.d.ts"] } diff --git a/code/lib/blocks/src/blocks/ArgTypes.tsx b/code/lib/blocks/src/blocks/ArgTypes.tsx index bfab62aa23df..ed68fc55c639 100644 --- a/code/lib/blocks/src/blocks/ArgTypes.tsx +++ b/code/lib/blocks/src/blocks/ArgTypes.tsx @@ -29,6 +29,7 @@ function extractComponentArgTypes( if (!extractArgTypes) { throw new Error(ArgsTableError.ARGS_UNSUPPORTED); } + // @ts-expect-error (non-strict) return extractArgTypes(component); } @@ -39,6 +40,7 @@ function getArgTypesFromResolved(resolved: ReturnType) { projectAnnotations: { parameters }, } = resolved; return { + // @ts-expect-error (non-strict) argTypes: extractComponentArgTypes(component, parameters), parameters, component, @@ -67,6 +69,7 @@ export const ArgTypes: FC = (props) => { } const resolved = useOf(of || 'meta'); const { argTypes, parameters, component, subcomponents } = getArgTypesFromResolved(resolved); + // @ts-expect-error (non-strict) const argTypesParameters = parameters.docs?.argTypes || ({} as ArgTypesParameters); const include = props.include ?? argTypesParameters.include; @@ -75,6 +78,7 @@ export const ArgTypes: FC = (props) => { const filteredArgTypes = filterArgTypes(argTypes, include, exclude); + // @ts-expect-error (non-strict) const hasSubcomponents = Boolean(subcomponents) && Object.keys(subcomponents).length > 0; if (!hasSubcomponents) { @@ -83,9 +87,11 @@ export const ArgTypes: FC = (props) => { const mainComponentName = getComponentName(component); const subcomponentTabs = Object.fromEntries( + // @ts-expect-error (non-strict) Object.entries(subcomponents).map(([key, comp]) => [ key, { + // @ts-expect-error (non-strict) rows: filterArgTypes(extractComponentArgTypes(comp, parameters), include, exclude), sort, }, diff --git a/code/lib/blocks/src/blocks/Controls.tsx b/code/lib/blocks/src/blocks/Controls.tsx index a4684ded1ad4..aa4cd11ac458 100644 --- a/code/lib/blocks/src/blocks/Controls.tsx +++ b/code/lib/blocks/src/blocks/Controls.tsx @@ -32,6 +32,7 @@ function extractComponentArgTypes( if (!extractArgTypes) { throw new Error(ArgsTableError.ARGS_UNSUPPORTED); } + // @ts-expect-error (non-strict) return extractArgTypes(component); } @@ -55,6 +56,7 @@ export const Controls: FC = (props) => { const filteredArgTypes = filterArgTypes(argTypes, include, exclude); + // @ts-expect-error (non-strict) const hasSubcomponents = Boolean(subcomponents) && Object.keys(subcomponents).length > 0; if (!hasSubcomponents) { @@ -75,6 +77,7 @@ export const Controls: FC = (props) => { const mainComponentName = getComponentName(component); const subcomponentTabs = Object.fromEntries( + // @ts-expect-error (non-strict) Object.entries(subcomponents).map(([key, comp]) => [ key, { diff --git a/code/lib/blocks/src/blocks/Description.tsx b/code/lib/blocks/src/blocks/Description.tsx index 99b9cf7ce75b..28dcd4b71a79 100644 --- a/code/lib/blocks/src/blocks/Description.tsx +++ b/code/lib/blocks/src/blocks/Description.tsx @@ -43,6 +43,7 @@ const getDescriptionFromResolvedOf = (resolvedOf: ReturnType): str projectAnnotations: { parameters }, } = resolvedOf; return ( + // @ts-expect-error (non-strict) parameters.docs?.extractComponentDescription?.(component, { component, parameters, diff --git a/code/lib/blocks/src/blocks/DocsContainer.tsx b/code/lib/blocks/src/blocks/DocsContainer.tsx index e5ad466f7f6a..e1da8ba6d666 100644 --- a/code/lib/blocks/src/blocks/DocsContainer.tsx +++ b/code/lib/blocks/src/blocks/DocsContainer.tsx @@ -54,6 +54,7 @@ export const DocsContainer: FC> = ({ return ( + {/* @ts-expect-error (non-strict) */} : null} diff --git a/code/lib/blocks/src/blocks/Source.tsx b/code/lib/blocks/src/blocks/Source.tsx index fda733fc8a5b..a5c92dde48c2 100644 --- a/code/lib/blocks/src/blocks/Source.tsx +++ b/code/lib/blocks/src/blocks/Source.tsx @@ -125,12 +125,14 @@ export const useSourceProps = ( } } + // @ts-expect-error (non-strict) const sourceParameters = (story?.parameters?.docs?.source || {}) as SourceParameters; const { code } = props; // We will fall back to `sourceParameters.code`, but per story below let format = props.format ?? sourceParameters.format; const language = props.language ?? sourceParameters.language ?? 'jsx'; const dark = props.dark ?? sourceParameters.dark ?? false; + // @ts-expect-error (non-strict) if (!code && !story) { return { error: SourceError.SOURCE_UNAVAILABLE }; } @@ -142,6 +144,7 @@ export const useSourceProps = ( dark, }; } + // @ts-expect-error (non-strict) const storyContext = docsContext.getStoryContext(story); // eslint-disable-next-line no-underscore-dangle @@ -149,13 +152,16 @@ export const useSourceProps = ( ? storyContext.initialArgs : storyContext.unmappedArgs; + // @ts-expect-error (non-strict) const source = getStorySource(story.id, argsForSource, sourceContext); + // @ts-expect-error (non-strict) format = source.format ?? story.parameters.docs?.source?.format ?? false; return { code: getSnippet({ snippet: source.code, storyContext: { ...storyContext, args: argsForSource }, + // @ts-expect-error (non-strict) typeFromProps: props.type, transformFromProps: props.transform, }), diff --git a/code/lib/blocks/src/blocks/SourceContainer.tsx b/code/lib/blocks/src/blocks/SourceContainer.tsx index 149d544d705e..a692903d67a9 100644 --- a/code/lib/blocks/src/blocks/SourceContainer.tsx +++ b/code/lib/blocks/src/blocks/SourceContainer.tsx @@ -44,6 +44,7 @@ export const SourceContainer: FC { const handleSnippetRendered = ( idOrEvent: StoryId | SnippetRenderedEvent, + // @ts-expect-error (non-strict) inputSource: string = null, inputFormat: SyntaxHighlighterFormatTypes = false ) => { diff --git a/code/lib/blocks/src/blocks/Story.tsx b/code/lib/blocks/src/blocks/Story.tsx index 92477a9a8f3f..9995543b1769 100644 --- a/code/lib/blocks/src/blocks/Story.tsx +++ b/code/lib/blocks/src/blocks/Story.tsx @@ -90,6 +90,7 @@ export const getStoryProps = ( const storyParameters = (docs.story || {}) as StoryParameters & { iframeHeight?: string }; if (docs.disable) { + // @ts-expect-error (non-strict) return null; } @@ -102,6 +103,7 @@ export const getStoryProps = ( const height = props.height ?? storyParameters.height; const autoplay = props.autoplay ?? storyParameters.autoplay ?? false; return { + // @ts-expect-error (non-strict) story, inline: true, height, @@ -110,12 +112,14 @@ export const getStoryProps = ( forceInitialArgs: !!props.__forceInitialArgs, // eslint-disable-next-line no-underscore-dangle primary: !!props.__primary, + // @ts-expect-error (non-strict) renderStoryToElement: context.renderStoryToElement, }; } const height = props.height ?? storyParameters.height ?? storyParameters.iframeHeight ?? '100px'; return { + // @ts-expect-error (non-strict) story, inline: false, height, diff --git a/code/lib/blocks/src/blocks/Subtitle.tsx b/code/lib/blocks/src/blocks/Subtitle.tsx index af80a72bfb06..1b8a76f9fb9a 100644 --- a/code/lib/blocks/src/blocks/Subtitle.tsx +++ b/code/lib/blocks/src/blocks/Subtitle.tsx @@ -29,6 +29,7 @@ export const Subtitle: FunctionComponent = (props) => { try { preparedMeta = useOf(of || 'meta', ['meta']).preparedMeta; } catch (error) { + // @ts-expect-error (non-strict) if (children && !error.message.includes('did you forget to use ?')) { // ignore error about unattached CSF since we can still render children throw error; diff --git a/code/lib/blocks/src/blocks/Title.tsx b/code/lib/blocks/src/blocks/Title.tsx index 4df5139ef703..3d7bd99455cf 100644 --- a/code/lib/blocks/src/blocks/Title.tsx +++ b/code/lib/blocks/src/blocks/Title.tsx @@ -36,12 +36,14 @@ export const Title: FunctionComponent = (props) => { try { preparedMeta = useOf(of || 'meta', ['meta']).preparedMeta; } catch (error) { + // @ts-expect-error (non-strict) if (children && !error.message.includes('did you forget to use ?')) { // ignore error about unattached CSF since we can still render children throw error; } } + // @ts-expect-error (non-strict) const content = children || extractTitle(preparedMeta?.title); return content ? {content} : null; diff --git a/code/lib/blocks/src/blocks/external/ExternalDocs.tsx b/code/lib/blocks/src/blocks/external/ExternalDocs.tsx index 0e3bf4dfa079..b18bbbdb21c2 100644 --- a/code/lib/blocks/src/blocks/external/ExternalDocs.tsx +++ b/code/lib/blocks/src/blocks/external/ExternalDocs.tsx @@ -31,5 +31,6 @@ export function ExternalDocs({ const TDocs = Docs as typeof Docs; + // @ts-expect-error (non-strict) return ; } diff --git a/code/lib/blocks/src/blocks/mdx.tsx b/code/lib/blocks/src/blocks/mdx.tsx index 146e8d292d6f..8cbcf27a8df5 100644 --- a/code/lib/blocks/src/blocks/mdx.tsx +++ b/code/lib/blocks/src/blocks/mdx.tsx @@ -124,6 +124,7 @@ export const AnchorMdx: FC> = (props) => { event.preventDefault(); // use the A element's href, which has been modified for // local paths without a `?path=` query param prefix + // @ts-expect-error (non-strict) navigate(context, event.currentTarget.getAttribute('href')); } }} diff --git a/code/lib/blocks/src/components/ArgsTable/ArgsTable.tsx b/code/lib/blocks/src/components/ArgsTable/ArgsTable.tsx index 0bac6d042a30..8737d8b13fcb 100644 --- a/code/lib/blocks/src/components/ArgsTable/ArgsTable.tsx +++ b/code/lib/blocks/src/components/ArgsTable/ArgsTable.tsx @@ -183,9 +183,12 @@ export type SortType = 'alpha' | 'requiredFirst' | 'none'; type SortFn = (a: ArgType, b: ArgType) => number; const sortFns: Record = { + // @ts-expect-error (non-strict) alpha: (a: ArgType, b: ArgType) => a.name.localeCompare(b.name), requiredFirst: (a: ArgType, b: ArgType) => + // @ts-expect-error (non-strict) Number(!!b.type?.required) - Number(!!a.type?.required) || a.name.localeCompare(b.name), + // @ts-expect-error (non-strict) none: undefined, }; @@ -268,12 +271,14 @@ const groupRows = (rows: ArgType, sort: SortType) => { }; const sorted = { + // @ts-expect-error (non-strict) ungrouped: sections.ungrouped.sort(sortFn), ungroupedSubsections: sortSubsection(sections.ungroupedSubsections), sections: Object.keys(sections.sections).reduce>( (acc, cur) => ({ ...acc, [cur]: { + // @ts-expect-error (non-strict) ungrouped: sections.sections[cur].ungrouped.sort(sortFn), subsections: sortSubsection(sections.sections[cur].subsections), }, @@ -296,6 +301,7 @@ const safeIncludeConditionalArg = (row: ArgType, args: Args, globals: Globals) = try { return includeConditionalArg(row, args, globals); } catch (err) { + // @ts-expect-error (non-strict) once.warn(err.message); return false; } @@ -332,6 +338,7 @@ export const ArgsTable: FC = (props) => { // This happen when you load the manager and the story is not yet loaded if (isLoading) return ; + // @ts-expect-error (non-strict) const { rows, args, globals } = 'rows' in props && props; const groups = groupRows( pickBy( diff --git a/code/lib/blocks/src/components/Preview.tsx b/code/lib/blocks/src/components/Preview.tsx index 5578c2f90590..c5dfa996b5cb 100644 --- a/code/lib/blocks/src/components/Preview.tsx +++ b/code/lib/blocks/src/components/Preview.tsx @@ -92,6 +92,7 @@ const StyledSource = styled(Source)(({ theme }) => ({ })); const PreviewContainer = styled.div( + // @ts-expect-error (non-strict) ({ theme, withSource, isExpanded }) => ({ position: 'relative', overflow: 'hidden', @@ -121,6 +122,7 @@ const getSource = ( switch (true) { case !!(withSource && withSource.error): { return { + // @ts-expect-error (non-strict) source: null, actionItem: { title: 'No code available', @@ -194,6 +196,7 @@ export const Preview: FC = ({ ...props }) => { const [expanded, setExpanded] = useState(isExpanded); + // @ts-expect-error (non-strict) const { source, actionItem } = getSource(withSource, expanded, setExpanded); const [scale, setScale] = useState(1); const previewClasses = [className].concat(['sbdocs', 'sbdocs-preview', 'sb-unstyled']); @@ -222,6 +225,7 @@ export const Preview: FC = ({ e.preventDefault(); if (additionalActionItems.filter((item) => item.title === 'Copied').length === 0) { + // @ts-expect-error (non-strict) copyToClipboard(source.props.code).then(() => { setAdditionalActionItems([ ...additionalActionItems, diff --git a/code/lib/blocks/src/components/Source.tsx b/code/lib/blocks/src/components/Source.tsx index 2131a934481e..32b4ad0dfac3 100644 --- a/code/lib/blocks/src/components/Source.tsx +++ b/code/lib/blocks/src/components/Source.tsx @@ -114,6 +114,7 @@ const Source: FunctionComponent = ({ bordered copyable format={format} + // @ts-expect-error (non-strict) language={language} className="docblock-source sb-unstyled" {...rest} diff --git a/code/lib/blocks/src/components/Story.tsx b/code/lib/blocks/src/components/Story.tsx index fb7622703ef8..0111d8ebd9ae 100644 --- a/code/lib/blocks/src/components/Story.tsx +++ b/code/lib/blocks/src/components/Story.tsx @@ -80,6 +80,7 @@ const InlineStory: FunctionComponent = (props) => { )} { min-height: ${height}; transform: translateZ(0); overflow: auto }`} ) : null} {showLoader && } + {/* @ts-expect-error (Type 'undefined' is not assignable to type 'HTMLDivElement | null') */}
); diff --git a/code/lib/blocks/src/controls/Color.tsx b/code/lib/blocks/src/controls/Color.tsx index 68eb8d3678b5..2e924f9d9bc6 100644 --- a/code/lib/blocks/src/controls/Color.tsx +++ b/code/lib/blocks/src/controls/Color.tsx @@ -231,6 +231,7 @@ const useColorInput = ( }, [initialValue]); const realValue = useMemo( + // @ts-expect-error (non-strict) () => getRealValue(value, color, colorSpace).toLowerCase(), [value, color, colorSpace] ); @@ -244,6 +245,7 @@ const useColorInput = ( if (v === '') { setColor(undefined); + // @ts-expect-error (non-strict) onChange(undefined); } @@ -297,6 +299,7 @@ const usePresets = ( const addPreset: (color: ParsedColor) => void = useCallback( (color) => { if (!color?.valid) return; + // @ts-expect-error (non-strict) if (presets.some((preset) => id(preset[colorSpace]) === id(color[colorSpace]))) return; setSelectedColors((arr) => arr.concat(color)); }, @@ -322,6 +325,7 @@ export const ColorControl: FC = ({ initialValue, debouncedOnChange ); + // @ts-expect-error (non-strict) const { presets, addPreset } = usePresets(presetColors, color, colorSpace); const Picker = ColorPicker[colorSpace]; @@ -331,8 +335,10 @@ export const ColorControl: FC = ({ addPreset(color)} tooltip={ @@ -344,13 +350,19 @@ export const ColorControl: FC = ({ {presets.map((preset, index: number) => ( } > updateValue(preset.value)} /> diff --git a/code/lib/blocks/src/controls/Date.tsx b/code/lib/blocks/src/controls/Date.tsx index 6949f2dae262..8c3a8fdcabbd 100644 --- a/code/lib/blocks/src/controls/Date.tsx +++ b/code/lib/blocks/src/controls/Date.tsx @@ -85,6 +85,7 @@ export const DateControl: FC = ({ name, value, onChange, onFocus, onB const onDateChange = (e: ChangeEvent) => { if (!e.target.value) return onChange(); const parsed = parseDate(e.target.value); + // @ts-expect-error (non-strict) const result = new Date(value); result.setFullYear(parsed.getFullYear(), parsed.getMonth(), parsed.getDate()); const time = result.getTime(); @@ -95,6 +96,7 @@ export const DateControl: FC = ({ name, value, onChange, onFocus, onB const onTimeChange = (e: ChangeEvent) => { if (!e.target.value) return onChange(); const parsed = parseTime(e.target.value); + // @ts-expect-error (non-strict) const result = new Date(value); result.setHours(parsed.getHours()); result.setMinutes(parsed.getMinutes()); diff --git a/code/lib/blocks/src/controls/Files.tsx b/code/lib/blocks/src/controls/Files.tsx index 2517e3c4ff48..6a4fa199aaee 100644 --- a/code/lib/blocks/src/controls/Files.tsx +++ b/code/lib/blocks/src/controls/Files.tsx @@ -49,12 +49,14 @@ export const FilesControl: FC = ({ } const fileUrls = Array.from(e.target.files).map((file) => URL.createObjectURL(file)); onChange(fileUrls); + // @ts-expect-error (non-strict) revokeOldUrls(value); } // Added useEffect hook to reset the file value when value is null useEffect(() => { if (value == null && inputElement.current) { + // @ts-expect-error (non-strict) inputElement.current.value = null; } }, [value, name]); diff --git a/code/lib/blocks/src/controls/Number.tsx b/code/lib/blocks/src/controls/Number.tsx index fd330406e6e4..5ffe486a10d7 100644 --- a/code/lib/blocks/src/controls/Number.tsx +++ b/code/lib/blocks/src/controls/Number.tsx @@ -36,6 +36,7 @@ export const NumberControl: FC = ({ }) => { const [inputValue, setInputValue] = useState(typeof value === 'number' ? value : ''); const [forceVisible, setForceVisible] = useState(false); + // @ts-expect-error (non-strict) const [parseError, setParseError] = useState(null); const readonly = !!argType?.table?.readonly; @@ -48,6 +49,7 @@ export const NumberControl: FC = ({ setParseError(new Error(`'${event.target.value}' is not a number`)); } else { onChange(result); + // @ts-expect-error (non-strict) setParseError(null); } }, @@ -62,12 +64,16 @@ export const NumberControl: FC = ({ const htmlElRef = useRef(null); useEffect(() => { - if (forceVisible && htmlElRef.current) htmlElRef.current.select(); + if (forceVisible && htmlElRef.current) { + // @ts-expect-error (non-strict) + htmlElRef.current.select(); + } }, [forceVisible]); useEffect(() => { const newInputValue = typeof value === 'number' ? value : ''; if (inputValue !== newInputValue) { + // @ts-expect-error (non-strict) setInputValue(value); } }, [value]); @@ -96,6 +102,7 @@ export const NumberControl: FC = ({ size="flex" placeholder="Edit number..." value={inputValue} + // @ts-expect-error (non-strict) valid={parseError ? 'error' : null} autoFocus={forceVisible} readOnly={readonly} diff --git a/code/lib/blocks/src/controls/Object.tsx b/code/lib/blocks/src/controls/Object.tsx index f6fda6ed8b42..c5917b3f5a7b 100644 --- a/code/lib/blocks/src/controls/Object.tsx +++ b/code/lib/blocks/src/controls/Object.tsx @@ -249,14 +249,20 @@ export const ObjectControl: FC = ({ name, value, onChange, argType const data = useMemo(() => value && cloneDeep(value), [value]); const hasData = data !== null && data !== undefined; const [showRaw, setShowRaw] = useState(!hasData); + + // @ts-expect-error (non-strict) const [parseError, setParseError] = useState(null); const readonly = !!argType?.table?.readonly; const updateRaw: (raw: string) => void = useCallback( (raw) => { try { - if (raw) onChange(JSON.parse(raw)); + if (raw) { + onChange(JSON.parse(raw)); + } + // @ts-expect-error (non-strict) setParseError(undefined); } catch (e) { + // @ts-expect-error (non-strict) setParseError(e); } }, @@ -271,7 +277,10 @@ export const ObjectControl: FC = ({ name, value, onChange, argType const htmlElRef = useRef(null); useEffect(() => { - if (forceVisible && htmlElRef.current) htmlElRef.current.select(); + if (forceVisible && htmlElRef.current) { + // @ts-expect-error (non-strict) + htmlElRef.current.select(); + } }, [forceVisible]); if (!hasData) { @@ -291,6 +300,7 @@ export const ObjectControl: FC = ({ name, value, onChange, argType onBlur={(event: FocusEvent) => updateRaw(event.target.value)} placeholder="Edit JSON string..." autoFocus={forceVisible} + // @ts-expect-error (non-strict) valid={parseError ? 'error' : null} readOnly={readonly} /> diff --git a/code/lib/blocks/src/controls/Range.tsx b/code/lib/blocks/src/controls/Range.tsx index 6db22a7710cd..2021f3f7da0d 100644 --- a/code/lib/blocks/src/controls/Range.tsx +++ b/code/lib/blocks/src/controls/Range.tsx @@ -219,6 +219,7 @@ export const RangeControl: FC = ({ return ( {min} + {/* @ts-expect-error (non-strict) */} = ({ {...{ name, value, min, max, step, onFocus, onBlur }} /> + {/* @ts-expect-error (non-strict) */} {hasValue ? value.toFixed(numberOFDecimalsPlaces) : '--'} / {max} diff --git a/code/lib/blocks/src/controls/Text.tsx b/code/lib/blocks/src/controls/Text.tsx index 0005651c9360..eedc540109d0 100644 --- a/code/lib/blocks/src/controls/Text.tsx +++ b/code/lib/blocks/src/controls/Text.tsx @@ -66,6 +66,7 @@ export const TextControl: FC = ({ size="flex" placeholder="Edit string..." autoFocus={forceVisible} + // @ts-expect-error (non-strict) valid={isValid ? null : 'error'} {...{ name, value: isValid ? value : '', onFocus, onBlur }} /> From 50db861e597675c9967208414d95ed676293899b Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 2 Jul 2024 21:52:39 +0200 Subject: [PATCH 09/86] Discard changes to code/core/src/common/utils/interpret-require.ts --- code/core/src/common/utils/interpret-require.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/core/src/common/utils/interpret-require.ts b/code/core/src/common/utils/interpret-require.ts index b8171ebc2b50..9ecbd240a1f4 100644 --- a/code/core/src/common/utils/interpret-require.ts +++ b/code/core/src/common/utils/interpret-require.ts @@ -19,7 +19,7 @@ export function interopRequireDefault(filePath: string) { tsconfigRaw: `{ "compilerOptions": { "strict": false, - + "skipLibCheck": true, }, }`, }); From ceb443a24b7d7033ce716c419a6d092e79307fd0 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 2 Jul 2024 21:55:26 +0200 Subject: [PATCH 10/86] linting --- code/addons/a11y/tsconfig.json | 10 +++------- code/addons/actions/tsconfig.json | 10 +++------- code/addons/backgrounds/tsconfig.json | 10 +++------- code/addons/controls/tsconfig.json | 8 ++------ code/addons/docs/tsconfig.json | 8 ++------ code/addons/essentials/tsconfig.json | 8 ++------ code/addons/gfm/tsconfig.json | 8 ++------ code/addons/highlight/tsconfig.json | 10 +++------- code/addons/interactions/tsconfig.json | 8 ++------ code/addons/jest/tsconfig.json | 8 ++------ code/addons/measure/tsconfig.json | 1 - code/addons/onboarding/tsconfig.json | 8 ++------ code/addons/outline/tsconfig.json | 1 - code/addons/storysource/tsconfig.json | 8 ++------ code/addons/themes/tsconfig.json | 1 - code/addons/toolbars/tsconfig.json | 8 ++------ code/addons/viewport/tsconfig.json | 1 - code/builders/builder-vite/tsconfig.json | 2 -- code/builders/builder-webpack5/tsconfig.json | 10 +++------- code/core/tsconfig.build.json | 2 -- code/core/tsconfig.check.json | 2 -- code/frameworks/ember/tsconfig.json | 8 ++------ code/frameworks/html-webpack5/tsconfig.json | 8 ++------ code/frameworks/nextjs/tsconfig.json | 2 -- code/frameworks/preact-webpack5/tsconfig.json | 8 ++------ code/frameworks/react-webpack5/tsconfig.json | 8 ++------ code/frameworks/server-webpack5/tsconfig.json | 8 ++------ code/frameworks/svelte-webpack5/tsconfig.json | 8 ++------ code/frameworks/vue3-vite/tsconfig.json | 1 - code/frameworks/vue3-webpack5/tsconfig.json | 8 ++------ .../web-components-webpack5/tsconfig.json | 8 ++------ code/lib/cli/tsconfig.json | 1 - code/lib/codemod/tsconfig.json | 16 ++++------------ code/lib/core-webpack/tsconfig.json | 8 ++------ code/lib/csf-plugin/tsconfig.json | 2 -- code/lib/instrumenter/tsconfig.json | 1 - code/lib/react-dom-shim/tsconfig.json | 1 - code/lib/source-loader/tsconfig.json | 1 - code/lib/test/tsconfig.json | 1 - code/presets/create-react-app/tsconfig.json | 8 ++------ code/presets/html-webpack/tsconfig.json | 8 ++------ code/presets/preact-webpack/tsconfig.json | 8 ++------ code/presets/react-webpack/tsconfig.json | 8 ++------ code/presets/server-webpack/tsconfig.json | 8 ++------ code/presets/svelte-webpack/tsconfig.json | 8 ++------ code/presets/vue3-webpack/tsconfig.json | 8 ++------ code/renderers/html/tsconfig.json | 9 ++------- code/renderers/preact/tsconfig.json | 9 ++------- code/renderers/react/tsconfig.json | 9 ++------- code/renderers/server/tsconfig.json | 11 +++-------- code/renderers/svelte/tsconfig.json | 1 - code/renderers/vue3/tsconfig.json | 13 +++---------- code/renderers/web-components/tsconfig.json | 9 ++------- code/tsconfig.json | 15 +++------------ 54 files changed, 86 insertions(+), 276 deletions(-) diff --git a/code/addons/a11y/tsconfig.json b/code/addons/a11y/tsconfig.json index b5ee1de46797..601bf5b99bf4 100644 --- a/code/addons/a11y/tsconfig.json +++ b/code/addons/a11y/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] -} \ No newline at end of file + "include": ["src/**/*"] +} diff --git a/code/addons/actions/tsconfig.json b/code/addons/actions/tsconfig.json index b5ee1de46797..601bf5b99bf4 100644 --- a/code/addons/actions/tsconfig.json +++ b/code/addons/actions/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] -} \ No newline at end of file + "include": ["src/**/*"] +} diff --git a/code/addons/backgrounds/tsconfig.json b/code/addons/backgrounds/tsconfig.json index b5ee1de46797..601bf5b99bf4 100644 --- a/code/addons/backgrounds/tsconfig.json +++ b/code/addons/backgrounds/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] -} \ No newline at end of file + "include": ["src/**/*"] +} diff --git a/code/addons/controls/tsconfig.json b/code/addons/controls/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/addons/controls/tsconfig.json +++ b/code/addons/controls/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/addons/docs/tsconfig.json b/code/addons/docs/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/addons/docs/tsconfig.json +++ b/code/addons/docs/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/addons/essentials/tsconfig.json b/code/addons/essentials/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/addons/essentials/tsconfig.json +++ b/code/addons/essentials/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/addons/gfm/tsconfig.json b/code/addons/gfm/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/addons/gfm/tsconfig.json +++ b/code/addons/gfm/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/addons/highlight/tsconfig.json b/code/addons/highlight/tsconfig.json index b5ee1de46797..601bf5b99bf4 100644 --- a/code/addons/highlight/tsconfig.json +++ b/code/addons/highlight/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] -} \ No newline at end of file + "include": ["src/**/*"] +} diff --git a/code/addons/interactions/tsconfig.json b/code/addons/interactions/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/addons/interactions/tsconfig.json +++ b/code/addons/interactions/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/addons/jest/tsconfig.json b/code/addons/jest/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/addons/jest/tsconfig.json +++ b/code/addons/jest/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/addons/measure/tsconfig.json b/code/addons/measure/tsconfig.json index 5d3a4e53d2f6..52bb92946e15 100644 --- a/code/addons/measure/tsconfig.json +++ b/code/addons/measure/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] diff --git a/code/addons/onboarding/tsconfig.json b/code/addons/onboarding/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/addons/onboarding/tsconfig.json +++ b/code/addons/onboarding/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/addons/outline/tsconfig.json b/code/addons/outline/tsconfig.json index 5d3a4e53d2f6..52bb92946e15 100644 --- a/code/addons/outline/tsconfig.json +++ b/code/addons/outline/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] diff --git a/code/addons/storysource/tsconfig.json b/code/addons/storysource/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/addons/storysource/tsconfig.json +++ b/code/addons/storysource/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/addons/themes/tsconfig.json b/code/addons/themes/tsconfig.json index 5d3a4e53d2f6..52bb92946e15 100644 --- a/code/addons/themes/tsconfig.json +++ b/code/addons/themes/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] diff --git a/code/addons/toolbars/tsconfig.json b/code/addons/toolbars/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/addons/toolbars/tsconfig.json +++ b/code/addons/toolbars/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/addons/viewport/tsconfig.json b/code/addons/viewport/tsconfig.json index 5d3a4e53d2f6..52bb92946e15 100644 --- a/code/addons/viewport/tsconfig.json +++ b/code/addons/viewport/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] diff --git a/code/builders/builder-vite/tsconfig.json b/code/builders/builder-vite/tsconfig.json index a84636449555..601bf5b99bf4 100644 --- a/code/builders/builder-vite/tsconfig.json +++ b/code/builders/builder-vite/tsconfig.json @@ -1,8 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - - "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] diff --git a/code/builders/builder-webpack5/tsconfig.json b/code/builders/builder-webpack5/tsconfig.json index b5ee1de46797..601bf5b99bf4 100644 --- a/code/builders/builder-webpack5/tsconfig.json +++ b/code/builders/builder-webpack5/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] -} \ No newline at end of file + "include": ["src/**/*"] +} diff --git a/code/core/tsconfig.build.json b/code/core/tsconfig.build.json index 45c25a297d34..62447df708d0 100644 --- a/code/core/tsconfig.build.json +++ b/code/core/tsconfig.build.json @@ -1,8 +1,6 @@ { "extends": "../tsconfig.json", "compilerOptions": { - - "skipDefaultLibCheck": true, "moduleResolution": "Bundler", "rootDir": ".", diff --git a/code/core/tsconfig.check.json b/code/core/tsconfig.check.json index 1eb4fe3cf1d8..f40f66dae184 100644 --- a/code/core/tsconfig.check.json +++ b/code/core/tsconfig.check.json @@ -1,8 +1,6 @@ { "extends": "../tsconfig.json", "compilerOptions": { - - "skipDefaultLibCheck": true, "moduleResolution": "Bundler", "target": "ES2022", diff --git a/code/frameworks/ember/tsconfig.json b/code/frameworks/ember/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/frameworks/ember/tsconfig.json +++ b/code/frameworks/ember/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/frameworks/html-webpack5/tsconfig.json b/code/frameworks/html-webpack5/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/frameworks/html-webpack5/tsconfig.json +++ b/code/frameworks/html-webpack5/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/frameworks/nextjs/tsconfig.json b/code/frameworks/nextjs/tsconfig.json index c2b2cbeef86e..3d6d1ae67af4 100644 --- a/code/frameworks/nextjs/tsconfig.json +++ b/code/frameworks/nextjs/tsconfig.json @@ -1,8 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - - "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] diff --git a/code/frameworks/preact-webpack5/tsconfig.json b/code/frameworks/preact-webpack5/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/frameworks/preact-webpack5/tsconfig.json +++ b/code/frameworks/preact-webpack5/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/frameworks/react-webpack5/tsconfig.json b/code/frameworks/react-webpack5/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/frameworks/react-webpack5/tsconfig.json +++ b/code/frameworks/react-webpack5/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/frameworks/server-webpack5/tsconfig.json b/code/frameworks/server-webpack5/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/frameworks/server-webpack5/tsconfig.json +++ b/code/frameworks/server-webpack5/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/frameworks/svelte-webpack5/tsconfig.json b/code/frameworks/svelte-webpack5/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/frameworks/svelte-webpack5/tsconfig.json +++ b/code/frameworks/svelte-webpack5/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/frameworks/vue3-vite/tsconfig.json b/code/frameworks/vue3-vite/tsconfig.json index a9d1292735ed..65c2a458c1a5 100644 --- a/code/frameworks/vue3-vite/tsconfig.json +++ b/code/frameworks/vue3-vite/tsconfig.json @@ -3,7 +3,6 @@ "compilerOptions": { "rootDir": "./src", "types": ["node"], - "baseUrl": ".", "paths": { diff --git a/code/frameworks/vue3-webpack5/tsconfig.json b/code/frameworks/vue3-webpack5/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/frameworks/vue3-webpack5/tsconfig.json +++ b/code/frameworks/vue3-webpack5/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/frameworks/web-components-webpack5/tsconfig.json b/code/frameworks/web-components-webpack5/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/frameworks/web-components-webpack5/tsconfig.json +++ b/code/frameworks/web-components-webpack5/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/lib/cli/tsconfig.json b/code/lib/cli/tsconfig.json index b0b45928772f..9bc502c48f80 100644 --- a/code/lib/cli/tsconfig.json +++ b/code/lib/cli/tsconfig.json @@ -3,7 +3,6 @@ "compilerOptions": { "types": ["node"], - "noEmit": true, "baseUrl": ".", "paths": { diff --git a/code/lib/codemod/tsconfig.json b/code/lib/codemod/tsconfig.json index 8463318cdf9f..c65bc878c791 100644 --- a/code/lib/codemod/tsconfig.json +++ b/code/lib/codemod/tsconfig.json @@ -4,17 +4,9 @@ "allowJs": true, "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "exclude": [ - "node_modules", - "__testfixtures__", - "__tests__" - ], - "include": [ - "src/**/*" - ] -} \ No newline at end of file + "exclude": ["node_modules", "__testfixtures__", "__tests__"], + "include": ["src/**/*"] +} diff --git a/code/lib/core-webpack/tsconfig.json b/code/lib/core-webpack/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/lib/core-webpack/tsconfig.json +++ b/code/lib/core-webpack/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/lib/csf-plugin/tsconfig.json b/code/lib/csf-plugin/tsconfig.json index a84636449555..601bf5b99bf4 100644 --- a/code/lib/csf-plugin/tsconfig.json +++ b/code/lib/csf-plugin/tsconfig.json @@ -1,8 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - - "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] diff --git a/code/lib/instrumenter/tsconfig.json b/code/lib/instrumenter/tsconfig.json index 5d3a4e53d2f6..52bb92946e15 100644 --- a/code/lib/instrumenter/tsconfig.json +++ b/code/lib/instrumenter/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] diff --git a/code/lib/react-dom-shim/tsconfig.json b/code/lib/react-dom-shim/tsconfig.json index a630f412e8d5..6001b5d8ba6f 100644 --- a/code/lib/react-dom-shim/tsconfig.json +++ b/code/lib/react-dom-shim/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "types": ["node"], "baseUrl": ".", "paths": { diff --git a/code/lib/source-loader/tsconfig.json b/code/lib/source-loader/tsconfig.json index 5d3a4e53d2f6..52bb92946e15 100644 --- a/code/lib/source-loader/tsconfig.json +++ b/code/lib/source-loader/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] diff --git a/code/lib/test/tsconfig.json b/code/lib/test/tsconfig.json index 5d3a4e53d2f6..52bb92946e15 100644 --- a/code/lib/test/tsconfig.json +++ b/code/lib/test/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.json", "include": ["src/**/*"], "compilerOptions": { - "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] diff --git a/code/presets/create-react-app/tsconfig.json b/code/presets/create-react-app/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/presets/create-react-app/tsconfig.json +++ b/code/presets/create-react-app/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/presets/html-webpack/tsconfig.json b/code/presets/html-webpack/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/presets/html-webpack/tsconfig.json +++ b/code/presets/html-webpack/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/presets/preact-webpack/tsconfig.json b/code/presets/preact-webpack/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/presets/preact-webpack/tsconfig.json +++ b/code/presets/preact-webpack/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/presets/react-webpack/tsconfig.json b/code/presets/react-webpack/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/presets/react-webpack/tsconfig.json +++ b/code/presets/react-webpack/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/presets/server-webpack/tsconfig.json b/code/presets/server-webpack/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/presets/server-webpack/tsconfig.json +++ b/code/presets/server-webpack/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/presets/svelte-webpack/tsconfig.json b/code/presets/svelte-webpack/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/presets/svelte-webpack/tsconfig.json +++ b/code/presets/svelte-webpack/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/presets/vue3-webpack/tsconfig.json b/code/presets/vue3-webpack/tsconfig.json index a447bb9b0331..601bf5b99bf4 100644 --- a/code/presets/vue3-webpack/tsconfig.json +++ b/code/presets/vue3-webpack/tsconfig.json @@ -3,12 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*" - ] + "include": ["src/**/*"] } diff --git a/code/renderers/html/tsconfig.json b/code/renderers/html/tsconfig.json index e9c2245a73ea..3d6d1ae67af4 100644 --- a/code/renderers/html/tsconfig.json +++ b/code/renderers/html/tsconfig.json @@ -3,13 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*", - "template/**/*" - ] + "include": ["src/**/*", "template/**/*"] } diff --git a/code/renderers/preact/tsconfig.json b/code/renderers/preact/tsconfig.json index e9c2245a73ea..3d6d1ae67af4 100644 --- a/code/renderers/preact/tsconfig.json +++ b/code/renderers/preact/tsconfig.json @@ -3,13 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*", - "template/**/*" - ] + "include": ["src/**/*", "template/**/*"] } diff --git a/code/renderers/react/tsconfig.json b/code/renderers/react/tsconfig.json index d8c2c384f8c0..cfc601baa370 100644 --- a/code/renderers/react/tsconfig.json +++ b/code/renderers/react/tsconfig.json @@ -4,13 +4,8 @@ "allowJs": true, "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*", - "template/**/*" - ] + "include": ["src/**/*", "template/**/*"] } diff --git a/code/renderers/server/tsconfig.json b/code/renderers/server/tsconfig.json index 8bc369c99fa1..3d6d1ae67af4 100644 --- a/code/renderers/server/tsconfig.json +++ b/code/renderers/server/tsconfig.json @@ -3,13 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*", - "template/**/*" - ] -} \ No newline at end of file + "include": ["src/**/*", "template/**/*"] +} diff --git a/code/renderers/svelte/tsconfig.json b/code/renderers/svelte/tsconfig.json index 4f47dc0fbcf8..9b9863bd89b3 100644 --- a/code/renderers/svelte/tsconfig.json +++ b/code/renderers/svelte/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.json", "compilerOptions": { "module": "ESNext", - "baseUrl": ".", "paths": { diff --git a/code/renderers/vue3/tsconfig.json b/code/renderers/vue3/tsconfig.json index a3e93921921b..32faa236db57 100644 --- a/code/renderers/vue3/tsconfig.json +++ b/code/renderers/vue3/tsconfig.json @@ -4,18 +4,11 @@ "allowJs": true, "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*", - "src/**/*.vue", - "template/**/*", - "template/**/*.vue" - ], + "include": ["src/**/*", "src/**/*.vue", "template/**/*", "template/**/*.vue"], "vueCompilerOptions": { "target": 3 } -} \ No newline at end of file +} diff --git a/code/renderers/web-components/tsconfig.json b/code/renderers/web-components/tsconfig.json index e9c2245a73ea..3d6d1ae67af4 100644 --- a/code/renderers/web-components/tsconfig.json +++ b/code/renderers/web-components/tsconfig.json @@ -3,13 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "storybook/internal/*": [ - "../../lib/cli/core/*" - ] + "storybook/internal/*": ["../../lib/cli/core/*"] } }, - "include": [ - "src/**/*", - "template/**/*" - ] + "include": ["src/**/*", "template/**/*"] } diff --git a/code/tsconfig.json b/code/tsconfig.json index 4b44860d18d3..20fd39d80a3a 100644 --- a/code/tsconfig.json +++ b/code/tsconfig.json @@ -9,11 +9,7 @@ "incremental": false, "isolatedModules": true, "jsx": "react", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], + "lib": ["dom", "dom.iterable", "esnext"], "module": "CommonJS", "moduleResolution": "Node", "noImplicitAny": true, @@ -23,10 +19,5 @@ "strictBindCallApply": true, "target": "ES2020" }, - "exclude": [ - "dist", - "**/dist", - "node_modules", - "**/node_modules" - ] -} \ No newline at end of file + "exclude": ["dist", "**/dist", "node_modules", "**/node_modules"] +} From 4aa740c767794efc01d5498ec887e1049f6525f3 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 2 Jul 2024 21:59:04 +0200 Subject: [PATCH 11/86] cleanup --- code/frameworks/html-vite/tsconfig.json | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/code/frameworks/html-vite/tsconfig.json b/code/frameworks/html-vite/tsconfig.json index a855e78d4f0e..18f9fd1b95b3 100644 --- a/code/frameworks/html-vite/tsconfig.json +++ b/code/frameworks/html-vite/tsconfig.json @@ -1,14 +1,12 @@ { - "extends": "../../tsconfig.json", "compilerOptions": { - "rootDir": "./src", - "types": ["node"], - "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] - } + }, + "rootDir": "./src" }, - "include": ["src/**/*"], - "exclude": ["src/**/*.test.*", "src/**/__testfixtures__/**"] + "exclude": ["src/**/*.test.*", "src/**/__testfixtures__/**"], + "extends": "../../tsconfig.json", + "include": ["src/**/*"] } From dc92a56c84239c3aa7702d2d43d1ed52b5dae74a Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 2 Jul 2024 22:03:20 +0200 Subject: [PATCH 12/86] cleanup --- code/frameworks/preact-vite/tsconfig.json | 10 ++++------ code/frameworks/react-vite/tsconfig.json | 8 +++----- code/frameworks/svelte-vite/tsconfig.json | 8 +++----- code/frameworks/sveltekit/tsconfig.json | 8 +++----- code/frameworks/vue3-vite/tsconfig.json | 8 +++----- code/frameworks/web-components-vite/tsconfig.json | 8 +++----- code/lib/cli/tsconfig.json | 5 +---- code/lib/react-dom-shim/tsconfig.json | 1 - 8 files changed, 20 insertions(+), 36 deletions(-) diff --git a/code/frameworks/preact-vite/tsconfig.json b/code/frameworks/preact-vite/tsconfig.json index 4bfdfb0b0ebc..e342f997283b 100644 --- a/code/frameworks/preact-vite/tsconfig.json +++ b/code/frameworks/preact-vite/tsconfig.json @@ -1,15 +1,13 @@ { - "extends": "../../tsconfig.json", "compilerOptions": { - "rootDir": "./src", - "types": ["node"], + "baseUrl": ".", "jsx": "react-jsx", "jsxImportSource": "preact", - - "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] - } + }, + "rootDir": "./src" }, + "extends": "../../tsconfig.json", "include": ["src/**/*"] } diff --git a/code/frameworks/react-vite/tsconfig.json b/code/frameworks/react-vite/tsconfig.json index 65c2a458c1a5..c749496d9a6e 100644 --- a/code/frameworks/react-vite/tsconfig.json +++ b/code/frameworks/react-vite/tsconfig.json @@ -1,13 +1,11 @@ { - "extends": "../../tsconfig.json", "compilerOptions": { - "rootDir": "./src", - "types": ["node"], - "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] - } + }, + "rootDir": "./src" }, + "extends": "../../tsconfig.json", "include": ["src/**/*"] } diff --git a/code/frameworks/svelte-vite/tsconfig.json b/code/frameworks/svelte-vite/tsconfig.json index 65c2a458c1a5..c749496d9a6e 100644 --- a/code/frameworks/svelte-vite/tsconfig.json +++ b/code/frameworks/svelte-vite/tsconfig.json @@ -1,13 +1,11 @@ { - "extends": "../../tsconfig.json", "compilerOptions": { - "rootDir": "./src", - "types": ["node"], - "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] - } + }, + "rootDir": "./src" }, + "extends": "../../tsconfig.json", "include": ["src/**/*"] } diff --git a/code/frameworks/sveltekit/tsconfig.json b/code/frameworks/sveltekit/tsconfig.json index 65c2a458c1a5..c749496d9a6e 100644 --- a/code/frameworks/sveltekit/tsconfig.json +++ b/code/frameworks/sveltekit/tsconfig.json @@ -1,13 +1,11 @@ { - "extends": "../../tsconfig.json", "compilerOptions": { - "rootDir": "./src", - "types": ["node"], - "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] - } + }, + "rootDir": "./src" }, + "extends": "../../tsconfig.json", "include": ["src/**/*"] } diff --git a/code/frameworks/vue3-vite/tsconfig.json b/code/frameworks/vue3-vite/tsconfig.json index 65c2a458c1a5..c749496d9a6e 100644 --- a/code/frameworks/vue3-vite/tsconfig.json +++ b/code/frameworks/vue3-vite/tsconfig.json @@ -1,13 +1,11 @@ { - "extends": "../../tsconfig.json", "compilerOptions": { - "rootDir": "./src", - "types": ["node"], - "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] - } + }, + "rootDir": "./src" }, + "extends": "../../tsconfig.json", "include": ["src/**/*"] } diff --git a/code/frameworks/web-components-vite/tsconfig.json b/code/frameworks/web-components-vite/tsconfig.json index 65c2a458c1a5..c749496d9a6e 100644 --- a/code/frameworks/web-components-vite/tsconfig.json +++ b/code/frameworks/web-components-vite/tsconfig.json @@ -1,13 +1,11 @@ { - "extends": "../../tsconfig.json", "compilerOptions": { - "rootDir": "./src", - "types": ["node"], - "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] - } + }, + "rootDir": "./src" }, + "extends": "../../tsconfig.json", "include": ["src/**/*"] } diff --git a/code/lib/cli/tsconfig.json b/code/lib/cli/tsconfig.json index 9bc502c48f80..f5ab5afaf6a4 100644 --- a/code/lib/cli/tsconfig.json +++ b/code/lib/cli/tsconfig.json @@ -1,13 +1,10 @@ { - "extends": "../../tsconfig.json", "compilerOptions": { - "types": ["node"], - - "noEmit": true, "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] } }, + "extends": "../../tsconfig.json", "include": ["src/**/*"] } diff --git a/code/lib/react-dom-shim/tsconfig.json b/code/lib/react-dom-shim/tsconfig.json index 6001b5d8ba6f..601bf5b99bf4 100644 --- a/code/lib/react-dom-shim/tsconfig.json +++ b/code/lib/react-dom-shim/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "types": ["node"], "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] From 4e900b5f0eb85d2b1f0a9d26e2585bbe3661f90d Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 2 Jul 2024 23:49:54 +0200 Subject: [PATCH 13/86] revert strictness --- code/addons/interactions/tsconfig.json | 1 + .../components/notifications/NotificationItem.tsx | 4 ++-- .../src/manager/components/sidebar/SearchResults.tsx | 4 ++-- .../modules/preview-web/render/StoryRender.ts | 3 ++- .../core/src/preview-api/modules/store/StoryStore.ts | 4 ++-- .../modules/store/csf/portable-stories.ts | 4 ++-- code/lib/blocks/src/blocks/ArgTypes.tsx | 6 ------ code/lib/blocks/src/blocks/Controls.tsx | 3 --- code/lib/blocks/src/blocks/Description.tsx | 1 - code/lib/blocks/src/blocks/DocsContainer.tsx | 1 - code/lib/blocks/src/blocks/Source.tsx | 6 ------ code/lib/blocks/src/blocks/SourceContainer.tsx | 1 - code/lib/blocks/src/blocks/Story.tsx | 4 ---- code/lib/blocks/src/blocks/Subtitle.tsx | 1 - code/lib/blocks/src/blocks/Title.tsx | 2 -- code/lib/blocks/src/blocks/external/ExternalDocs.tsx | 1 - code/lib/blocks/src/blocks/mdx.tsx | 1 - .../blocks/src/components/ArgsTable/ArgsTable.tsx | 7 ------- code/lib/blocks/src/components/Preview.tsx | 4 ---- code/lib/blocks/src/components/Source.tsx | 1 - code/lib/blocks/src/components/Story.tsx | 1 - code/lib/blocks/src/controls/Color.tsx | 12 ------------ code/lib/blocks/src/controls/Date.tsx | 2 -- code/lib/blocks/src/controls/Files.tsx | 2 -- code/lib/blocks/src/controls/Number.tsx | 5 ----- code/lib/blocks/src/controls/Object.tsx | 5 ----- code/lib/blocks/src/controls/Range.tsx | 2 -- code/lib/blocks/src/controls/Text.tsx | 1 - code/lib/blocks/tsconfig.json | 8 ++++---- code/lib/codemod/tsconfig.json | 1 + code/package.json | 1 - .../ts-function-component/input.tsx | 2 ++ code/renderers/react/tsconfig.json | 2 +- .../docs/tests-meta-components/meta-components.ts | 2 +- code/renderers/web-components/tsconfig.json | 1 + code/yarn.lock | 8 -------- scripts/task.ts | 7 ++++--- 37 files changed, 25 insertions(+), 96 deletions(-) diff --git a/code/addons/interactions/tsconfig.json b/code/addons/interactions/tsconfig.json index 601bf5b99bf4..2448952ae37a 100644 --- a/code/addons/interactions/tsconfig.json +++ b/code/addons/interactions/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { + "strict": false, "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] diff --git a/code/core/src/manager/components/notifications/NotificationItem.tsx b/code/core/src/manager/components/notifications/NotificationItem.tsx index b4450acafdc7..f912828783a2 100644 --- a/code/core/src/manager/components/notifications/NotificationItem.tsx +++ b/code/core/src/manager/components/notifications/NotificationItem.tsx @@ -59,7 +59,7 @@ const Notification = styled.div<{ duration?: number }>( } ); -const NotificationWithInteractiveStates = styled(Notification)(() => ({ +const NotificationWithInteractiveStates = styled(Notification)({ cursor: 'pointer', border: 'none', outline: 'none', @@ -80,7 +80,7 @@ const NotificationWithInteractiveStates = styled(Notification)(() => ({ boxShadow: 'rgba(2,156,253,1) 0 0 0 1px inset, 0 1px 3px 0 rgba(30,167,253,0.5), 0 2px 5px 0 rgba(0,0,0,0.05), 0 5px 15px 0 rgba(0,0,0,0.1)', }, -})); +}); const NotificationButton = NotificationWithInteractiveStates.withComponent('div'); const NotificationLink = NotificationWithInteractiveStates.withComponent(Link); diff --git a/code/core/src/manager/components/sidebar/SearchResults.tsx b/code/core/src/manager/components/sidebar/SearchResults.tsx index 80d5c43bba79..0259bd2a92e9 100644 --- a/code/core/src/manager/components/sidebar/SearchResults.tsx +++ b/code/core/src/manager/components/sidebar/SearchResults.tsx @@ -53,10 +53,10 @@ const IconWrapper = styled.div({ marginTop: 2, }); -const ResultRowContent = styled.div(() => ({ +const ResultRowContent = styled.div({ display: 'flex', flexDirection: 'column', -})); +}); const NoResults = styled.div(({ theme }) => ({ marginTop: 20, diff --git a/code/core/src/preview-api/modules/preview-web/render/StoryRender.ts b/code/core/src/preview-api/modules/preview-web/render/StoryRender.ts index 451f7a24e7de..f5f4f4f4afdf 100644 --- a/code/core/src/preview-api/modules/preview-web/render/StoryRender.ts +++ b/code/core/src/preview-api/modules/preview-web/render/StoryRender.ts @@ -20,6 +20,7 @@ import type { StoryRenderOptions, TeardownRenderToCanvas, } from '@storybook/core/types'; +import type { Canvas } from '@storybook/csf'; const { AbortController } = globalThis; @@ -188,7 +189,7 @@ export class StoryRender implements Render runStep(label, play, context), context: null!, - canvas: {}, + canvas: {} as Canvas, }; context.context = context; diff --git a/code/core/src/preview-api/modules/store/StoryStore.ts b/code/core/src/preview-api/modules/store/StoryStore.ts index 78d3d119bfee..0b23f1b63d39 100644 --- a/code/core/src/preview-api/modules/store/StoryStore.ts +++ b/code/core/src/preview-api/modules/store/StoryStore.ts @@ -27,7 +27,7 @@ import { normalizeProjectAnnotations, prepareContext, } from './csf'; -import type { CleanupCallback } from '@storybook/csf'; +import type { Canvas, CleanupCallback } from '@storybook/csf'; import type { BoundStory, CSFFile, @@ -374,7 +374,7 @@ export class StoryStore { loaded: {}, step: (label, play) => story.runStep(label, play, context), context: null!, - canvas: {}, + canvas: {} as Canvas, viewMode: 'story', } as StoryContext; diff --git a/code/core/src/preview-api/modules/store/csf/portable-stories.ts b/code/core/src/preview-api/modules/store/csf/portable-stories.ts index 41d22da5bac3..6314276173eb 100644 --- a/code/core/src/preview-api/modules/store/csf/portable-stories.ts +++ b/code/core/src/preview-api/modules/store/csf/portable-stories.ts @@ -1,6 +1,6 @@ /* eslint-disable no-underscore-dangle */ /* eslint-disable @typescript-eslint/naming-convention */ -import { type CleanupCallback, isExportStory } from '@storybook/csf'; +import { type CleanupCallback, isExportStory, type Canvas } from '@storybook/csf'; import { dedent } from 'ts-dedent'; import type { Renderer, @@ -106,7 +106,7 @@ export function composeStory story.runStep(label, play, context), canvasElement: globalThis?.document?.body, context: null!, - canvas: {}, + canvas: {} as Canvas, ...story, }; diff --git a/code/lib/blocks/src/blocks/ArgTypes.tsx b/code/lib/blocks/src/blocks/ArgTypes.tsx index ed68fc55c639..bfab62aa23df 100644 --- a/code/lib/blocks/src/blocks/ArgTypes.tsx +++ b/code/lib/blocks/src/blocks/ArgTypes.tsx @@ -29,7 +29,6 @@ function extractComponentArgTypes( if (!extractArgTypes) { throw new Error(ArgsTableError.ARGS_UNSUPPORTED); } - // @ts-expect-error (non-strict) return extractArgTypes(component); } @@ -40,7 +39,6 @@ function getArgTypesFromResolved(resolved: ReturnType) { projectAnnotations: { parameters }, } = resolved; return { - // @ts-expect-error (non-strict) argTypes: extractComponentArgTypes(component, parameters), parameters, component, @@ -69,7 +67,6 @@ export const ArgTypes: FC = (props) => { } const resolved = useOf(of || 'meta'); const { argTypes, parameters, component, subcomponents } = getArgTypesFromResolved(resolved); - // @ts-expect-error (non-strict) const argTypesParameters = parameters.docs?.argTypes || ({} as ArgTypesParameters); const include = props.include ?? argTypesParameters.include; @@ -78,7 +75,6 @@ export const ArgTypes: FC = (props) => { const filteredArgTypes = filterArgTypes(argTypes, include, exclude); - // @ts-expect-error (non-strict) const hasSubcomponents = Boolean(subcomponents) && Object.keys(subcomponents).length > 0; if (!hasSubcomponents) { @@ -87,11 +83,9 @@ export const ArgTypes: FC = (props) => { const mainComponentName = getComponentName(component); const subcomponentTabs = Object.fromEntries( - // @ts-expect-error (non-strict) Object.entries(subcomponents).map(([key, comp]) => [ key, { - // @ts-expect-error (non-strict) rows: filterArgTypes(extractComponentArgTypes(comp, parameters), include, exclude), sort, }, diff --git a/code/lib/blocks/src/blocks/Controls.tsx b/code/lib/blocks/src/blocks/Controls.tsx index aa4cd11ac458..a4684ded1ad4 100644 --- a/code/lib/blocks/src/blocks/Controls.tsx +++ b/code/lib/blocks/src/blocks/Controls.tsx @@ -32,7 +32,6 @@ function extractComponentArgTypes( if (!extractArgTypes) { throw new Error(ArgsTableError.ARGS_UNSUPPORTED); } - // @ts-expect-error (non-strict) return extractArgTypes(component); } @@ -56,7 +55,6 @@ export const Controls: FC = (props) => { const filteredArgTypes = filterArgTypes(argTypes, include, exclude); - // @ts-expect-error (non-strict) const hasSubcomponents = Boolean(subcomponents) && Object.keys(subcomponents).length > 0; if (!hasSubcomponents) { @@ -77,7 +75,6 @@ export const Controls: FC = (props) => { const mainComponentName = getComponentName(component); const subcomponentTabs = Object.fromEntries( - // @ts-expect-error (non-strict) Object.entries(subcomponents).map(([key, comp]) => [ key, { diff --git a/code/lib/blocks/src/blocks/Description.tsx b/code/lib/blocks/src/blocks/Description.tsx index 28dcd4b71a79..99b9cf7ce75b 100644 --- a/code/lib/blocks/src/blocks/Description.tsx +++ b/code/lib/blocks/src/blocks/Description.tsx @@ -43,7 +43,6 @@ const getDescriptionFromResolvedOf = (resolvedOf: ReturnType): str projectAnnotations: { parameters }, } = resolvedOf; return ( - // @ts-expect-error (non-strict) parameters.docs?.extractComponentDescription?.(component, { component, parameters, diff --git a/code/lib/blocks/src/blocks/DocsContainer.tsx b/code/lib/blocks/src/blocks/DocsContainer.tsx index e1da8ba6d666..e5ad466f7f6a 100644 --- a/code/lib/blocks/src/blocks/DocsContainer.tsx +++ b/code/lib/blocks/src/blocks/DocsContainer.tsx @@ -54,7 +54,6 @@ export const DocsContainer: FC> = ({ return ( - {/* @ts-expect-error (non-strict) */} : null} diff --git a/code/lib/blocks/src/blocks/Source.tsx b/code/lib/blocks/src/blocks/Source.tsx index a5c92dde48c2..fda733fc8a5b 100644 --- a/code/lib/blocks/src/blocks/Source.tsx +++ b/code/lib/blocks/src/blocks/Source.tsx @@ -125,14 +125,12 @@ export const useSourceProps = ( } } - // @ts-expect-error (non-strict) const sourceParameters = (story?.parameters?.docs?.source || {}) as SourceParameters; const { code } = props; // We will fall back to `sourceParameters.code`, but per story below let format = props.format ?? sourceParameters.format; const language = props.language ?? sourceParameters.language ?? 'jsx'; const dark = props.dark ?? sourceParameters.dark ?? false; - // @ts-expect-error (non-strict) if (!code && !story) { return { error: SourceError.SOURCE_UNAVAILABLE }; } @@ -144,7 +142,6 @@ export const useSourceProps = ( dark, }; } - // @ts-expect-error (non-strict) const storyContext = docsContext.getStoryContext(story); // eslint-disable-next-line no-underscore-dangle @@ -152,16 +149,13 @@ export const useSourceProps = ( ? storyContext.initialArgs : storyContext.unmappedArgs; - // @ts-expect-error (non-strict) const source = getStorySource(story.id, argsForSource, sourceContext); - // @ts-expect-error (non-strict) format = source.format ?? story.parameters.docs?.source?.format ?? false; return { code: getSnippet({ snippet: source.code, storyContext: { ...storyContext, args: argsForSource }, - // @ts-expect-error (non-strict) typeFromProps: props.type, transformFromProps: props.transform, }), diff --git a/code/lib/blocks/src/blocks/SourceContainer.tsx b/code/lib/blocks/src/blocks/SourceContainer.tsx index a692903d67a9..149d544d705e 100644 --- a/code/lib/blocks/src/blocks/SourceContainer.tsx +++ b/code/lib/blocks/src/blocks/SourceContainer.tsx @@ -44,7 +44,6 @@ export const SourceContainer: FC { const handleSnippetRendered = ( idOrEvent: StoryId | SnippetRenderedEvent, - // @ts-expect-error (non-strict) inputSource: string = null, inputFormat: SyntaxHighlighterFormatTypes = false ) => { diff --git a/code/lib/blocks/src/blocks/Story.tsx b/code/lib/blocks/src/blocks/Story.tsx index 9995543b1769..92477a9a8f3f 100644 --- a/code/lib/blocks/src/blocks/Story.tsx +++ b/code/lib/blocks/src/blocks/Story.tsx @@ -90,7 +90,6 @@ export const getStoryProps = ( const storyParameters = (docs.story || {}) as StoryParameters & { iframeHeight?: string }; if (docs.disable) { - // @ts-expect-error (non-strict) return null; } @@ -103,7 +102,6 @@ export const getStoryProps = ( const height = props.height ?? storyParameters.height; const autoplay = props.autoplay ?? storyParameters.autoplay ?? false; return { - // @ts-expect-error (non-strict) story, inline: true, height, @@ -112,14 +110,12 @@ export const getStoryProps = ( forceInitialArgs: !!props.__forceInitialArgs, // eslint-disable-next-line no-underscore-dangle primary: !!props.__primary, - // @ts-expect-error (non-strict) renderStoryToElement: context.renderStoryToElement, }; } const height = props.height ?? storyParameters.height ?? storyParameters.iframeHeight ?? '100px'; return { - // @ts-expect-error (non-strict) story, inline: false, height, diff --git a/code/lib/blocks/src/blocks/Subtitle.tsx b/code/lib/blocks/src/blocks/Subtitle.tsx index 1b8a76f9fb9a..af80a72bfb06 100644 --- a/code/lib/blocks/src/blocks/Subtitle.tsx +++ b/code/lib/blocks/src/blocks/Subtitle.tsx @@ -29,7 +29,6 @@ export const Subtitle: FunctionComponent = (props) => { try { preparedMeta = useOf(of || 'meta', ['meta']).preparedMeta; } catch (error) { - // @ts-expect-error (non-strict) if (children && !error.message.includes('did you forget to use ?')) { // ignore error about unattached CSF since we can still render children throw error; diff --git a/code/lib/blocks/src/blocks/Title.tsx b/code/lib/blocks/src/blocks/Title.tsx index 3d7bd99455cf..4df5139ef703 100644 --- a/code/lib/blocks/src/blocks/Title.tsx +++ b/code/lib/blocks/src/blocks/Title.tsx @@ -36,14 +36,12 @@ export const Title: FunctionComponent = (props) => { try { preparedMeta = useOf(of || 'meta', ['meta']).preparedMeta; } catch (error) { - // @ts-expect-error (non-strict) if (children && !error.message.includes('did you forget to use ?')) { // ignore error about unattached CSF since we can still render children throw error; } } - // @ts-expect-error (non-strict) const content = children || extractTitle(preparedMeta?.title); return content ? {content} : null; diff --git a/code/lib/blocks/src/blocks/external/ExternalDocs.tsx b/code/lib/blocks/src/blocks/external/ExternalDocs.tsx index b18bbbdb21c2..0e3bf4dfa079 100644 --- a/code/lib/blocks/src/blocks/external/ExternalDocs.tsx +++ b/code/lib/blocks/src/blocks/external/ExternalDocs.tsx @@ -31,6 +31,5 @@ export function ExternalDocs({ const TDocs = Docs as typeof Docs; - // @ts-expect-error (non-strict) return ; } diff --git a/code/lib/blocks/src/blocks/mdx.tsx b/code/lib/blocks/src/blocks/mdx.tsx index 8cbcf27a8df5..146e8d292d6f 100644 --- a/code/lib/blocks/src/blocks/mdx.tsx +++ b/code/lib/blocks/src/blocks/mdx.tsx @@ -124,7 +124,6 @@ export const AnchorMdx: FC> = (props) => { event.preventDefault(); // use the A element's href, which has been modified for // local paths without a `?path=` query param prefix - // @ts-expect-error (non-strict) navigate(context, event.currentTarget.getAttribute('href')); } }} diff --git a/code/lib/blocks/src/components/ArgsTable/ArgsTable.tsx b/code/lib/blocks/src/components/ArgsTable/ArgsTable.tsx index 8737d8b13fcb..0bac6d042a30 100644 --- a/code/lib/blocks/src/components/ArgsTable/ArgsTable.tsx +++ b/code/lib/blocks/src/components/ArgsTable/ArgsTable.tsx @@ -183,12 +183,9 @@ export type SortType = 'alpha' | 'requiredFirst' | 'none'; type SortFn = (a: ArgType, b: ArgType) => number; const sortFns: Record = { - // @ts-expect-error (non-strict) alpha: (a: ArgType, b: ArgType) => a.name.localeCompare(b.name), requiredFirst: (a: ArgType, b: ArgType) => - // @ts-expect-error (non-strict) Number(!!b.type?.required) - Number(!!a.type?.required) || a.name.localeCompare(b.name), - // @ts-expect-error (non-strict) none: undefined, }; @@ -271,14 +268,12 @@ const groupRows = (rows: ArgType, sort: SortType) => { }; const sorted = { - // @ts-expect-error (non-strict) ungrouped: sections.ungrouped.sort(sortFn), ungroupedSubsections: sortSubsection(sections.ungroupedSubsections), sections: Object.keys(sections.sections).reduce>( (acc, cur) => ({ ...acc, [cur]: { - // @ts-expect-error (non-strict) ungrouped: sections.sections[cur].ungrouped.sort(sortFn), subsections: sortSubsection(sections.sections[cur].subsections), }, @@ -301,7 +296,6 @@ const safeIncludeConditionalArg = (row: ArgType, args: Args, globals: Globals) = try { return includeConditionalArg(row, args, globals); } catch (err) { - // @ts-expect-error (non-strict) once.warn(err.message); return false; } @@ -338,7 +332,6 @@ export const ArgsTable: FC = (props) => { // This happen when you load the manager and the story is not yet loaded if (isLoading) return ; - // @ts-expect-error (non-strict) const { rows, args, globals } = 'rows' in props && props; const groups = groupRows( pickBy( diff --git a/code/lib/blocks/src/components/Preview.tsx b/code/lib/blocks/src/components/Preview.tsx index c5dfa996b5cb..5578c2f90590 100644 --- a/code/lib/blocks/src/components/Preview.tsx +++ b/code/lib/blocks/src/components/Preview.tsx @@ -92,7 +92,6 @@ const StyledSource = styled(Source)(({ theme }) => ({ })); const PreviewContainer = styled.div( - // @ts-expect-error (non-strict) ({ theme, withSource, isExpanded }) => ({ position: 'relative', overflow: 'hidden', @@ -122,7 +121,6 @@ const getSource = ( switch (true) { case !!(withSource && withSource.error): { return { - // @ts-expect-error (non-strict) source: null, actionItem: { title: 'No code available', @@ -196,7 +194,6 @@ export const Preview: FC = ({ ...props }) => { const [expanded, setExpanded] = useState(isExpanded); - // @ts-expect-error (non-strict) const { source, actionItem } = getSource(withSource, expanded, setExpanded); const [scale, setScale] = useState(1); const previewClasses = [className].concat(['sbdocs', 'sbdocs-preview', 'sb-unstyled']); @@ -225,7 +222,6 @@ export const Preview: FC = ({ e.preventDefault(); if (additionalActionItems.filter((item) => item.title === 'Copied').length === 0) { - // @ts-expect-error (non-strict) copyToClipboard(source.props.code).then(() => { setAdditionalActionItems([ ...additionalActionItems, diff --git a/code/lib/blocks/src/components/Source.tsx b/code/lib/blocks/src/components/Source.tsx index 32b4ad0dfac3..2131a934481e 100644 --- a/code/lib/blocks/src/components/Source.tsx +++ b/code/lib/blocks/src/components/Source.tsx @@ -114,7 +114,6 @@ const Source: FunctionComponent = ({ bordered copyable format={format} - // @ts-expect-error (non-strict) language={language} className="docblock-source sb-unstyled" {...rest} diff --git a/code/lib/blocks/src/components/Story.tsx b/code/lib/blocks/src/components/Story.tsx index 0111d8ebd9ae..fb7622703ef8 100644 --- a/code/lib/blocks/src/components/Story.tsx +++ b/code/lib/blocks/src/components/Story.tsx @@ -80,7 +80,6 @@ const InlineStory: FunctionComponent = (props) => { )} { min-height: ${height}; transform: translateZ(0); overflow: auto }`} ) : null} {showLoader && } - {/* @ts-expect-error (Type 'undefined' is not assignable to type 'HTMLDivElement | null') */}
); diff --git a/code/lib/blocks/src/controls/Color.tsx b/code/lib/blocks/src/controls/Color.tsx index 2e924f9d9bc6..68eb8d3678b5 100644 --- a/code/lib/blocks/src/controls/Color.tsx +++ b/code/lib/blocks/src/controls/Color.tsx @@ -231,7 +231,6 @@ const useColorInput = ( }, [initialValue]); const realValue = useMemo( - // @ts-expect-error (non-strict) () => getRealValue(value, color, colorSpace).toLowerCase(), [value, color, colorSpace] ); @@ -245,7 +244,6 @@ const useColorInput = ( if (v === '') { setColor(undefined); - // @ts-expect-error (non-strict) onChange(undefined); } @@ -299,7 +297,6 @@ const usePresets = ( const addPreset: (color: ParsedColor) => void = useCallback( (color) => { if (!color?.valid) return; - // @ts-expect-error (non-strict) if (presets.some((preset) => id(preset[colorSpace]) === id(color[colorSpace]))) return; setSelectedColors((arr) => arr.concat(color)); }, @@ -325,7 +322,6 @@ export const ColorControl: FC = ({ initialValue, debouncedOnChange ); - // @ts-expect-error (non-strict) const { presets, addPreset } = usePresets(presetColors, color, colorSpace); const Picker = ColorPicker[colorSpace]; @@ -335,10 +331,8 @@ export const ColorControl: FC = ({ addPreset(color)} tooltip={ @@ -350,19 +344,13 @@ export const ColorControl: FC = ({ {presets.map((preset, index: number) => ( } > updateValue(preset.value)} /> diff --git a/code/lib/blocks/src/controls/Date.tsx b/code/lib/blocks/src/controls/Date.tsx index 8c3a8fdcabbd..6949f2dae262 100644 --- a/code/lib/blocks/src/controls/Date.tsx +++ b/code/lib/blocks/src/controls/Date.tsx @@ -85,7 +85,6 @@ export const DateControl: FC = ({ name, value, onChange, onFocus, onB const onDateChange = (e: ChangeEvent) => { if (!e.target.value) return onChange(); const parsed = parseDate(e.target.value); - // @ts-expect-error (non-strict) const result = new Date(value); result.setFullYear(parsed.getFullYear(), parsed.getMonth(), parsed.getDate()); const time = result.getTime(); @@ -96,7 +95,6 @@ export const DateControl: FC = ({ name, value, onChange, onFocus, onB const onTimeChange = (e: ChangeEvent) => { if (!e.target.value) return onChange(); const parsed = parseTime(e.target.value); - // @ts-expect-error (non-strict) const result = new Date(value); result.setHours(parsed.getHours()); result.setMinutes(parsed.getMinutes()); diff --git a/code/lib/blocks/src/controls/Files.tsx b/code/lib/blocks/src/controls/Files.tsx index 6a4fa199aaee..2517e3c4ff48 100644 --- a/code/lib/blocks/src/controls/Files.tsx +++ b/code/lib/blocks/src/controls/Files.tsx @@ -49,14 +49,12 @@ export const FilesControl: FC = ({ } const fileUrls = Array.from(e.target.files).map((file) => URL.createObjectURL(file)); onChange(fileUrls); - // @ts-expect-error (non-strict) revokeOldUrls(value); } // Added useEffect hook to reset the file value when value is null useEffect(() => { if (value == null && inputElement.current) { - // @ts-expect-error (non-strict) inputElement.current.value = null; } }, [value, name]); diff --git a/code/lib/blocks/src/controls/Number.tsx b/code/lib/blocks/src/controls/Number.tsx index 5ffe486a10d7..9d75a80e8282 100644 --- a/code/lib/blocks/src/controls/Number.tsx +++ b/code/lib/blocks/src/controls/Number.tsx @@ -36,7 +36,6 @@ export const NumberControl: FC = ({ }) => { const [inputValue, setInputValue] = useState(typeof value === 'number' ? value : ''); const [forceVisible, setForceVisible] = useState(false); - // @ts-expect-error (non-strict) const [parseError, setParseError] = useState(null); const readonly = !!argType?.table?.readonly; @@ -49,7 +48,6 @@ export const NumberControl: FC = ({ setParseError(new Error(`'${event.target.value}' is not a number`)); } else { onChange(result); - // @ts-expect-error (non-strict) setParseError(null); } }, @@ -65,7 +63,6 @@ export const NumberControl: FC = ({ const htmlElRef = useRef(null); useEffect(() => { if (forceVisible && htmlElRef.current) { - // @ts-expect-error (non-strict) htmlElRef.current.select(); } }, [forceVisible]); @@ -73,7 +70,6 @@ export const NumberControl: FC = ({ useEffect(() => { const newInputValue = typeof value === 'number' ? value : ''; if (inputValue !== newInputValue) { - // @ts-expect-error (non-strict) setInputValue(value); } }, [value]); @@ -102,7 +98,6 @@ export const NumberControl: FC = ({ size="flex" placeholder="Edit number..." value={inputValue} - // @ts-expect-error (non-strict) valid={parseError ? 'error' : null} autoFocus={forceVisible} readOnly={readonly} diff --git a/code/lib/blocks/src/controls/Object.tsx b/code/lib/blocks/src/controls/Object.tsx index c5917b3f5a7b..1a1cc0a33c9a 100644 --- a/code/lib/blocks/src/controls/Object.tsx +++ b/code/lib/blocks/src/controls/Object.tsx @@ -250,7 +250,6 @@ export const ObjectControl: FC = ({ name, value, onChange, argType const hasData = data !== null && data !== undefined; const [showRaw, setShowRaw] = useState(!hasData); - // @ts-expect-error (non-strict) const [parseError, setParseError] = useState(null); const readonly = !!argType?.table?.readonly; const updateRaw: (raw: string) => void = useCallback( @@ -259,10 +258,8 @@ export const ObjectControl: FC = ({ name, value, onChange, argType if (raw) { onChange(JSON.parse(raw)); } - // @ts-expect-error (non-strict) setParseError(undefined); } catch (e) { - // @ts-expect-error (non-strict) setParseError(e); } }, @@ -278,7 +275,6 @@ export const ObjectControl: FC = ({ name, value, onChange, argType const htmlElRef = useRef(null); useEffect(() => { if (forceVisible && htmlElRef.current) { - // @ts-expect-error (non-strict) htmlElRef.current.select(); } }, [forceVisible]); @@ -300,7 +296,6 @@ export const ObjectControl: FC = ({ name, value, onChange, argType onBlur={(event: FocusEvent) => updateRaw(event.target.value)} placeholder="Edit JSON string..." autoFocus={forceVisible} - // @ts-expect-error (non-strict) valid={parseError ? 'error' : null} readOnly={readonly} /> diff --git a/code/lib/blocks/src/controls/Range.tsx b/code/lib/blocks/src/controls/Range.tsx index 2021f3f7da0d..6db22a7710cd 100644 --- a/code/lib/blocks/src/controls/Range.tsx +++ b/code/lib/blocks/src/controls/Range.tsx @@ -219,7 +219,6 @@ export const RangeControl: FC = ({ return ( {min} - {/* @ts-expect-error (non-strict) */} = ({ {...{ name, value, min, max, step, onFocus, onBlur }} /> - {/* @ts-expect-error (non-strict) */} {hasValue ? value.toFixed(numberOFDecimalsPlaces) : '--'} / {max} diff --git a/code/lib/blocks/src/controls/Text.tsx b/code/lib/blocks/src/controls/Text.tsx index eedc540109d0..0005651c9360 100644 --- a/code/lib/blocks/src/controls/Text.tsx +++ b/code/lib/blocks/src/controls/Text.tsx @@ -66,7 +66,6 @@ export const TextControl: FC = ({ size="flex" placeholder="Edit string..." autoFocus={forceVisible} - // @ts-expect-error (non-strict) valid={isValid ? null : 'error'} {...{ name, value: isValid ? value : '', onFocus, onBlur }} /> diff --git a/code/lib/blocks/tsconfig.json b/code/lib/blocks/tsconfig.json index 366385927d05..9dad87f67d86 100644 --- a/code/lib/blocks/tsconfig.json +++ b/code/lib/blocks/tsconfig.json @@ -1,12 +1,12 @@ { - "extends": "../../tsconfig.json", "compilerOptions": { - "module": "esnext", - "rootDir": "./src", "baseUrl": ".", + "module": "esnext", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] - } + }, + "strict": false }, + "extends": "../../tsconfig.json", "include": ["src/**/*"] } diff --git a/code/lib/codemod/tsconfig.json b/code/lib/codemod/tsconfig.json index c65bc878c791..18e9e5d0c206 100644 --- a/code/lib/codemod/tsconfig.json +++ b/code/lib/codemod/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.json", "compilerOptions": { "allowJs": true, + "strict": false, "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] diff --git a/code/package.json b/code/package.json index e630be410ba1..50320c65515b 100644 --- a/code/package.json +++ b/code/package.json @@ -203,7 +203,6 @@ "storybook": "workspace:^", "svelte": "^5.0.0-next.65", "ts-dedent": "^2.0.0", - "ts-plugin-sort-import-suggestions": "^1.0.4", "typescript": "^5.4.3", "util": "^0.12.4", "vite": "^4.0.0", diff --git a/code/renderers/react/template/stories/docgen-components/ts-function-component/input.tsx b/code/renderers/react/template/stories/docgen-components/ts-function-component/input.tsx index 193c2e2c71ae..8b983e7e37b1 100644 --- a/code/renderers/react/template/stories/docgen-components/ts-function-component/input.tsx +++ b/code/renderers/react/template/stories/docgen-components/ts-function-component/input.tsx @@ -1,5 +1,7 @@ import React from 'react'; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore (js import not supported in TS) import { imported } from '../imported'; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore (css import not supported in TS) diff --git a/code/renderers/react/tsconfig.json b/code/renderers/react/tsconfig.json index cfc601baa370..4fe616ced184 100644 --- a/code/renderers/react/tsconfig.json +++ b/code/renderers/react/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "allowJs": true, + // "allowJs": true, "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] diff --git a/code/renderers/vue3/src/docs/tests-meta-components/meta-components.ts b/code/renderers/vue3/src/docs/tests-meta-components/meta-components.ts index 9dc0f0d001c5..57d62fa259ca 100644 --- a/code/renderers/vue3/src/docs/tests-meta-components/meta-components.ts +++ b/code/renderers/vue3/src/docs/tests-meta-components/meta-components.ts @@ -1,5 +1,5 @@ import { TypeSystem } from 'storybook/internal/docs-tools'; -import type { VueDocgenInfo } from 'frameworks/vue3-vite/src'; +import type { VueDocgenInfo } from '../../../../../frameworks/vue3-vite/src'; type TestComponent = { __docgenInfo: VueDocgenInfo<'vue-component-meta'> }; diff --git a/code/renderers/web-components/tsconfig.json b/code/renderers/web-components/tsconfig.json index 3d6d1ae67af4..ca9fd89b580a 100644 --- a/code/renderers/web-components/tsconfig.json +++ b/code/renderers/web-components/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.json", "compilerOptions": { "baseUrl": ".", + "resolveJsonModule": true, "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] } diff --git a/code/yarn.lock b/code/yarn.lock index 3f4a97f8e593..d5b02d499d53 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -6557,7 +6557,6 @@ __metadata: storybook: "workspace:^" svelte: "npm:^5.0.0-next.65" ts-dedent: "npm:^2.0.0" - ts-plugin-sort-import-suggestions: "npm:^1.0.4" typescript: "npm:^5.4.3" util: "npm:^0.12.4" vite: "npm:^4.0.0" @@ -26720,13 +26719,6 @@ __metadata: languageName: node linkType: hard -"ts-plugin-sort-import-suggestions@npm:^1.0.4": - version: 1.0.4 - resolution: "ts-plugin-sort-import-suggestions@npm:1.0.4" - checksum: 10c0/1817bdba9861b934af6aeb9403703047041e1944aadf91fde2dfc4ddcc3913bc48570eead52defb34622de94b68488b47e79492da304a6ca604c9a097b2dbe2d - languageName: node - linkType: hard - "ts-pnp@npm:^1.1.6": version: 1.2.0 resolution: "ts-pnp@npm:1.2.0" diff --git a/scripts/task.ts b/scripts/task.ts index 80fa759036b4..018ca4d48030 100644 --- a/scripts/task.ts +++ b/scripts/task.ts @@ -473,8 +473,8 @@ async function run() { if (controller) controllers.push(controller); } catch (err) { invariant(err instanceof Error); - logger.error(`Error running task ${getTaskKey(task)}:`); - logger.error(JSON.stringify(err, null, 2)); + // logger.error(`Error running task ${getTaskKey(task)}:`); + // logger.error(JSON.stringify(err, null, 2)); if (process.env.CI) { logger.error( @@ -500,7 +500,8 @@ async function run() { controller.abort(); }); - throw err; + process.exit(1); + // throw err; } statuses.set(task, task.service ? 'serving' : 'complete'); From de0d42d3f0a9a05bbc44e64c8d88fd18d1b05629 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 2 Jul 2024 23:56:27 +0200 Subject: [PATCH 14/86] fix --- .../ts-function-component-inline-defaults/input.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/code/renderers/react/template/stories/docgen-components/ts-function-component-inline-defaults/input.tsx b/code/renderers/react/template/stories/docgen-components/ts-function-component-inline-defaults/input.tsx index 06b5b62edfdc..7c15b27fad1b 100644 --- a/code/renderers/react/template/stories/docgen-components/ts-function-component-inline-defaults/input.tsx +++ b/code/renderers/react/template/stories/docgen-components/ts-function-component-inline-defaults/input.tsx @@ -1,5 +1,6 @@ import React from 'react'; +// @ts-expect-error (importing a js file) import { imported } from '../imported'; const local = 'local-value'; From 2d89cdc2d7d5adc395600271b23636f9760d8ebe Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 3 Jul 2024 00:10:03 +0200 Subject: [PATCH 15/86] fixes --- code/lib/blocks/package.json | 1 + code/renderers/react/package.json | 1 - code/renderers/react/tsconfig.json | 4 +++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/code/lib/blocks/package.json b/code/lib/blocks/package.json index b3e9d375d507..938b6fd56be9 100644 --- a/code/lib/blocks/package.json +++ b/code/lib/blocks/package.json @@ -62,6 +62,7 @@ }, "devDependencies": { "@storybook/addon-actions": "workspace:*", + "@storybook/react": "workspace:*", "@storybook/test": "workspace:*", "@types/color-convert": "^2.0.0" }, diff --git a/code/renderers/react/package.json b/code/renderers/react/package.json index b4173bb0c1be..3faa9f14929a 100644 --- a/code/renderers/react/package.json +++ b/code/renderers/react/package.json @@ -83,7 +83,6 @@ "util-deprecate": "^1.0.2" }, "devDependencies": { - "@storybook/blocks": "workspace:*", "@storybook/test": "workspace:*", "@types/babel-plugin-react-docgen": "^4", "@types/semver": "^7.3.4", diff --git a/code/renderers/react/tsconfig.json b/code/renderers/react/tsconfig.json index 4fe616ced184..ada0aea4dfc7 100644 --- a/code/renderers/react/tsconfig.json +++ b/code/renderers/react/tsconfig.json @@ -4,7 +4,9 @@ // "allowJs": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] + "storybook/internal/*": ["../../lib/cli/core/*"], + "@storybook/react": ["./"], + "@storybook/blocks": ["../../lib/blocks"] } }, "include": ["src/**/*", "template/**/*"] From 31f12cb25d427cdbcbd7c94df9c661c99f09f59f Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 3 Jul 2024 00:13:37 +0200 Subject: [PATCH 16/86] fix lockfile --- code/yarn.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/yarn.lock b/code/yarn.lock index d5b02d499d53..5764d2a7c3c5 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -5496,6 +5496,7 @@ __metadata: "@storybook/csf": "npm:0.1.10" "@storybook/global": "npm:^5.0.0" "@storybook/icons": "npm:^1.2.5" + "@storybook/react": "workspace:*" "@storybook/test": "workspace:*" "@types/color-convert": "npm:^2.0.0" "@types/lodash": "npm:^4.14.167" @@ -6400,7 +6401,6 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/react@workspace:renderers/react" dependencies: - "@storybook/blocks": "workspace:*" "@storybook/global": "npm:^5.0.0" "@storybook/react-dom-shim": "workspace:*" "@storybook/test": "workspace:*" From 1a571962d34739a4166894af2bc479bd57440aab Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 3 Jul 2024 09:14:25 +0200 Subject: [PATCH 17/86] fix --- .../ts-function-component-inline-defaults/input.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/renderers/react/template/stories/docgen-components/ts-function-component-inline-defaults/input.tsx b/code/renderers/react/template/stories/docgen-components/ts-function-component-inline-defaults/input.tsx index 7c15b27fad1b..c6a4855a20fd 100644 --- a/code/renderers/react/template/stories/docgen-components/ts-function-component-inline-defaults/input.tsx +++ b/code/renderers/react/template/stories/docgen-components/ts-function-component-inline-defaults/input.tsx @@ -1,6 +1,7 @@ import React from 'react'; -// @ts-expect-error (importing a js file) +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore-error (importing a js file) import { imported } from '../imported'; const local = 'local-value'; From 550aac8f576d6c37f2ab9a91f7c6d55ec6834d7c Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 3 Jul 2024 10:26:22 +0200 Subject: [PATCH 18/86] resolve CI failure see: https://app.circleci.com/pipelines/github/storybookjs/storybook/79345/workflows/f27624ed-dc55-4a51-82ce-bcc76fb24b83/jobs/676050 Co-authored-by: Yann Braga --- .../vue3/package.json | 118 +++++++++--------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/test-storybooks/portable-stories-kitchen-sink/vue3/package.json b/test-storybooks/portable-stories-kitchen-sink/vue3/package.json index 03eaf078bf02..506239c736a8 100644 --- a/test-storybooks/portable-stories-kitchen-sink/vue3/package.json +++ b/test-storybooks/portable-stories-kitchen-sink/vue3/package.json @@ -16,66 +16,66 @@ }, "resolutions": { "@playwright/test": "1.42.1", - "@storybook/addon-a11y": "portal:../../../code/addons/a11y", - "@storybook/addon-actions": "portal:../../../code/addons/actions", - "@storybook/addon-backgrounds": "portal:../../../code/addons/backgrounds", - "@storybook/addon-controls": "portal:../../../code/addons/controls", - "@storybook/addon-docs": "portal:../../../code/addons/docs", - "@storybook/addon-essentials": "portal:../../../code/addons/essentials", - "@storybook/addon-highlight": "portal:../../../code/addons/highlight", - "@storybook/addon-interactions": "portal:../../../code/addons/interactions", - "@storybook/addon-jest": "portal:../../../code/addons/jest", - "@storybook/addon-links": "portal:../../../code/addons/links", - "@storybook/addon-measure": "portal:../../../code/addons/measure", - "@storybook/addon-mgx-gfm": "portal:../../../code/addons/mgx-gfm", - "@storybook/addon-outline": "portal:../../../code/addons/outline", - "@storybook/addon-storysource": "portal:../../../code/addons/storysource", - "@storybook/addon-themes": "portal:../../../code/addons/themes", - "@storybook/addon-toolbars": "portal:../../../code/addons/toolbars", - "@storybook/addon-viewport": "portal:../../../code/addons/viewport", - "@storybook/angular": "portal:../../../code/frameworks/angular", - "@storybook/blocks": "portal:../../../code/lib/blocks", - "@storybook/builder-vite": "portal:../../../code/builders/builder-vite", - "@storybook/builder-webpack5": "portal:../../../code/builders/builder-webpack5", - "@storybook/codemod": "portal:../../../code/lib/codemod", - "@storybook/core": "portal:../../../code/core", - "@storybook/core-webpack": "portal:../../../code/lib/core-webpack", - "@storybook/csf-plugin": "portal:../../../code/lib/csf-plugin", - "@storybook/ember": "portal:../../../code/frameworks/ember", - "@storybook/html": "portal:../../../code/renderers/html", - "@storybook/html-webpack5": "portal:../../../code/frameworks/html-webpack5", - "@storybook/instrumenter": "portal:../../../code/lib/instrumenter", - "@storybook/nextjs": "portal:../../../code/frameworks/nextjs", - "@storybook/preact": "portal:../../../code/renderers/preact", - "@storybook/preact-vite": "portal:../../../code/frameworks/preact-vite", - "@storybook/preact-webpack5": "portal:../../../code/frameworks/preact-webpack5", - "@storybook/preset-create-react-app": "portal:../../../code/presets/create-react-app", - "@storybook/preset-html-webpack": "portal:../../../code/presets/html-webpack", - "@storybook/preset-preact-webpack": "portal:../../../code/presets/preact-webpack", - "@storybook/preset-react-webpack": "portal:../../../code/presets/react-webpack", - "@storybook/preset-server-webpack": "portal:../../../code/presets/server-webpack", - "@storybook/preset-svelte-webpack": "portal:../../../code/presets/svelte-webpack", - "@storybook/preset-vue3-webpack": "portal:../../../code/presets/vue3-webpack", - "@storybook/react": "portal:../../../code/renderers/react", - "@storybook/react-dom-shim": "portal:../../../code/lib/react-dom-shim", - "@storybook/react-vite": "portal:../../../code/frameworks/react-vite", - "@storybook/react-webpack5": "portal:../../../code/frameworks/react-webpack5", - "@storybook/server": "portal:../../../code/renderers/server", - "@storybook/server-webpack5": "portal:../../../code/frameworks/server-webpack5", - "@storybook/source-loader": "portal:../../../code/lib/source-loader", - "@storybook/svelte": "portal:../../../code/renderers/svelte", - "@storybook/svelte-vite": "portal:../../../code/frameworks/svelte-vite", - "@storybook/svelte-webpack5": "portal:../../../code/frameworks/svelte-webpack5", - "@storybook/sveltekit": "portal:../../../code/frameworks/sveltekit", - "@storybook/test": "portal:../../../code/lib/test", - "@storybook/vue3": "portal:../../../code/renderers/vue3", - "@storybook/vue3-vite": "portal:../../../code/frameworks/vue3-vite", - "@storybook/vue3-webpack5": "portal:../../../code/frameworks/vue3-webpack5", - "@storybook/web-components": "portal:../../../code/renderers/web-components", - "@storybook/web-components-vite": "portal:../../../code/frameworks/web-components-vite", - "@storybook/web-components-webpack5": "portal:../../../code/frameworks/web-components-webpack5", + "@storybook/addon-a11y": "file:../../../code/addons/a11y", + "@storybook/addon-actions": "file:../../../code/addons/actions", + "@storybook/addon-backgrounds": "file:../../../code/addons/backgrounds", + "@storybook/addon-controls": "file:../../../code/addons/controls", + "@storybook/addon-docs": "file:../../../code/addons/docs", + "@storybook/addon-essentials": "file:../../../code/addons/essentials", + "@storybook/addon-highlight": "file:../../../code/addons/highlight", + "@storybook/addon-interactions": "file:../../../code/addons/interactions", + "@storybook/addon-jest": "file:../../../code/addons/jest", + "@storybook/addon-links": "file:../../../code/addons/links", + "@storybook/addon-measure": "file:../../../code/addons/measure", + "@storybook/addon-mgx-gfm": "file:../../../code/addons/mgx-gfm", + "@storybook/addon-outline": "file:../../../code/addons/outline", + "@storybook/addon-storysource": "file:../../../code/addons/storysource", + "@storybook/addon-themes": "file:../../../code/addons/themes", + "@storybook/addon-toolbars": "file:../../../code/addons/toolbars", + "@storybook/addon-viewport": "file:../../../code/addons/viewport", + "@storybook/angular": "file:../../../code/frameworks/angular", + "@storybook/blocks": "file:../../../code/lib/blocks", + "@storybook/builder-vite": "file:../../../code/builders/builder-vite", + "@storybook/builder-webpack5": "file:../../../code/builders/builder-webpack5", + "@storybook/codemod": "file:../../../code/lib/codemod", + "@storybook/core": "file:../../../code/core", + "@storybook/core-webpack": "file:../../../code/lib/core-webpack", + "@storybook/csf-plugin": "file:../../../code/lib/csf-plugin", + "@storybook/ember": "file:../../../code/frameworks/ember", + "@storybook/html": "file:../../../code/renderers/html", + "@storybook/html-webpack5": "file:../../../code/frameworks/html-webpack5", + "@storybook/instrumenter": "file:../../../code/lib/instrumenter", + "@storybook/nextjs": "file:../../../code/frameworks/nextjs", + "@storybook/preact": "file:../../../code/renderers/preact", + "@storybook/preact-vite": "file:../../../code/frameworks/preact-vite", + "@storybook/preact-webpack5": "file:../../../code/frameworks/preact-webpack5", + "@storybook/preset-create-react-app": "file:../../../code/presets/create-react-app", + "@storybook/preset-html-webpack": "file:../../../code/presets/html-webpack", + "@storybook/preset-preact-webpack": "file:../../../code/presets/preact-webpack", + "@storybook/preset-react-webpack": "file:../../../code/presets/react-webpack", + "@storybook/preset-server-webpack": "file:../../../code/presets/server-webpack", + "@storybook/preset-svelte-webpack": "file:../../../code/presets/svelte-webpack", + "@storybook/preset-vue3-webpack": "file:../../../code/presets/vue3-webpack", + "@storybook/react": "file:../../../code/renderers/react", + "@storybook/react-dom-shim": "file:../../../code/lib/react-dom-shim", + "@storybook/react-vite": "file:../../../code/frameworks/react-vite", + "@storybook/react-webpack5": "file:../../../code/frameworks/react-webpack5", + "@storybook/server": "file:../../../code/renderers/server", + "@storybook/server-webpack5": "file:../../../code/frameworks/server-webpack5", + "@storybook/source-loader": "file:../../../code/lib/source-loader", + "@storybook/svelte": "file:../../../code/renderers/svelte", + "@storybook/svelte-vite": "file:../../../code/frameworks/svelte-vite", + "@storybook/svelte-webpack5": "file:../../../code/frameworks/svelte-webpack5", + "@storybook/sveltekit": "file:../../../code/frameworks/sveltekit", + "@storybook/test": "file:../../../code/lib/test", + "@storybook/vue3": "file:../../../code/renderers/vue3", + "@storybook/vue3-vite": "file:../../../code/frameworks/vue3-vite", + "@storybook/vue3-webpack5": "file:../../../code/frameworks/vue3-webpack5", + "@storybook/web-components": "file:../../../code/renderers/web-components", + "@storybook/web-components-vite": "file:../../../code/frameworks/web-components-vite", + "@storybook/web-components-webpack5": "file:../../../code/frameworks/web-components-webpack5", "playwright": "1.42.1", - "storybook": "portal:../../../code/lib/cli" + "storybook": "file:../../../code/lib/cli" }, "dependencies": { "vue": "^3.4.19" From 86a78efd4dd0c67c552115f7ac734bc8b519ef76 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 3 Jul 2024 10:46:49 +0200 Subject: [PATCH 19/86] fix docs link for `scripts/eslint-plugin-local-rules/no-uncategorized-errors.js` and add one for ` scripts/eslint-plugin-local-rules/storybook-monorepo-imports.js` --- code/core/README.md | 25 +++++++++++++++++++ .../no-uncategorized-errors.js | 2 +- .../storybook-monorepo-imports.js | 1 + 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/code/core/README.md b/code/core/README.md index 431b588c5d0a..a5dc2a62ec35 100644 --- a/code/core/README.md +++ b/code/core/README.md @@ -24,3 +24,28 @@ import { addons } from 'storybook/internal/manager-api'; ``` Importing from `@storybook/core` is explicitly NOT supported; it WILL break in a future version of storybook, very likely in a non-major version bump. + +# For maintainers + +## When to use `@storybook/core` + +In the following packages you should import from `@storybook/core` (and ONLY from `@storybook/core`): + +- `@storybook/core` +- `@storybook/codemod` + +To prevent cyclical dependencies, these packages cannot depend on the `storybook` package. + +## When to use `storybook/internal` + +In every other package you should import from `storybook/internal` (and ONLY from `storybook/internal`). + +The heuristic is simple: + +> If you see a peerDependency on `storybook` in the `package.json` of the package you are working on, you should import from `storybook/internal`. + +## The 1 exception: the `storybook` package itself + +The sol exception is the `storybook` package itself. + +Obviously, the `storybook` package cannot depend on itself, so it must import from `@storybook/core`. diff --git a/scripts/eslint-plugin-local-rules/no-uncategorized-errors.js b/scripts/eslint-plugin-local-rules/no-uncategorized-errors.js index ce91cccf1040..c7629e719305 100644 --- a/scripts/eslint-plugin-local-rules/no-uncategorized-errors.js +++ b/scripts/eslint-plugin-local-rules/no-uncategorized-errors.js @@ -5,7 +5,7 @@ module.exports = { description: 'Disallow usage of the Error JavaScript class.', category: 'Best Practices', recommended: true, - url: 'https://github.com/storybookjs/storybook/blob/next/code/lib/core-events/src/errors/README.md', + url: 'https://github.com/storybookjs/storybook/blob/next/code/core/src/ERRORS.md', }, }, create(context) { diff --git a/scripts/eslint-plugin-local-rules/storybook-monorepo-imports.js b/scripts/eslint-plugin-local-rules/storybook-monorepo-imports.js index 19ed85394df9..8b9dba6de0f3 100644 --- a/scripts/eslint-plugin-local-rules/storybook-monorepo-imports.js +++ b/scripts/eslint-plugin-local-rules/storybook-monorepo-imports.js @@ -8,6 +8,7 @@ module.exports = { description: 'Ensure the imports-paths of packages in the monorepo is correct', category: 'Best Practices', recommended: true, + url: 'https://github.com/storybookjs/storybook/blob/next/code/core/README.md', }, fixable: 'code', }, From acc1f8ff56ff27497abc25a4f1611862245299f1 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 3 Jul 2024 10:52:22 +0200 Subject: [PATCH 20/86] Discard changes to scripts/task.ts --- scripts/task.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/task.ts b/scripts/task.ts index 018ca4d48030..80fa759036b4 100644 --- a/scripts/task.ts +++ b/scripts/task.ts @@ -473,8 +473,8 @@ async function run() { if (controller) controllers.push(controller); } catch (err) { invariant(err instanceof Error); - // logger.error(`Error running task ${getTaskKey(task)}:`); - // logger.error(JSON.stringify(err, null, 2)); + logger.error(`Error running task ${getTaskKey(task)}:`); + logger.error(JSON.stringify(err, null, 2)); if (process.env.CI) { logger.error( @@ -500,8 +500,7 @@ async function run() { controller.abort(); }); - process.exit(1); - // throw err; + throw err; } statuses.set(task, task.service ? 'serving' : 'complete'); From 627abdbc1fcd8a5bbdf55a0f531a4ce9117cd1fb Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 3 Jul 2024 11:29:54 +0200 Subject: [PATCH 21/86] fix --- code/core/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/core/tsconfig.json b/code/core/tsconfig.json index 5f12dd31bb3e..44f26a3411c0 100644 --- a/code/core/tsconfig.json +++ b/code/core/tsconfig.json @@ -5,7 +5,8 @@ "module": "ES2022", "moduleResolution": "Bundler", "paths": { - "@storybook/core/*": ["./src/*"] + "@storybook/core/*": ["./src/*"], + "@storybook/react": ["../renderers/react"] }, "skipDefaultLibCheck": true, "target": "ES2022" From 3ba9745476b87145aadcf9c72f0d285613bd23cf Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 3 Jul 2024 13:21:00 +0200 Subject: [PATCH 22/86] wip --- code/addons/a11y/tsconfig.json | 7 +------ code/addons/actions/tsconfig.json | 7 +------ code/addons/backgrounds/tsconfig.json | 7 +------ code/addons/controls/tsconfig.json | 7 +------ code/addons/docs/tsconfig.json | 7 +------ code/addons/essentials/tsconfig.json | 7 +------ code/addons/gfm/tsconfig.json | 7 +------ code/addons/highlight/tsconfig.json | 7 +------ code/addons/interactions/tsconfig.json | 6 +----- code/addons/jest/tsconfig.json | 7 +------ code/addons/links/tsconfig.json | 8 +------- code/addons/measure/tsconfig.json | 9 ++------- code/addons/onboarding/tsconfig.json | 7 +------ code/addons/outline/tsconfig.json | 9 ++------- code/addons/storysource/tsconfig.json | 7 +------ code/addons/themes/tsconfig.json | 9 ++------- code/addons/toolbars/tsconfig.json | 7 +------ code/addons/viewport/tsconfig.json | 9 ++------- code/builders/builder-vite/tsconfig.json | 7 +------ code/builders/builder-webpack5/tsconfig.json | 7 +------ code/core/tsconfig.json | 3 +-- code/frameworks/ember/tsconfig.json | 7 +------ code/frameworks/html-webpack5/tsconfig.json | 7 +------ code/frameworks/nextjs/tsconfig.json | 7 +------ code/frameworks/preact-webpack5/tsconfig.json | 7 +------ code/frameworks/react-webpack5/tsconfig.json | 7 +------ code/frameworks/server-webpack5/tsconfig.json | 7 +------ code/frameworks/svelte-webpack5/tsconfig.json | 7 +------ code/frameworks/vue3-webpack5/tsconfig.json | 7 +------ code/frameworks/web-components-webpack5/tsconfig.json | 7 +------ code/lib/cli/tsconfig.json | 7 +------ code/lib/codemod/tsconfig.json | 6 +----- code/lib/core-webpack/tsconfig.json | 7 +------ code/lib/csf-plugin/tsconfig.json | 7 +------ code/lib/instrumenter/tsconfig.json | 9 ++------- code/lib/react-dom-shim/tsconfig.json | 7 +------ code/lib/source-loader/tsconfig.json | 9 ++------- code/lib/test/tsconfig.json | 9 ++------- code/presets/create-react-app/tsconfig.json | 7 +------ code/presets/html-webpack/tsconfig.json | 7 +------ code/presets/preact-webpack/tsconfig.json | 7 +------ code/presets/react-webpack/tsconfig.json | 7 +------ code/presets/server-webpack/tsconfig.json | 7 +------ code/presets/svelte-webpack/tsconfig.json | 7 +------ code/presets/vue3-webpack/tsconfig.json | 7 +------ code/renderers/html/tsconfig.json | 7 +------ code/renderers/preact/tsconfig.json | 7 +------ code/renderers/react/tsconfig.json | 2 -- code/renderers/server/tsconfig.json | 7 +------ code/renderers/svelte/src/public-types.test.ts | 2 +- code/renderers/svelte/tsconfig.json | 7 +------ code/renderers/vue3/tsconfig.json | 6 +----- code/tsconfig.json | 3 +++ 53 files changed, 61 insertions(+), 304 deletions(-) diff --git a/code/addons/a11y/tsconfig.json b/code/addons/a11y/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/addons/a11y/tsconfig.json +++ b/code/addons/a11y/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/addons/actions/tsconfig.json b/code/addons/actions/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/addons/actions/tsconfig.json +++ b/code/addons/actions/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/addons/backgrounds/tsconfig.json b/code/addons/backgrounds/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/addons/backgrounds/tsconfig.json +++ b/code/addons/backgrounds/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/addons/controls/tsconfig.json b/code/addons/controls/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/addons/controls/tsconfig.json +++ b/code/addons/controls/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/addons/docs/tsconfig.json b/code/addons/docs/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/addons/docs/tsconfig.json +++ b/code/addons/docs/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/addons/essentials/tsconfig.json b/code/addons/essentials/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/addons/essentials/tsconfig.json +++ b/code/addons/essentials/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/addons/gfm/tsconfig.json b/code/addons/gfm/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/addons/gfm/tsconfig.json +++ b/code/addons/gfm/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/addons/highlight/tsconfig.json b/code/addons/highlight/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/addons/highlight/tsconfig.json +++ b/code/addons/highlight/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/addons/interactions/tsconfig.json b/code/addons/interactions/tsconfig.json index 2448952ae37a..a7d41e8a79b5 100644 --- a/code/addons/interactions/tsconfig.json +++ b/code/addons/interactions/tsconfig.json @@ -1,11 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": false, - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } + "strict": false }, "include": ["src/**/*"] } diff --git a/code/addons/jest/tsconfig.json b/code/addons/jest/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/addons/jest/tsconfig.json +++ b/code/addons/jest/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/addons/links/tsconfig.json b/code/addons/links/tsconfig.json index 54246c6c83a9..73a65ef2ef6e 100644 --- a/code/addons/links/tsconfig.json +++ b/code/addons/links/tsconfig.json @@ -1,11 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], - "react": ["../../node_modules/react"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/addons/measure/tsconfig.json b/code/addons/measure/tsconfig.json index 52bb92946e15..73a65ef2ef6e 100644 --- a/code/addons/measure/tsconfig.json +++ b/code/addons/measure/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "include": ["src/**/*"], - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - } + "compilerOptions": {}, + "include": ["src/**/*"] } diff --git a/code/addons/onboarding/tsconfig.json b/code/addons/onboarding/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/addons/onboarding/tsconfig.json +++ b/code/addons/onboarding/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/addons/outline/tsconfig.json b/code/addons/outline/tsconfig.json index 52bb92946e15..73a65ef2ef6e 100644 --- a/code/addons/outline/tsconfig.json +++ b/code/addons/outline/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "include": ["src/**/*"], - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - } + "compilerOptions": {}, + "include": ["src/**/*"] } diff --git a/code/addons/storysource/tsconfig.json b/code/addons/storysource/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/addons/storysource/tsconfig.json +++ b/code/addons/storysource/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/addons/themes/tsconfig.json b/code/addons/themes/tsconfig.json index 52bb92946e15..73a65ef2ef6e 100644 --- a/code/addons/themes/tsconfig.json +++ b/code/addons/themes/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "include": ["src/**/*"], - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - } + "compilerOptions": {}, + "include": ["src/**/*"] } diff --git a/code/addons/toolbars/tsconfig.json b/code/addons/toolbars/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/addons/toolbars/tsconfig.json +++ b/code/addons/toolbars/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/addons/viewport/tsconfig.json b/code/addons/viewport/tsconfig.json index 52bb92946e15..73a65ef2ef6e 100644 --- a/code/addons/viewport/tsconfig.json +++ b/code/addons/viewport/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "include": ["src/**/*"], - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - } + "compilerOptions": {}, + "include": ["src/**/*"] } diff --git a/code/builders/builder-vite/tsconfig.json b/code/builders/builder-vite/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/builders/builder-vite/tsconfig.json +++ b/code/builders/builder-vite/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/builders/builder-webpack5/tsconfig.json b/code/builders/builder-webpack5/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/builders/builder-webpack5/tsconfig.json +++ b/code/builders/builder-webpack5/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/core/tsconfig.json b/code/core/tsconfig.json index 44f26a3411c0..5f12dd31bb3e 100644 --- a/code/core/tsconfig.json +++ b/code/core/tsconfig.json @@ -5,8 +5,7 @@ "module": "ES2022", "moduleResolution": "Bundler", "paths": { - "@storybook/core/*": ["./src/*"], - "@storybook/react": ["../renderers/react"] + "@storybook/core/*": ["./src/*"] }, "skipDefaultLibCheck": true, "target": "ES2022" diff --git a/code/frameworks/ember/tsconfig.json b/code/frameworks/ember/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/frameworks/ember/tsconfig.json +++ b/code/frameworks/ember/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/frameworks/html-webpack5/tsconfig.json b/code/frameworks/html-webpack5/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/frameworks/html-webpack5/tsconfig.json +++ b/code/frameworks/html-webpack5/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/frameworks/nextjs/tsconfig.json b/code/frameworks/nextjs/tsconfig.json index 3d6d1ae67af4..3b01f80f2c32 100644 --- a/code/frameworks/nextjs/tsconfig.json +++ b/code/frameworks/nextjs/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*", "template/**/*"] } diff --git a/code/frameworks/preact-webpack5/tsconfig.json b/code/frameworks/preact-webpack5/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/frameworks/preact-webpack5/tsconfig.json +++ b/code/frameworks/preact-webpack5/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/frameworks/react-webpack5/tsconfig.json b/code/frameworks/react-webpack5/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/frameworks/react-webpack5/tsconfig.json +++ b/code/frameworks/react-webpack5/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/frameworks/server-webpack5/tsconfig.json b/code/frameworks/server-webpack5/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/frameworks/server-webpack5/tsconfig.json +++ b/code/frameworks/server-webpack5/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/frameworks/svelte-webpack5/tsconfig.json b/code/frameworks/svelte-webpack5/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/frameworks/svelte-webpack5/tsconfig.json +++ b/code/frameworks/svelte-webpack5/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/frameworks/vue3-webpack5/tsconfig.json b/code/frameworks/vue3-webpack5/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/frameworks/vue3-webpack5/tsconfig.json +++ b/code/frameworks/vue3-webpack5/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/frameworks/web-components-webpack5/tsconfig.json b/code/frameworks/web-components-webpack5/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/frameworks/web-components-webpack5/tsconfig.json +++ b/code/frameworks/web-components-webpack5/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/lib/cli/tsconfig.json b/code/lib/cli/tsconfig.json index f5ab5afaf6a4..2831f7bb6d03 100644 --- a/code/lib/cli/tsconfig.json +++ b/code/lib/cli/tsconfig.json @@ -1,10 +1,5 @@ { - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "extends": "../../tsconfig.json", "include": ["src/**/*"] } diff --git a/code/lib/codemod/tsconfig.json b/code/lib/codemod/tsconfig.json index 18e9e5d0c206..b2a5d2c2ee19 100644 --- a/code/lib/codemod/tsconfig.json +++ b/code/lib/codemod/tsconfig.json @@ -2,11 +2,7 @@ "extends": "../../tsconfig.json", "compilerOptions": { "allowJs": true, - "strict": false, - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } + "strict": false }, "exclude": ["node_modules", "__testfixtures__", "__tests__"], "include": ["src/**/*"] diff --git a/code/lib/core-webpack/tsconfig.json b/code/lib/core-webpack/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/lib/core-webpack/tsconfig.json +++ b/code/lib/core-webpack/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/lib/csf-plugin/tsconfig.json b/code/lib/csf-plugin/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/lib/csf-plugin/tsconfig.json +++ b/code/lib/csf-plugin/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/lib/instrumenter/tsconfig.json b/code/lib/instrumenter/tsconfig.json index 52bb92946e15..73a65ef2ef6e 100644 --- a/code/lib/instrumenter/tsconfig.json +++ b/code/lib/instrumenter/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "include": ["src/**/*"], - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - } + "compilerOptions": {}, + "include": ["src/**/*"] } diff --git a/code/lib/react-dom-shim/tsconfig.json b/code/lib/react-dom-shim/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/lib/react-dom-shim/tsconfig.json +++ b/code/lib/react-dom-shim/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/lib/source-loader/tsconfig.json b/code/lib/source-loader/tsconfig.json index 52bb92946e15..73a65ef2ef6e 100644 --- a/code/lib/source-loader/tsconfig.json +++ b/code/lib/source-loader/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "include": ["src/**/*"], - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - } + "compilerOptions": {}, + "include": ["src/**/*"] } diff --git a/code/lib/test/tsconfig.json b/code/lib/test/tsconfig.json index 52bb92946e15..73a65ef2ef6e 100644 --- a/code/lib/test/tsconfig.json +++ b/code/lib/test/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "include": ["src/**/*"], - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - } + "compilerOptions": {}, + "include": ["src/**/*"] } diff --git a/code/presets/create-react-app/tsconfig.json b/code/presets/create-react-app/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/presets/create-react-app/tsconfig.json +++ b/code/presets/create-react-app/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/presets/html-webpack/tsconfig.json b/code/presets/html-webpack/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/presets/html-webpack/tsconfig.json +++ b/code/presets/html-webpack/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/presets/preact-webpack/tsconfig.json b/code/presets/preact-webpack/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/presets/preact-webpack/tsconfig.json +++ b/code/presets/preact-webpack/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/presets/react-webpack/tsconfig.json b/code/presets/react-webpack/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/presets/react-webpack/tsconfig.json +++ b/code/presets/react-webpack/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/presets/server-webpack/tsconfig.json b/code/presets/server-webpack/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/presets/server-webpack/tsconfig.json +++ b/code/presets/server-webpack/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/presets/svelte-webpack/tsconfig.json b/code/presets/svelte-webpack/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/presets/svelte-webpack/tsconfig.json +++ b/code/presets/svelte-webpack/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/presets/vue3-webpack/tsconfig.json b/code/presets/vue3-webpack/tsconfig.json index 601bf5b99bf4..73a65ef2ef6e 100644 --- a/code/presets/vue3-webpack/tsconfig.json +++ b/code/presets/vue3-webpack/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*"] } diff --git a/code/renderers/html/tsconfig.json b/code/renderers/html/tsconfig.json index 3d6d1ae67af4..3b01f80f2c32 100644 --- a/code/renderers/html/tsconfig.json +++ b/code/renderers/html/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*", "template/**/*"] } diff --git a/code/renderers/preact/tsconfig.json b/code/renderers/preact/tsconfig.json index 3d6d1ae67af4..3b01f80f2c32 100644 --- a/code/renderers/preact/tsconfig.json +++ b/code/renderers/preact/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*", "template/**/*"] } diff --git a/code/renderers/react/tsconfig.json b/code/renderers/react/tsconfig.json index ada0aea4dfc7..4fca533dd5a6 100644 --- a/code/renderers/react/tsconfig.json +++ b/code/renderers/react/tsconfig.json @@ -1,10 +1,8 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - // "allowJs": true, "baseUrl": ".", "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"], "@storybook/react": ["./"], "@storybook/blocks": ["../../lib/blocks"] } diff --git a/code/renderers/server/tsconfig.json b/code/renderers/server/tsconfig.json index 3d6d1ae67af4..3b01f80f2c32 100644 --- a/code/renderers/server/tsconfig.json +++ b/code/renderers/server/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } - }, + "compilerOptions": {}, "include": ["src/**/*", "template/**/*"] } diff --git a/code/renderers/svelte/src/public-types.test.ts b/code/renderers/svelte/src/public-types.test.ts index f92e3d736d5b..95bc673584ac 100644 --- a/code/renderers/svelte/src/public-types.test.ts +++ b/code/renderers/svelte/src/public-types.test.ts @@ -1,7 +1,7 @@ // this file tests Typescript types that's why there are no assertions import { describe, it } from 'vitest'; import { satisfies } from 'storybook/internal/common'; -import type { ComponentAnnotations, StoryAnnotations } from 'storybook/internal/types'; +import type { Canvas, ComponentAnnotations, StoryAnnotations } from 'storybook/internal/types'; import { expectTypeOf } from 'expect-type'; import type { ComponentProps, SvelteComponent } from 'svelte'; import Button from './__test__/Button.svelte'; diff --git a/code/renderers/svelte/tsconfig.json b/code/renderers/svelte/tsconfig.json index 9b9863bd89b3..ba474f5a2f5c 100644 --- a/code/renderers/svelte/tsconfig.json +++ b/code/renderers/svelte/tsconfig.json @@ -1,12 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "module": "ESNext", - - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } + "module": "ESNext" }, "include": ["src/**/*", "src/**/*.svelte", "template/**/*", "template/**/*.svelte"] } diff --git a/code/renderers/vue3/tsconfig.json b/code/renderers/vue3/tsconfig.json index 32faa236db57..e54cc5da3fb2 100644 --- a/code/renderers/vue3/tsconfig.json +++ b/code/renderers/vue3/tsconfig.json @@ -1,11 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "allowJs": true, - "baseUrl": ".", - "paths": { - "storybook/internal/*": ["../../lib/cli/core/*"] - } + "allowJs": true }, "include": ["src/**/*", "src/**/*.vue", "template/**/*", "template/**/*.vue"], "vueCompilerOptions": { diff --git a/code/tsconfig.json b/code/tsconfig.json index 20fd39d80a3a..3a423a2a2d47 100644 --- a/code/tsconfig.json +++ b/code/tsconfig.json @@ -14,6 +14,9 @@ "moduleResolution": "Node", "noImplicitAny": true, "noUnusedLocals": true, + "paths": { + "storybook/internal/*": ["./lib/cli/core/*"] + }, "skipLibCheck": true, "strict": true, "strictBindCallApply": true, From 47f3b5156b68e8618b685bec8c3acd671e49b258 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 3 Jul 2024 14:17:10 +0200 Subject: [PATCH 23/86] confusion --- .vscode/settings.json | 4 ++-- code/tsconfig.json | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 0e868eb99e6a..64101684328f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -49,13 +49,13 @@ "files.associations": { "*.js": "javascriptreact" }, - "javascript.preferences.importModuleSpecifier": "project-relative", + "javascript.preferences.importModuleSpecifier": "relative", "javascript.preferences.quoteStyle": "single", "js/ts.implicitProjectConfig.target": "ESNext", "prettier.ignorePath": "./code/.prettierignore", "storyExplorer.storybookConfigDir": "./code/.storybook", "typescript.format.enable": false, - "typescript.preferences.importModuleSpecifier": "project-relative", + "typescript.preferences.importModuleSpecifier": "relative", "typescript.preferences.preferTypeOnlyAutoImports": true, "typescript.preferences.quoteStyle": "single", "typescript.preferGoToSourceDefinition": true, diff --git a/code/tsconfig.json b/code/tsconfig.json index 3a423a2a2d47..20fd39d80a3a 100644 --- a/code/tsconfig.json +++ b/code/tsconfig.json @@ -14,9 +14,6 @@ "moduleResolution": "Node", "noImplicitAny": true, "noUnusedLocals": true, - "paths": { - "storybook/internal/*": ["./lib/cli/core/*"] - }, "skipLibCheck": true, "strict": true, "strictBindCallApply": true, From 9ba5e35dffebc6ac9fc6fd6be1d5f4cff89bcb50 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 3 Jul 2024 14:51:28 +0200 Subject: [PATCH 24/86] cleanup --- code/core/scripts/check.ts | 2 +- code/core/scripts/dts.ts | 2 +- code/core/tsconfig.build.json | 11 ----------- code/core/tsconfig.check.json | 10 ---------- code/core/tsconfig.json | 10 ++-------- 5 files changed, 4 insertions(+), 31 deletions(-) delete mode 100644 code/core/tsconfig.build.json delete mode 100644 code/core/tsconfig.check.json diff --git a/code/core/scripts/check.ts b/code/core/scripts/check.ts index b44f2c4febff..ca51bcf847f5 100644 --- a/code/core/scripts/check.ts +++ b/code/core/scripts/check.ts @@ -1,6 +1,6 @@ import { getTSFilesAndConfig, getTSProgramAndHost, getTSDiagnostics } from './helpers/typescript'; -const tsconfigPath = 'tsconfig.check.json'; +const tsconfigPath = 'tsconfig.json'; const { options, fileNames } = getTSFilesAndConfig(tsconfigPath); const { program, host } = getTSProgramAndHost(fileNames, options); diff --git a/code/core/scripts/dts.ts b/code/core/scripts/dts.ts index cd4848e0a0d6..932a2ae228e5 100644 --- a/code/core/scripts/dts.ts +++ b/code/core/scripts/dts.ts @@ -43,7 +43,7 @@ await Promise.all( await dts( i.file, [...external, ...i.externals], - join(import.meta.dirname, '..', 'tsconfig.build.json') + join(import.meta.dirname, '..', 'tsconfig.json') ); }) ); diff --git a/code/core/tsconfig.build.json b/code/core/tsconfig.build.json deleted file mode 100644 index 62447df708d0..000000000000 --- a/code/core/tsconfig.build.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "skipDefaultLibCheck": true, - "moduleResolution": "Bundler", - "rootDir": ".", - "target": "ES2022", - "module": "ES2022" - }, - "include": ["src/**/*"] -} diff --git a/code/core/tsconfig.check.json b/code/core/tsconfig.check.json deleted file mode 100644 index f40f66dae184..000000000000 --- a/code/core/tsconfig.check.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "skipDefaultLibCheck": true, - "moduleResolution": "Bundler", - "target": "ES2022", - "module": "ES2022" - }, - "include": ["src/**/*", "*.d.ts"] -} diff --git a/code/core/tsconfig.json b/code/core/tsconfig.json index 5f12dd31bb3e..2dcc611b29a4 100644 --- a/code/core/tsconfig.json +++ b/code/core/tsconfig.json @@ -1,14 +1,8 @@ { "extends": "../tsconfig.json", "compilerOptions": { - "baseUrl": ".", - "module": "ES2022", - "moduleResolution": "Bundler", - "paths": { - "@storybook/core/*": ["./src/*"] - }, - "skipDefaultLibCheck": true, - "target": "ES2022" + "resolveJsonModule": true, + "module": "ES2022" }, "include": ["src/**/*", "scripts/**/*", "*.d.ts"] } From da15958dcd07ad588aa7f77221601aa1fd996a68 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 3 Jul 2024 15:09:16 +0200 Subject: [PATCH 25/86] fixes --- code/addons/actions/src/containers/ActionLogger/index.tsx | 1 - code/core/src/common/js-package-manager/Yarn2Proxy.ts | 1 - code/core/src/manager/globals-runtime.ts | 3 +++ code/tsconfig.json | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/code/addons/actions/src/containers/ActionLogger/index.tsx b/code/addons/actions/src/containers/ActionLogger/index.tsx index 3da9cbe52e77..ff9e50302633 100644 --- a/code/addons/actions/src/containers/ActionLogger/index.tsx +++ b/code/addons/actions/src/containers/ActionLogger/index.tsx @@ -26,7 +26,6 @@ const safeDeepEqual = (a: any, b: any): boolean => { }; export default class ActionLogger extends Component { - // @ts-expect-error Unused, possibly remove, leaving, because it could be accessed even though it is private private mounted: boolean; constructor(props: ActionLoggerProps) { diff --git a/code/core/src/common/js-package-manager/Yarn2Proxy.ts b/code/core/src/common/js-package-manager/Yarn2Proxy.ts index acd1b9bbfcdf..0f824262df21 100644 --- a/code/core/src/common/js-package-manager/Yarn2Proxy.ts +++ b/code/core/src/common/js-package-manager/Yarn2Proxy.ts @@ -38,7 +38,6 @@ const CRITICAL_YARN2_ERROR_CODES = { YN0083: 'AUTOMERGE_GIT_ERROR', }; -// @ts-expect-error If we want a code to be parsed, we move from the list below to the list above // Keep the codes here, they might be helpful in the future const YARN2_ERROR_CODES = { ...CRITICAL_YARN2_ERROR_CODES, diff --git a/code/core/src/manager/globals-runtime.ts b/code/core/src/manager/globals-runtime.ts index 8488b61d7462..011cb0f60fdf 100644 --- a/code/core/src/manager/globals-runtime.ts +++ b/code/core/src/manager/globals-runtime.ts @@ -20,9 +20,12 @@ global.sendTelemetryError = (error) => { // handle all uncaught errors at the root of the application and log to telemetry global.addEventListener('error', (args) => { + // @ts-expect-error (not Event) const error = args.error || args; global.sendTelemetryError(error); }); + +// @ts-expect-error (not Event) global.addEventListener('unhandledrejection', ({ reason }) => { global.sendTelemetryError(reason); }); diff --git a/code/tsconfig.json b/code/tsconfig.json index 20fd39d80a3a..2b82117621e8 100644 --- a/code/tsconfig.json +++ b/code/tsconfig.json @@ -13,7 +13,7 @@ "module": "CommonJS", "moduleResolution": "Node", "noImplicitAny": true, - "noUnusedLocals": true, + "noUnusedLocals": false, "skipLibCheck": true, "strict": true, "strictBindCallApply": true, From 0c42687bd87458f5727a7b3247d610b26871f5a1 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 3 Jul 2024 17:51:11 +0200 Subject: [PATCH 26/86] Update code/core/README.md Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- code/core/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/core/README.md b/code/core/README.md index a5dc2a62ec35..52502f70be72 100644 --- a/code/core/README.md +++ b/code/core/README.md @@ -46,6 +46,6 @@ The heuristic is simple: ## The 1 exception: the `storybook` package itself -The sol exception is the `storybook` package itself. +The sole exception is the `storybook` package itself. Obviously, the `storybook` package cannot depend on itself, so it must import from `@storybook/core`. From 25a026695765e2f4406ec8dfe18c8cd886ca9f28 Mon Sep 17 00:00:00 2001 From: Kasper Peulen Date: Wed, 3 Jul 2024 23:46:02 +0200 Subject: [PATCH 27/86] Add docs for mounting inside the play function --- docs/_snippets/before-each-in-preview.md | 24 ++++++ docs/_snippets/mount-advanced.md | 95 ++++++++++++++++++++++ docs/_snippets/mount-basic.md | 44 ++++++++++ docs/api/doc-blocks/doc-block-story.mdx | 4 + docs/writing-tests/interaction-testing.mdx | 62 ++++++++++---- 5 files changed, 211 insertions(+), 18 deletions(-) create mode 100644 docs/_snippets/before-each-in-preview.md create mode 100644 docs/_snippets/mount-advanced.md create mode 100644 docs/_snippets/mount-basic.md diff --git a/docs/_snippets/before-each-in-preview.md b/docs/_snippets/before-each-in-preview.md new file mode 100644 index 000000000000..47abe76c5057 --- /dev/null +++ b/docs/_snippets/before-each-in-preview.md @@ -0,0 +1,24 @@ +```js filename=".storybook/preview.js" renderer="common" language="js" +import MockDate from 'mockdate'; + +export default { + async beforeEach() { + MockDate.reset() + } +}; +``` + +```ts filename=".storybook/preview.ts" renderer="common" language="ts" +// Replace your-renderer with the renderer you are using (e.g., react, vue3, angular, etc.) +import { Preview } from '@storybook/your-renderer'; +import MockDate from 'mockdate'; + +const preview: Preview = { + async beforeEach() { + MockDate.reset() + } +}; + +export default preview; +``` + diff --git a/docs/_snippets/mount-advanced.md b/docs/_snippets/mount-advanced.md new file mode 100644 index 000000000000..83a6870171a0 --- /dev/null +++ b/docs/_snippets/mount-advanced.md @@ -0,0 +1,95 @@ +```tsx filename="Page.stories.tsx" renderer="react" language="ts" +export const Default = { + play: async ({ mount, args, canvasElement }) => { + const note = await db.note.create({ + data: { title: 'Mount inside of play' }, + }); + + // 👇Pass data that is created inside of the play function to the component + // For example a just generated UUID + await mount(); + + await userEvent.click(await canvas.findByRole('menuitem', { name: /login to add/i })); + }, +}; +``` + +```jsx filename="Page.stories.jsx" renderer="react" language="js" +export const Default = { + play: async ({ mount, args, canvasElement }) => { + const note = await db.note.create({ + data: { title: 'Mount inside of play' }, + }); + + // 👇Pass data that is created inside of the play function to the component + // For example a just generated UUID + await mount(); + + await userEvent.click(await canvas.findByRole('menuitem', { name: /login to add/i })); + }, +}; +``` + +```ts filename="Page.stories.ts" renderer="svelte" language="ts" +export const Default: Story = { + play: async ({ mount, args, canvasElement }) => { + const note = await db.note.create({ + data: { title: 'Mount inside of play' }, + }); + + // 👇Pass data that is created inside of the play function to the component + // For example a just generated UUID + await mount(Page, { props: { ...args, params: { id: String(note.id) } } }); + + await userEvent.click(await canvas.findByRole('menuitem', { name: /login to add/i })); + }, +}; +``` + +```js filename="Page.stories.js" renderer="svelte" language="js" +export const Default = { + play: async ({ mount, args, canvasElement }) => { + const note = await db.note.create({ + data: { title: 'Mount inside of play' }, + }); + + // 👇Pass data that is created inside of the play function to the component + // For example a just generated UUID + await mount(Page, { props: { ...args, params: { id: String(note.id) } } }); + + await userEvent.click(await canvas.findByRole('menuitem', { name: /login to add/i })); + }, +}; +``` + +```ts filename="Page.stories.ts" renderer="vue3" language="ts" +export const Default: Story = { + play: async ({ mount, args, canvasElement }) => { + const note = await db.note.create({ + data: { title: 'Mount inside of play' }, + }); + + // 👇Pass data that is created inside of the play function to the component + // For example a just generated UUID + await mount(Page, { props: { ...args, params: { id: String(note.id) } } }); + + await userEvent.click(await canvas.findByRole('menuitem', { name: /login to add/i })); + }, +}; +``` + +```js filename="Page.stories.js" renderer="vue3" language="js" +export const Default = { + play: async ({ mount, args, canvasElement }) => { + const note = await db.note.create({ + data: { title: 'Mount inside of play' }, + }); + + // 👇Pass data that is created inside of the play function to the component + // For example a just generated UUID + await mount(Page, { props: { ...args, params: { id: String(note.id) } } }); + + await userEvent.click(await canvas.findByRole('menuitem', { name: /login to add/i })); + }, +}; +``` \ No newline at end of file diff --git a/docs/_snippets/mount-basic.md b/docs/_snippets/mount-basic.md new file mode 100644 index 000000000000..22689c1cc1a6 --- /dev/null +++ b/docs/_snippets/mount-basic.md @@ -0,0 +1,44 @@ +```js filename="Page.stories.js" renderer="common" language="js" +import MockDate from 'mockdate'; + +// ... + +export const ChristmasUI = { + async play({ canvasElement }) { + MockDate.set('2024-12-25'); + // 👇Render the component with the mocked date + await mount(); + // act and/or assert + }, +}; +``` + +```ts filename="Page.stories.ts" renderer="common" language="ts-4-9" +import MockDate from 'mockdate'; + +// ... + +export const ChristmasUI: Story = { + async play({ canvasElement }) { + MockDate.set('2024-12-25'); + // 👇Render the component with the mocked date + await mount(); + // act and/or assert + }, +}; +``` + +```ts filename="Page.stories.ts" renderer="common" language="ts" +import MockDate from 'mockdate'; + +// ... + +export const ChristmasUI: Story = { + async play({ canvasElement }) { + MockDate.set('2024-12-25'); + // 👇Render the component with the mocked date + await mount(); + // act and/or assert + }, +}; +``` diff --git a/docs/api/doc-blocks/doc-block-story.mdx b/docs/api/doc-blocks/doc-block-story.mdx index 7e07d1e7bb95..10c1331ee380 100644 --- a/docs/api/doc-blocks/doc-block-story.mdx +++ b/docs/api/doc-blocks/doc-block-story.mdx @@ -76,6 +76,10 @@ Because all stories render simultaneously in docs entries, play functions can pe However, if you know your play function is “safe” to run in docs, you can use this prop to run it automatically. + + When the play functions uses `mount`, the story won't be rendered in docs. You must set autoplay to true for such stories if you want to use them in docs. + + ### `height` Type: `string` diff --git a/docs/writing-tests/interaction-testing.mdx b/docs/writing-tests/interaction-testing.mdx index fff35b192010..9523344c4427 100644 --- a/docs/writing-tests/interaction-testing.mdx +++ b/docs/writing-tests/interaction-testing.mdx @@ -56,17 +56,46 @@ Once the story loads in the UI, it simulates the user's behavior and verifies th