rsnext/examples/with-storybook/.storybook/config.js
Joe Haddad 18a9c7e371
Improve linting rules to catch more errors (#9374)
* Update `packages/`

* Update examples

* Update tests

* Update bench

* Update top level files

* Fix build

* trigger
2019-11-10 19:24:53 -08:00

25 lines
795 B
JavaScript

import { configure, addParameters } from '@storybook/react'
addParameters({
options: {
storySort: (a, b) => {
// We want the Welcome story at the top
if (a[1].kind === 'Welcome') {
return -1
}
// Sort the other stories by ID
// https://github.com/storybookjs/storybook/issues/548#issuecomment-530305279
return a[1].kind === b[1].kind
? 0
: a[1].id.localeCompare(b[1].id, { numeric: true })
},
},
})
// automatically import all files ending in *.stories.js
const req = require.context('../stories', true, /.stories.js$/)
// the first argument can be an array too, so if you want to load from different locations or
// different extensions, you can do it like this: configure([req1, req2], module)
configure(req, module)