From 529a35bf43dc44d2b302b64a9bcd095440e629b5 Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Tue, 7 Mar 2023 21:47:54 +1100 Subject: [PATCH 1/3] Update error message from storiesOf usage. --- code/lib/csf-tools/src/CsfFile.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/lib/csf-tools/src/CsfFile.ts b/code/lib/csf-tools/src/CsfFile.ts index 266dd66027d4..565602b34fa4 100644 --- a/code/lib/csf-tools/src/CsfFile.ts +++ b/code/lib/csf-tools/src/CsfFile.ts @@ -414,9 +414,10 @@ export class CsfFile { const { callee } = node; if (t.isIdentifier(callee) && callee.name === 'storiesOf') { throw new Error(dedent` - CSF: unexpected storiesOf call ${formatLocation(node, self._fileName)} + Unexpected \`storiesOf\` usage: ${formatLocation(node, self._fileName)}. - More info: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#story-store-v7 + In SB7, we use the \`storyStoreV7\` by default, which does not support \`storiesOf\`. + More info, with details about how to opt-out here: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#storystorev7-enabled-by-default `); } }, From d460bc6c838f79a3a8dd68a4b98151e8c728bb39 Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Tue, 7 Mar 2023 21:51:03 +1100 Subject: [PATCH 2/3] Update code/lib/csf-tools/src/CsfFile.ts --- code/lib/csf-tools/src/CsfFile.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/lib/csf-tools/src/CsfFile.ts b/code/lib/csf-tools/src/CsfFile.ts index 565602b34fa4..bc0d6400827e 100644 --- a/code/lib/csf-tools/src/CsfFile.ts +++ b/code/lib/csf-tools/src/CsfFile.ts @@ -416,7 +416,7 @@ export class CsfFile { throw new Error(dedent` Unexpected \`storiesOf\` usage: ${formatLocation(node, self._fileName)}. - In SB7, we use the \`storyStoreV7\` by default, which does not support \`storiesOf\`. + In SB7, we use the next-generation \`storyStoreV7\` by default, which does not support \`storiesOf\`. More info, with details about how to opt-out here: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#storystorev7-enabled-by-default `); } From 35104b8158af7cc694cd2669536a816e03dc5583 Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Tue, 7 Mar 2023 14:25:29 +0100 Subject: [PATCH 3/3] fix tests --- code/lib/csf-tools/src/CsfFile.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/lib/csf-tools/src/CsfFile.test.ts b/code/lib/csf-tools/src/CsfFile.test.ts index bc6b319ebcc8..2784c6f19f38 100644 --- a/code/lib/csf-tools/src/CsfFile.test.ts +++ b/code/lib/csf-tools/src/CsfFile.test.ts @@ -556,7 +556,7 @@ describe('CsfFile', () => { `, true ) - ).toThrow('CSF: unexpected storiesOf call'); + ).toThrow('Unexpected `storiesOf` usage:'); }); it('function exports', () => {