-
Notifications
You must be signed in to change notification settings - Fork 83
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
feat: upgrade Storybook to v7 #6499
Conversation
95c3392
to
29ac72c
Compare
5131f82
to
26e97b3
Compare
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit c3a4371:
|
e34613b
to
00afd6b
Compare
.eslintrc
Outdated
@@ -93,7 +93,17 @@ | |||
} | |||
] | |||
} | |||
] | |||
], | |||
/* These rules have been added to allow us to upgrade during Storybook upgrae |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* These rules have been added to allow us to upgrade during Storybook upgrae | |
/* These rules have been added to allow us to upgrade during Storybook upgrade |
suggestion: typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* These rules have been added to allow us to upgrade during Storybook upgrae | |
/* These rules have been added to allow us to upgrade Storybook |
{ | ||
"files": ["*.mdx"], | ||
"extends": "plugin:mdx/recommended", | ||
"rules": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment (non-blocking): unlike the rules above, I'm really not keen on turning these off because they're about accessibility, not just code style. I've just played with it a bit and I'm not sure why we're getting flagged for these two - a lot of the failures seem to be in the same places for both and relate to anchor tags that have perfectly clear text content, so I don't know why that's failing.
As for self-closing-comp, this matters less (imo) but it should be an easy thing to fix where we have problems. Again though this is coming up in the same places, where it really shouldn't - so I think eslint is somehow misreading our code and this is giving rise to all 3 rule failures.
Happy to leave for now and open a new ticket to investigate - but I don't think we should just brush this under the carpet, and in that new ticket we should make a note to turn these rules back on when we've fixed whatever is going on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll double check these rules as per your comment when I go through all the suggestions etc but for the record we've never had linting on mdx files and as I recall when I've added it these weren't possible to "fix" as there was nothing actually wrong. As I say, I will double check this though and you're right we could maybe do some investigation but there is a ticket created to go through all of our linting rules and strip it back as there's a lot of rules that we're putting in just because it's in airbnb's ruleset and I believe it would better to simplify this a fair bit and have more control for the team
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yes, I'd missed that we didn't have any linting on mdx before.
As I said, these seem to be failing for no good reason as they're on code that absolutely shouldn't fail these rules. Happy to have a new ticket to investigate so this PR doesn't get bogged down with it, but I don't want to just disable important accessibility-related checks and forget about it, even if we end up going with this as a temporary fix for now.
@@ -31,6 +35,7 @@ module.exports = { | |||
"@storybook/addon-google-analytics", | |||
"@storybook/addon-links", | |||
"@storybook/addon-toolbars", | |||
"@storybook/addon-mdx-gfm", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment (non-blocking): I'm sure you're aware, but according to the docs for this addon it's not going to be around for long and we should really be doing this "properly". I've no idea how big a job this would be - but we definitely should add a new task for this if we can't easily do it now, or we'll have another large-ish task for that in the near future!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, this is very likely just an oversight. Storybook automatically add it when you run their upgrade wizard to 7 to assist in the update. I don't think it should be needed for us now as I think I've updated all MDX files accordingly but I will check to make sure before removing it otherwise I'll have to raise a ticket to ensure we complete that conversion
docs/testing-guide.mdx
Outdated
@@ -1,3 +1,7 @@ | |||
import { Meta } from "@storybook/addon-docs"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment as with the dev-environment-setup
file above, I think this is supposed to be a guide on Github and shouldn't be in our public-facing docs on storybook
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment (non-blocking): I don't particularly like calling this file .stories.tsx
when we're not actually using any "stories" from it, and are purely using it to generate the props table. Only an opinion of course, maybe there's a good reason for keeping this name. Although I also wonder if by changing the naming convention, so they won't be found by looking for all the files with this ending, we can remove the need for the isHidden
tag, which would be another advantage to renaming (although I appreciate that it would be a lot of effort to change now, so maybe not worth worrying over)?
Obviously the same applies to the many similar files across all components.
docs/codebase-overview.mdx
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment (non-blocking): I also notice that this file has extensive documentation on how we use Storybook, some of which will certainly need updating as it's not correct with the changes you've made for Storybook v7 (eg argsTable
has been renamed, and there is no noHeader
prop on it). Happy for this to be a separate task though rather than done as this PR (we might even decide to remove this file entirely, if we think the documentation isn't useful and/or no-one reads it!)
00afd6b
to
0616196
Compare
/> | ||
</div> | ||
</> | ||
<div |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (non-blocking): another div
that could be replaced with a Box
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: great work to get this huge update over the line. I especially admire the attention to detail, including fixing various little details (eg wording fixes) that came up along the way. Great job 👍
0616196
to
2de70ee
Compare
@@ -104,22 +96,22 @@ const MyComponent = () => ( | |||
|
|||
`AnchorNavigation` can be placed anywhere on the page to help with navigating long scrollable sections. | |||
|
|||
<Story name="default">{DefaultStory.bind({})}</Story> | |||
<Story of={AnchorNavigationStories.DefaultStory} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same on master currently. To be sorted as part of the Story reviews I guess
<DeprecationWarning> | ||
StepSequence has been deprecated in Carbon and the Design System. | ||
<br /> | ||
It is recommended to use the StepFlow component - which is an accessible | ||
alternative. | ||
</DeprecationWarning> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue(non-blocking): I noticed a small styling change to the rendered DeprecationWarning
component compared with production. It seems the inner text is now rendered as a paragraph tag inside the component, meaning certain style rules are not being overridden.
New style changes
Current styles in production
decorators: [ | ||
(Story) => ( | ||
<div style={{ position: "relative", height: "250px" }}> | ||
<Story /> | ||
</div> | ||
), | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: the docs page loads much more quickly now 👍🏼
GlobalLocalNavBarLayout.parameters = { | ||
docs: { inlineStories: false, iframeHeight: 250 }, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question(non-blocking): do we need to make this an inline story given we are wrapping the component in a containing block via the decorator on line 29?
dc7fc70
to
601ef83
Compare
48b32a9
to
35c1b0b
Compare
bd4936a
to
361a323
Compare
361a323
to
7cb4558
Compare
7cb4558
to
750af75
Compare
Proposed behaviour
Upgrade Storybook to v7
Upgrade ESLint to support MDX files
Convert all stories to be CSF3 compatible
Current behaviour
Storybook is on v6
Checklist
d.ts
file added or updated if requiredQA