diff --git a/examples/react-ts/.storybook/main.ts b/examples/react-ts/.storybook/main.ts index 76da86225ef6..865d5edbda32 100644 --- a/examples/react-ts/.storybook/main.ts +++ b/examples/react-ts/.storybook/main.ts @@ -31,6 +31,7 @@ const config: StorybookConfig = { storyStoreV7: !global.navigator?.userAgent?.match?.('jsdom'), buildStoriesJson: true, babelModeV7: true, + warnOnLegacyHierarchySeparator: false, }, framework: '@storybook/react', }; diff --git a/lib/api/src/lib/stories.ts b/lib/api/src/lib/stories.ts index 044b728ca04e..e93c974f6255 100644 --- a/lib/api/src/lib/stories.ts +++ b/lib/api/src/lib/stories.ts @@ -3,6 +3,7 @@ import deprecate from 'util-deprecate'; import dedent from 'ts-dedent'; import mapValues from 'lodash/mapValues'; import countBy from 'lodash/countBy'; +import global from 'global'; import { StoryId, ComponentTitle, @@ -19,6 +20,8 @@ import merge from './merge'; import { Provider } from '../modules/provider'; import { ViewMode } from '../modules/addons'; +const { FEATURES } = global; + export type { StoryId }; export interface Root { @@ -207,7 +210,7 @@ export const transformStoriesRawToStoriesHash = ( } const setShowRoots = typeof showRoots !== 'undefined'; - if (usesOldHierarchySeparator && !setShowRoots) { + if (usesOldHierarchySeparator && !setShowRoots && FEATURES?.warnOnLegacyHierarchySeparator) { warnChangedDefaultHierarchySeparators(); } diff --git a/lib/core-common/src/types.ts b/lib/core-common/src/types.ts index 5cc691c69a4f..0b617cf59d12 100644 --- a/lib/core-common/src/types.ts +++ b/lib/core-common/src/types.ts @@ -366,6 +366,12 @@ export interface StorybookConfig { * Filter args with a "target" on the type from the render function (EXPERIMENTAL) */ argTypeTargetsV7?: boolean; + + /** + * Warn when there is a pre-6.0 hierarchy separator ('.' / '|') in the story title. + * Will be removed in 7.0. + */ + warnOnLegacyHierarchySeparator?: boolean; }; /** diff --git a/lib/core-server/src/presets/common-preset.ts b/lib/core-server/src/presets/common-preset.ts index e88f56f82b40..ef90f4fe6c41 100644 --- a/lib/core-server/src/presets/common-preset.ts +++ b/lib/core-server/src/presets/common-preset.ts @@ -65,4 +65,5 @@ export const features = async (existing: Record) => ({ ...existing, postcss: true, emotionAlias: true, + warnOnLegacyHierarchySeparator: true, });