mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-18 05:02:24 +08:00
FIX linting
This commit is contained in:
parent
7db3cc0832
commit
d75bcb896f
@ -18,6 +18,8 @@ module.exports = {
|
||||
globals: {
|
||||
storiesOf: true,
|
||||
addonAPI: true,
|
||||
__DEV__: true,
|
||||
fetch: true,
|
||||
},
|
||||
rules: {
|
||||
strict: [error, 'never'],
|
||||
@ -31,6 +33,8 @@ module.exports = {
|
||||
singleQuote: true,
|
||||
},
|
||||
],
|
||||
'no-console': ignore,
|
||||
'global-require': ignore,
|
||||
quotes: [warn, 'single'],
|
||||
'no-unused-vars': ignore,
|
||||
'class-methods-use-this': ignore,
|
||||
|
@ -28,8 +28,10 @@ Import the `action` function and use it to create actions handlers. When creatin
|
||||
> _Note: Make sure NOT to use reserved words as function names. [issues#29](https://github.com/storybooks/storybook-addon-actions/issues/29#issuecomment-288274794)_
|
||||
|
||||
```js
|
||||
import { storiesOf } from '@storybook/react'
|
||||
import { action } from '@storybook/addon-actions'
|
||||
import { storiesOf } from '@storybook/react';
|
||||
import { action } from '@storybook/addon-actions';
|
||||
|
||||
import Button from './button';
|
||||
|
||||
storiesOf('Button', module)
|
||||
.add('default view', () => (
|
||||
@ -48,6 +50,8 @@ If you wish to process action data before sending them over to the logger, you c
|
||||
```js
|
||||
import { action, decorateAction } from '@storybook/addon-actions'
|
||||
|
||||
import Button from './button';
|
||||
|
||||
const firstArgAction = decorateAction([
|
||||
args => args.slice(0, 1)
|
||||
]);
|
||||
|
@ -15,7 +15,7 @@ This addon works with Storybook for:
|
||||
### Usage
|
||||
|
||||
```sh
|
||||
npm i @storybook/addon-centered
|
||||
npm install @storybook/addon-centered --save-dev
|
||||
```
|
||||
|
||||
#### As a decorator
|
||||
@ -23,11 +23,11 @@ npm i @storybook/addon-centered
|
||||
You can set the decorator locally:
|
||||
|
||||
```js
|
||||
import React from 'react';
|
||||
import { storiesOf } from '@storybook/react';
|
||||
import MyComponent from '../Component';
|
||||
import centered from '@storybook/addon-centered';
|
||||
|
||||
import MyComponent from '../Component';
|
||||
|
||||
storiesOf('MyComponent', module)
|
||||
.addDecorator(centered)
|
||||
.add('without props', () => (<MyComponent />))
|
||||
@ -52,7 +52,6 @@ configure(function () {
|
||||
1 - Configure the extension
|
||||
|
||||
```js
|
||||
import React from 'react';
|
||||
import { configure, setAddon } from '@storybook/react';
|
||||
import centered from '@storybook/addon-centered';
|
||||
|
||||
@ -61,7 +60,7 @@ setAddon({
|
||||
this.add(storyName, (context) => (
|
||||
centered.call(context, storyFn)
|
||||
));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
configure(function () {
|
||||
@ -72,8 +71,8 @@ configure(function () {
|
||||
2 - Use it in your story
|
||||
|
||||
```js
|
||||
import React from 'react';
|
||||
import { storiesOf } from '@storybook/react';
|
||||
|
||||
import Component from '../Component';
|
||||
|
||||
storiesOf('Component', module)
|
||||
|
@ -49,7 +49,9 @@ The `setupGraphiQL` function also accepts a fetcher parameter which can be used
|
||||
import { storiesOf } from '@storybook/react'
|
||||
import { setupGraphiQL } from '@storybook/addon-graphql'
|
||||
|
||||
const fetcher = function (params) {
|
||||
import { url } from './settings';
|
||||
|
||||
const fetcher = params => {
|
||||
const options = {
|
||||
method: 'post',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
|
@ -40,8 +40,8 @@ Then create your stories with the `.addWithInfo` API.
|
||||
|
||||
```js
|
||||
import React from 'react';
|
||||
import Component from './Component';
|
||||
import { storiesOf } from '@storybook/react';
|
||||
import Component from './Component';
|
||||
|
||||
storiesOf('Component')
|
||||
.addWithInfo(
|
||||
|
@ -191,6 +191,8 @@ const value = array(label, defaultValue);
|
||||
> ```js
|
||||
> import { array } from '@storybook/addon-knobs';
|
||||
>
|
||||
> const label = 'Styles';
|
||||
> const defaultValue = ['Red'];
|
||||
> const separator = ':';
|
||||
> const value = array(label, defaultValue, separator);
|
||||
> ```
|
||||
|
@ -33,6 +33,8 @@ storiesOf('Button', module)
|
||||
Have a look at the linkTo function:
|
||||
|
||||
```js
|
||||
import { linkTo } from '@storybook/addon-links'
|
||||
|
||||
linkTo('Toggle', 'off')
|
||||
```
|
||||
|
||||
|
@ -40,6 +40,9 @@ There are multiple options here. for example, you can export conditionally:
|
||||
|
||||
```js
|
||||
import StorybookUI from './storybook';
|
||||
|
||||
import App from './app';
|
||||
|
||||
module.exports = __DEV__ ? StorybookUI : App;
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user