Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated flags and properties #21852

Merged
merged 4 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,7 @@ In 7.0 we've removed the following feature flags:
| ------------------- | ----------------------------------------------------------- |
| `emotionAlias` | This flag is no longer needed and should be deleted. |
| `breakingChangesV7` | This flag is no longer needed and should be deleted. |
| `previewCsfV3` | This flag is no longer needed and should be deleted. |
| `babelModeV7` | See [Babel mode v7 exclusively](#babel-mode-v7-exclusively) |

#### Story context is prepared before for supporting fine grained updates
Expand Down
1 change: 0 additions & 1 deletion code/addons/docs/src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ declare module 'sveltedoc-parser' {
declare var FEATURES:
| {
storyStoreV7?: boolean;
breakingChangesV7?: boolean;
argTypeTargetsV7?: boolean;
legacyMdx1?: boolean;
}
Expand Down
1 change: 0 additions & 1 deletion code/addons/storyshots-core/src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ declare var STORIES: any;
declare var FEATURES:
| {
storyStoreV7?: boolean;
breakingChangesV7?: boolean;
argTypeTargetsV7?: boolean;
}
| undefined;
Expand Down
6 changes: 3 additions & 3 deletions code/addons/toolbars/src/components/ToolbarMenuList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const ToolbarMenuList: FC<ToolbarMenuListProps> = withKeyboardCycle(
id,
name,
description,
toolbar: { icon: _icon, items, title: _title, showName, preventDynamicIcon, dynamicTitle },
toolbar: { icon: _icon, items, title: _title, preventDynamicIcon, dynamicTitle },
}) => {
const [globals, updateGlobals] = useGlobals();
const [isTooltipVisible, setIsTooltipVisible] = useState(false);
Expand All @@ -32,12 +32,12 @@ export const ToolbarMenuList: FC<ToolbarMenuListProps> = withKeyboardCycle(
}

// Deprecation support for old "name of global arg used as title"
if (showName && !title) {
if (!title) {
title = name;
deprecate(
'`showName` is deprecated as `name` will stop having dual purposes in the future. Please specify a `title` in `globalTypes` instead.'
);
} else if (!showName && !icon && !title) {
} else if (!icon && !title) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This branch never gets executed.

title = name;
deprecate(
`Using the \`name\` "${name}" as toolbar title for backward compatibility. \`name\` will stop having dual purposes in the future. Please specify either a \`title\` or an \`icon\` in \`globalTypes\` instead.`
Expand Down
2 changes: 0 additions & 2 deletions code/addons/toolbars/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ export interface NormalizedToolbarConfig {
preventDynamicIcon?: boolean;
items: ToolbarItem[];
shortcuts?: ToolbarShortcuts;
/** @deprecated "name" no longer dual purposes as title - use "title" if a title is wanted */
showName?: boolean;
/** Change title based on selected value */
dynamicTitle?: boolean;
}
Expand Down
1 change: 0 additions & 1 deletion code/frameworks/angular/src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ declare var DOCS_OPTIONS: any;
declare var FEATURES:
| {
storyStoreV7?: boolean;
breakingChangesV7?: boolean;
argTypeTargetsV7?: boolean;
}
| undefined;
Expand Down
1 change: 0 additions & 1 deletion code/lib/core-server/src/__for-testing__/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const config: StorybookConfig = {
},
logLevel: 'debug',
features: {
breakingChangesV7: false,
storyStoreV7: false,
},
framework: {
Expand Down
2 changes: 1 addition & 1 deletion code/lib/core-server/src/build-static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export async function buildStaticStandalone(options: BuildStaticStandaloneOption
...directories,
storyIndexers,
docs: docsOptions,
storiesV2Compatibility: !features?.breakingChangesV7 && !features?.storyStoreV7,
storiesV2Compatibility: !features?.storyStoreV7,
storyStoreV7: !!features?.storyStoreV7,
});

Expand Down
1 change: 0 additions & 1 deletion code/lib/core-server/src/presets/common-preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ export const features = async (
warnOnLegacyHierarchySeparator: true,
buildStoriesJson: false,
storyStoreV7: true,
breakingChangesV7: true,
argTypeTargetsV7: true,
legacyDecoratorFileOrder: false,
});
Expand Down
1 change: 0 additions & 1 deletion code/lib/core-server/src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ declare module 'watchpack';
declare var FEATURES:
| {
storyStoreV7?: boolean;
breakingChangesV7?: boolean;
argTypeTargetsV7?: boolean;
legacyMdx1?: boolean;
}
Expand Down
4 changes: 1 addition & 3 deletions code/lib/core-server/src/utils/getStoryIndexGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import { router } from './router';
export async function getStoryIndexGenerator(
features: {
buildStoriesJson?: boolean;
previewCsfV3?: boolean;
storyStoreV7?: boolean;
breakingChangesV7?: boolean;
argTypeTargetsV7?: boolean;
warnOnLegacyHierarchySeparator?: boolean;
},
Expand All @@ -34,7 +32,7 @@ export async function getStoryIndexGenerator(
storyIndexers: await storyIndexers,
docs: await docsOptions,
workingDir,
storiesV2Compatibility: !features?.breakingChangesV7 && !features?.storyStoreV7,
storiesV2Compatibility: !features?.storyStoreV7,
storyStoreV7: features?.storyStoreV7,
});

Expand Down
1 change: 0 additions & 1 deletion code/lib/instrumenter/src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
declare var FEATURES:
| {
storyStoreV7?: boolean;
breakingChangesV7?: boolean;
argTypeTargetsV7?: boolean;
}
| undefined;
Expand Down
1 change: 0 additions & 1 deletion code/lib/manager-api/src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ declare var __STORYBOOK_ADDONS_MANAGER: any;
declare var FEATURES:
| {
storyStoreV7?: boolean;
breakingChangesV7?: boolean;
argTypeTargetsV7?: boolean;
}
| undefined;
Expand Down
3 changes: 0 additions & 3 deletions code/lib/preview-api/src/modules/core-client/start.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ jest.mock('@storybook/global', () => ({
search: '?id=*',
},
},
FEATURES: {
breakingChangesV7: true,
},
DOCS_OPTIONS: {},
},
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ jest.mock('@storybook/global', () => ({
},
FEATURES: {
storyStoreV7: true,
breakingChangesV7: true,
// xxx
},
fetch: async () => mockFetchResult,
Expand Down
13 changes: 0 additions & 13 deletions code/lib/preview-api/src/modules/store/StoryStore.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Renderer, ProjectAnnotations, StoryIndex } from '@storybook/types';
import { global } from '@storybook/global';
import { expect } from '@jest/globals';

import { prepareStory } from './csf/prepareStory';
Expand All @@ -18,9 +17,6 @@ jest.mock('./csf/processCSFFile', () => ({
jest.mock('@storybook/global', () => ({
global: {
...(jest.requireActual('@storybook/global') as any),
FEATURES: {
breakingChangesV7: true,
},
},
}));

Expand Down Expand Up @@ -988,12 +984,6 @@ describe('StoryStore', () => {

describe('getStoriesJsonData', () => {
describe('in back-compat mode', () => {
beforeEach(() => {
global.FEATURES!.breakingChangesV7 = false;
});
afterEach(() => {
global.FEATURES!.breakingChangesV7 = true;
});
it('maps stories list to payload correctly', async () => {
const store = new StoryStore();
store.setProjectAnnotations(projectAnnotations);
Expand All @@ -1009,7 +999,6 @@ describe('StoryStore', () => {
"kind": "Component One",
"name": "A",
"parameters": Object {
"__id": "component-one--a",
"__isArgsStory": false,
"fileName": "./src/ComponentOne.stories.js",
},
Expand All @@ -1022,7 +1011,6 @@ describe('StoryStore', () => {
"kind": "Component One",
"name": "B",
"parameters": Object {
"__id": "component-one--b",
"__isArgsStory": false,
"fileName": "./src/ComponentOne.stories.js",
},
Expand All @@ -1035,7 +1023,6 @@ describe('StoryStore', () => {
"kind": "Component Two",
"name": "C",
"parameters": Object {
"__id": "component-two--c",
"__isArgsStory": false,
"fileName": "./src/ComponentTwo.stories.js",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ import { prepareStory, prepareMeta } from './prepareStory';
jest.mock('@storybook/global', () => ({
global: {
...(jest.requireActual('@storybook/global') as any),
FEATURES: {
breakingChangesV7: true,
},
},
}));

Expand All @@ -27,10 +24,6 @@ const stringType: SBScalarType = { name: 'string' };
const numberType: SBScalarType = { name: 'number' };
const booleanType: SBScalarType = { name: 'boolean' };

beforeEach(() => {
global.FEATURES = { breakingChangesV7: true };
});

describe('prepareStory', () => {
describe('tags', () => {
it('story tags override component', () => {
Expand Down Expand Up @@ -519,7 +512,7 @@ describe('prepareStory', () => {

describe('with `FEATURES.argTypeTargetsV7`', () => {
beforeEach(() => {
global.FEATURES = { breakingChangesV7: true, argTypeTargetsV7: true };
global.FEATURES = { argTypeTargetsV7: true };
});
it('filters out targeted args', () => {
const renderMock = jest.fn();
Expand Down
13 changes: 0 additions & 13 deletions code/lib/preview-api/src/modules/store/csf/prepareStory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,19 +243,6 @@ function preparePartialAnnotations<TRenderer extends Renderer>(
initialArgsBeforeEnhancers
);

// Add some of our metadata into parameters as we used to do this in 6.x and users may be relying on it

if (!global.FEATURES?.breakingChangesV7) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be removed? I wonder if it's needed somehow in case storyStoreV7 is false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is breakingChangesV7 not always true in SB 7.0 (or must be)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yannbf I don't think it's necessarily to do with ssv7, just an old implementation detail that we used to store these things in parameters. We never told people to read them from there (AFAIK), but we were playing it safe in 6.x.

I think we can definitely drop this code in 7.0, but we may have missed the boat.

Not sure about breakingChangesV7 entirely. Certainly it makes sense to have gotten rid of it (I thought we already did, but it looks like @ndelangen just reversed the default). But other places it has an effect like this I am less sure of.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty confident this is just good to merge. We haven't heard anyone at all about this feature flag. We should have removed it prior, but the name is pretty clear in it's intent.

contextForEnhancers.parameters = {
...contextForEnhancers.parameters,
__id: id,
globals: projectAnnotations.globals,
globalTypes: projectAnnotations.globalTypes,
args: contextForEnhancers.initialArgs,
argTypes: contextForEnhancers.argTypes,
};
}

const { name, story, ...withoutStoryIdentifiers } = contextForEnhancers;

return withoutStoryIdentifiers;
Expand Down
1 change: 0 additions & 1 deletion code/lib/preview-api/src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ declare var FEATURES:
| {
storyStoreV7?: boolean;
storyStoreV7MdxErrors?: boolean;
breakingChangesV7?: boolean;
argTypeTargetsV7?: boolean;
legacyMdx1?: boolean;
legacyDecoratorFileOrder?: boolean;
Expand Down
12 changes: 0 additions & 12 deletions code/lib/types/src/modules/core-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,6 @@ export interface StorybookConfig {
*/
buildStoriesJson?: boolean;

/**
* Activate preview of CSF v3.0
*
* @deprecated This is always on now from 6.4 regardless of the setting
*/
previewCsfV3?: boolean;

/**
* Activate on demand story store
*/
Expand All @@ -299,11 +292,6 @@ export interface StorybookConfig {
*/
storyStoreV7MdxErrors?: boolean;

/**
* Enable a set of planned breaking changes for SB7.0
*/
breakingChangesV7?: boolean;

/**
* Filter args with a "target" on the type from the render function (EXPERIMENTAL)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,5 @@ Object {
},
},
},
"width": Object {
"control": Object {
"type": "number",
},
"description": "",
"name": "width",
"table": Object {
"defaultValue": null,
"jsDocTags": Object {
"deprecated": "Do not use! Use \`size\` instead!

Width of foo",
"ignore": false,
"params": undefined,
"returns": null,
},
"type": Object {
"detail": undefined,
"summary": "number",
},
},
"type": Object {
"name": "number",
"required": true,
},
},
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ Foo.__docgenInfo = {
\\"methods\\": [],
\\"displayName\\": \\"Foo\\",
\\"props\\": {
\\"width\\": {
\\"required\\": true,
\\"tsType\\": {
\\"name\\": \\"number\\"
},
\\"description\\": \\"@deprecated Do not use! Use \`size\` instead!\\\\n\\\\nWidth of foo\\"
},
\\"size\\": {
\\"required\\": true,
\\"tsType\\": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import React from 'react';

interface FooProps {
/**
* @deprecated Do not use! Use `size` instead!
*
* Width of foo
*/
width: number;
/**
* The size (replaces width)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,6 @@
exports[`react component properties 9721-ts-deprecated-jsdoc 1`] = `
Object {
"rows": Array [
Object {
"defaultValue": null,
"description": "",
"jsDocTags": Object {
"deprecated": "Do not use! Use \`size\` instead!

Width of foo",
"ignore": false,
"params": undefined,
"returns": null,
},
"name": "width",
"required": true,
"sbType": Object {
"name": "number",
},
"type": Object {
"detail": undefined,
"summary": "number",
},
},
Object {
"defaultValue": null,
"description": "The size (replaces width)",
Expand Down
1 change: 0 additions & 1 deletion code/ui/manager/src/settings/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ declare module '@storybook/components/src/treeview/utils';
declare var FEATURES:
| {
storyStoreV7?: boolean;
breakingChangesV7?: boolean;
argTypeTargetsV7?: boolean;
}
| undefined;
Expand Down
1 change: 0 additions & 1 deletion code/ui/manager/src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ declare var RELEASE_NOTES_DATA: any;
declare var FEATURES:
| {
storyStoreV7?: boolean;
breakingChangesV7?: boolean;
argTypeTargetsV7?: boolean;
}
| undefined;
Expand Down
1 change: 0 additions & 1 deletion test-storybooks/ember-cli/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ module.exports = {
staticDirs: ['../ember-output'],
features: {
buildStoriesJson: false,
breakingChangesV7: false,
storyStoreV7: false,
},
framework: { name: '@storybook/ember' },
Expand Down