diff --git a/.eslintrc.js b/.eslintrc.js index 3a70661031b9..ad34e8fc73a4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -14,6 +14,7 @@ module.exports = { plugins: ['prettier', 'jest', 'import', 'react', 'jsx-a11y', 'json'], parser: 'babel-eslint', parserOptions: { + ecmaVersion: 8, sourceType: 'module', }, env: { diff --git a/addons/a11y/src/components/Panel.js b/addons/a11y/src/components/Panel.js index d371ebc10359..3796cc5e75d8 100644 --- a/addons/a11y/src/components/Panel.js +++ b/addons/a11y/src/components/Panel.js @@ -35,21 +35,27 @@ class Panel extends Component { }; componentDidMount() { - this.props.channel.on(CHECK_EVENT_ID, this.onUpdate); - this.props.channel.on(STORY_RENDERED, this.requestCheck); - this.props.channel.on(RERUN_EVENT_ID, this.requestCheck); + const { channel } = this.props; + + channel.on(CHECK_EVENT_ID, this.onUpdate); + channel.on(STORY_RENDERED, this.requestCheck); + channel.on(RERUN_EVENT_ID, this.requestCheck); } componentDidUpdate(prevProps) { - if (!prevProps.active && this.props.active) { + const { active } = this.props; + + if (!prevProps.active && active) { this.requestCheck(); } } componentWillUnmount() { - this.props.channel.removeListener(CHECK_EVENT_ID, this.onUpdate); - this.props.channel.removeListener(STORY_RENDERED, this.requestCheck); - this.props.channel.removeListener(RERUN_EVENT_ID, this.requestCheck); + const { channel } = this.props; + + channel.removeListener(CHECK_EVENT_ID, this.onUpdate); + channel.removeListener(STORY_RENDERED, this.requestCheck); + channel.removeListener(RERUN_EVENT_ID, this.requestCheck); } onUpdate = ({ passes, violations }) => { @@ -60,8 +66,10 @@ class Panel extends Component { }; requestCheck = () => { - if (this.props.active) { - this.props.channel.emit(REQUEST_CHECK_EVENT_ID); + const { channel, active } = this.props; + + if (active) { + channel.emit(REQUEST_CHECK_EVENT_ID); } }; diff --git a/addons/a11y/src/components/Report/Elements.js b/addons/a11y/src/components/Report/Elements.js index 4b34e24870d3..3a957b513356 100644 --- a/addons/a11y/src/components/Report/Elements.js +++ b/addons/a11y/src/components/Report/Elements.js @@ -40,7 +40,9 @@ Element.propTypes = { /* eslint-disable react/no-array-index-key */ const Elements = ({ elements, passes }) => (
    - {elements.map((element, index) => )} + {elements.map((element, index) => ( + + ))}
); diff --git a/addons/a11y/src/components/Report/Rules.js b/addons/a11y/src/components/Report/Rules.js index 5702ea3b619e..33510dd4d0a5 100644 --- a/addons/a11y/src/components/Report/Rules.js +++ b/addons/a11y/src/components/Report/Rules.js @@ -61,7 +61,11 @@ Rule.propTypes = { /* eslint-disable react/no-array-index-key */ function Rules({ rules, passes }) { return ( - {rules.map((rule, index) => )} + + {rules.map((rule, index) => ( + + ))} + ); } Rules.propTypes = { diff --git a/addons/a11y/src/components/Report/Tags.js b/addons/a11y/src/components/Report/Tags.js index 0800dbb6c299..a79d7dae7c1d 100644 --- a/addons/a11y/src/components/Report/Tags.js +++ b/addons/a11y/src/components/Report/Tags.js @@ -17,7 +17,13 @@ const Item = styled('div')(({ theme }) => ({ })); function Tags({ tags }) { - return {tags.map(tag => {tag})}; + return ( + + {tags.map(tag => ( + {tag} + ))} + + ); } Tags.propTypes = { tags: PropTypes.arrayOf(PropTypes.node).isRequired, diff --git a/addons/actions/src/constants.js b/addons/actions/src/constants.js new file mode 100644 index 000000000000..f037806909f6 --- /dev/null +++ b/addons/actions/src/constants.js @@ -0,0 +1,4 @@ +export const ADDON_ID = 'storybook/actions'; +export const PANEL_ID = `${ADDON_ID}/actions-panel`; +export const EVENT_ID = `${ADDON_ID}/action-event`; +export const CYCLIC_KEY = '$___storybook.isCyclic'; diff --git a/addons/actions/src/containers/ActionLogger/index.js b/addons/actions/src/containers/ActionLogger/index.js index 6d78106dfb9d..0873523a4da9 100644 --- a/addons/actions/src/containers/ActionLogger/index.js +++ b/addons/actions/src/containers/ActionLogger/index.js @@ -6,8 +6,8 @@ import deepEqual from 'deep-equal'; import { CYCLIC_KEY, retrocycle } from '../../lib'; import { isObject } from '../../lib/util'; -import ActionLoggerComponent from '../../components/ActionLogger/'; -import { EVENT_ID } from '../../'; +import ActionLoggerComponent from '../../components/ActionLogger'; +import { EVENT_ID } from '../..'; export default class ActionLogger extends React.Component { constructor(props, ...args) { @@ -18,12 +18,16 @@ export default class ActionLogger extends React.Component { } componentDidMount() { - this.props.channel.on(EVENT_ID, this._actionListener); - this.stopListeningOnStory = this.props.api.onStory(this._storyChangeListener); + const { channel, api } = this.props; + + channel.on(EVENT_ID, this._actionListener); + this.stopListeningOnStory = api.onStory(this._storyChangeListener); } componentWillUnmount() { - this.props.channel.removeListener(EVENT_ID, this._actionListener); + const { channel } = this.props; + + channel.removeListener(EVENT_ID, this._actionListener); if (this.stopListeningOnStory) { this.stopListeningOnStory(); } @@ -37,9 +41,11 @@ export default class ActionLogger extends React.Component { } addAction(action) { + let { actions = [] } = this.state; + actions = [...actions]; + action.data.args = action.data.args.map(arg => retrocycle(arg)); // eslint-disable-line const isCyclic = !!action.data.args.find(arg => isObject(arg) && arg[CYCLIC_KEY]); - const actions = [...this.state.actions]; const previous = actions.length && actions[0]; if (previous && !isCyclic && deepEqual(previous.data, action.data, { strict: true })) { @@ -56,9 +62,10 @@ export default class ActionLogger extends React.Component { } render() { + const { actions = [] } = this.state; const { active } = this.props; const props = { - actions: this.state.actions, + actions, onClear: () => this.clearActions(), }; return active ? : null; diff --git a/addons/actions/src/index.js b/addons/actions/src/index.js index 35d2ab3d4a92..9a7bf0283daa 100644 --- a/addons/actions/src/index.js +++ b/addons/actions/src/index.js @@ -8,8 +8,16 @@ import { } from './preview'; // addons, panels and events get unique names using a prefix -export const ADDON_ID = 'storybook/actions'; -export const PANEL_ID = `${ADDON_ID}/actions-panel`; -export const EVENT_ID = `${ADDON_ID}/action-event`; +import { ADDON_ID, PANEL_ID, EVENT_ID } from './constants'; -export { action, actions, decorate, configureActions, decorateAction, withActions }; +export { + action, + actions, + decorate, + configureActions, + decorateAction, + withActions, + ADDON_ID, + PANEL_ID, + EVENT_ID, +}; diff --git a/addons/actions/src/lib/decycle.js b/addons/actions/src/lib/decycle.js index c233e463be4c..eea5bef31fb6 100644 --- a/addons/actions/src/lib/decycle.js +++ b/addons/actions/src/lib/decycle.js @@ -2,7 +2,7 @@ import { DecycleError } from './errors'; import { getPropertiesList, typeReplacer, omitProperty } from './util'; -import { CYCLIC_KEY } from './'; +import { CYCLIC_KEY } from '../constants'; import { objectType } from './types'; diff --git a/addons/actions/src/lib/retrocycle.js b/addons/actions/src/lib/retrocycle.js index 0951445b3625..be61427e91ef 100644 --- a/addons/actions/src/lib/retrocycle.js +++ b/addons/actions/src/lib/retrocycle.js @@ -1,6 +1,6 @@ import reviver from './reviver'; import { muteProperty } from './util'; -import { CYCLIC_KEY } from './'; +import { CYCLIC_KEY } from '../constants'; // eslint-disable-next-line no-control-regex const pathReg = /^\$(?:\[(?:\d+|"(?:[^\\"\u0000-\u001f]|\\([\\"/bfnrt]|u[0-9a-zA-Z]{4}))*")])*$/; diff --git a/addons/actions/src/lib/types/date/__tests__/index.js b/addons/actions/src/lib/types/date/__tests__/index.js index 92df8dc0e9e9..e588e2e326a7 100644 --- a/addons/actions/src/lib/types/date/__tests__/index.js +++ b/addons/actions/src/lib/types/date/__tests__/index.js @@ -1,4 +1,4 @@ -import dateType from '../'; +import dateType from '..'; const date = new Date(1512137134873); const isoString = date.toISOString(); diff --git a/addons/actions/src/lib/types/function/__tests__/index.js b/addons/actions/src/lib/types/function/__tests__/index.js index 9e4f0e8b7836..0b31acc756aa 100644 --- a/addons/actions/src/lib/types/function/__tests__/index.js +++ b/addons/actions/src/lib/types/function/__tests__/index.js @@ -1,4 +1,4 @@ -import functionType from '../'; +import functionType from '..'; import reservedKeywords from '../reservedKeywords'; import createFunction from '../createFunction'; import createBoundFunction from '../createBoundFunction'; diff --git a/addons/actions/src/lib/types/infinity/__tests__/index.js b/addons/actions/src/lib/types/infinity/__tests__/index.js index 926d8b78466f..5db2882a1d09 100644 --- a/addons/actions/src/lib/types/infinity/__tests__/index.js +++ b/addons/actions/src/lib/types/infinity/__tests__/index.js @@ -1,4 +1,4 @@ -import infinityType from '../'; +import infinityType from '..'; describe('Infinity', () => { it('Recognizes Infinity', () => { diff --git a/addons/actions/src/lib/types/nan/__tests__/index.js b/addons/actions/src/lib/types/nan/__tests__/index.js index 7a2e4a5b77f8..0bf1bb16582c 100644 --- a/addons/actions/src/lib/types/nan/__tests__/index.js +++ b/addons/actions/src/lib/types/nan/__tests__/index.js @@ -1,4 +1,4 @@ -import nanType from '../'; +import nanType from '..'; describe('NaN', () => { it('Recognizes NaN', () => { diff --git a/addons/actions/src/lib/types/object/__tests__/index.js b/addons/actions/src/lib/types/object/__tests__/index.js index 04caf09e5d04..e2324d934008 100644 --- a/addons/actions/src/lib/types/object/__tests__/index.js +++ b/addons/actions/src/lib/types/object/__tests__/index.js @@ -1,4 +1,4 @@ -import objectType from '../'; +import objectType from '..'; import { DEPTH_KEY } from '../configureDepth'; describe('Object', () => { diff --git a/addons/actions/src/lib/types/regexp/__tests__/index.js b/addons/actions/src/lib/types/regexp/__tests__/index.js index f00cb58e82a6..f924894a865b 100644 --- a/addons/actions/src/lib/types/regexp/__tests__/index.js +++ b/addons/actions/src/lib/types/regexp/__tests__/index.js @@ -1,4 +1,4 @@ -import regExpType from '../'; +import regExpType from '..'; const regExp = /aRegExp/g; diff --git a/addons/actions/src/lib/types/symbol/__tests__/index.js b/addons/actions/src/lib/types/symbol/__tests__/index.js index 6b23044ba591..792ce0e15aac 100644 --- a/addons/actions/src/lib/types/symbol/__tests__/index.js +++ b/addons/actions/src/lib/types/symbol/__tests__/index.js @@ -1,4 +1,4 @@ -import symbolType from '../'; +import symbolType from '..'; const symbol = Symbol('S'); diff --git a/addons/actions/src/lib/types/undefined/__tests__/index.js b/addons/actions/src/lib/types/undefined/__tests__/index.js index b144f47f1035..da8edd78eceb 100644 --- a/addons/actions/src/lib/types/undefined/__tests__/index.js +++ b/addons/actions/src/lib/types/undefined/__tests__/index.js @@ -1,4 +1,4 @@ -import undefinedType from '../'; +import undefinedType from '..'; describe('undefined', () => { it('Recognizes undefined', () => { diff --git a/addons/actions/src/manager.js b/addons/actions/src/manager.js index 43eea1709d91..feee5973d056 100644 --- a/addons/actions/src/manager.js +++ b/addons/actions/src/manager.js @@ -1,7 +1,7 @@ import React from 'react'; import addons from '@storybook/addons'; import ActionLogger from './containers/ActionLogger'; -import { ADDON_ID, PANEL_ID } from './'; +import { ADDON_ID, PANEL_ID } from '.'; export function register() { addons.register(ADDON_ID, api => { diff --git a/addons/actions/src/preview/__tests__/action.test.js b/addons/actions/src/preview/__tests__/action.test.js index fd5c301bb59f..8f221c61e771 100644 --- a/addons/actions/src/preview/__tests__/action.test.js +++ b/addons/actions/src/preview/__tests__/action.test.js @@ -1,5 +1,5 @@ import addons from '@storybook/addons'; -import { action, configureActions } from '../../'; +import { action, configureActions } from '../..'; jest.mock('@storybook/addons'); diff --git a/addons/actions/src/preview/__tests__/configureActions.test.js b/addons/actions/src/preview/__tests__/configureActions.test.js index bcdf7fad592d..7bebbe8a2524 100644 --- a/addons/actions/src/preview/__tests__/configureActions.test.js +++ b/addons/actions/src/preview/__tests__/configureActions.test.js @@ -1,5 +1,5 @@ import { config } from '../configureActions'; -import { configureActions } from '../../'; +import { configureActions } from '../..'; describe('Configure Actions', () => { it('can configure actions', () => { diff --git a/addons/actions/src/preview/__tests__/preview.test.js b/addons/actions/src/preview/__tests__/preview.test.js index b6e562d5a58b..3e15c894ce81 100644 --- a/addons/actions/src/preview/__tests__/preview.test.js +++ b/addons/actions/src/preview/__tests__/preview.test.js @@ -1,6 +1,6 @@ import addons from '@storybook/addons'; import uuid from 'uuid/v1'; -import { action } from '../'; +import { action } from '..'; import { undefinedType, symbolType } from '../../lib/types'; jest.mock('uuid/v1'); diff --git a/addons/actions/src/preview/action.js b/addons/actions/src/preview/action.js index 8aa911149448..cf290276f747 100644 --- a/addons/actions/src/preview/action.js +++ b/addons/actions/src/preview/action.js @@ -1,6 +1,6 @@ import uuid from 'uuid/v1'; import addons from '@storybook/addons'; -import { EVENT_ID } from '../'; +import { EVENT_ID } from '../constants'; import { canConfigureName, prepareArguments } from '../lib/util'; import { config } from './configureActions'; diff --git a/addons/backgrounds/src/BackgroundPanel.js b/addons/backgrounds/src/BackgroundPanel.js index 5d571fd1f088..ea1e9bcd53a7 100644 --- a/addons/backgrounds/src/BackgroundPanel.js +++ b/addons/backgrounds/src/BackgroundPanel.js @@ -1,11 +1,10 @@ import { document } from 'global'; import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import addons from '@storybook/addons'; import styled from 'react-emotion'; -import Events from './events'; +import Events from './constants'; import Swatch from './Swatch'; const Wrapper = styled('div')({ @@ -76,19 +75,11 @@ export default class BackgroundPanel extends Component { constructor(props) { super(props); - const { channel } = props; - - // A channel is explicitly passed in for testing - if (channel) { - this.channel = channel; - } else { - this.channel = addons.getChannel(); - } - this.state = { backgrounds: [] }; } componentDidMount() { + const { api, channel } = this.props; this.iframe = document.getElementById(storybookIframe); if (!this.iframe) { @@ -99,29 +90,33 @@ export default class BackgroundPanel extends Component { this.iframe.style[prop] = style.iframe[prop]; }); - const { api } = this.props; + channel.on(Events.SET, data => { + const backgrounds = [...data]; - this.channel.on(Events.SET, backgrounds => { this.setState({ backgrounds }); - const currentBackground = api.getQueryParam('background'); + const current = api.getQueryParam('background'); + const defaultOrFirst = backgrounds.find(x => x.default) || backgrounds[0]; - if (currentBackground && backgrounds.some(bg => bg.value === currentBackground)) { - this.updateIframe(currentBackground); - } else if (backgrounds.filter(x => x.default).length) { - const defaultBgs = backgrounds.filter(x => x.default); - this.updateIframe(defaultBgs[0].value); + // debugger; + + if (current && backgrounds.find(bg => bg.value === current)) { + this.updateIframe(current); + } else if (defaultOrFirst) { + this.updateIframe(defaultOrFirst.value); + api.setQueryParams({ background: defaultOrFirst.value }); } }); - this.channel.on(Events.UNSET, () => { + channel.on(Events.UNSET, () => { this.setState({ backgrounds: [] }); this.updateIframe('none'); }); } setBackgroundFromSwatch = background => { + const { api } = this.props; this.updateIframe(background); - this.props.api.setQueryParams({ background }); + api.setQueryParams({ background }); }; updateIframe(background) { @@ -130,7 +125,8 @@ export default class BackgroundPanel extends Component { render() { const { active } = this.props; - const backgrounds = [...this.state.backgrounds]; + const { backgrounds = [] } = this.state; + if (!active) { return null; } diff --git a/addons/backgrounds/src/__tests__/BackgroundPanel.js b/addons/backgrounds/src/__tests__/BackgroundPanel.js index 8c9f59aac76c..6cdee1c901bb 100644 --- a/addons/backgrounds/src/__tests__/BackgroundPanel.js +++ b/addons/backgrounds/src/__tests__/BackgroundPanel.js @@ -3,10 +3,10 @@ import { shallow, mount } from 'enzyme'; import EventEmitter from 'events'; import BackgroundPanel from '../BackgroundPanel'; -import Events from '../events'; +import Events from '../constants'; const backgrounds = [ - { name: 'black', value: '#000000' }, + { name: 'black', value: '#000000', default: true }, { name: 'secondary', value: 'rgb(123,123,123)' }, { name: 'tertiary', value: 'rgba(123,123,123,.5)' }, { name: 'An image', value: 'url(http://placehold.it/350x150)' }, diff --git a/addons/backgrounds/src/constants.js b/addons/backgrounds/src/constants.js new file mode 100644 index 000000000000..39aaf50856a0 --- /dev/null +++ b/addons/backgrounds/src/constants.js @@ -0,0 +1,7 @@ +export const ADDON_ID = 'storybook-addon-background'; +export const PANEL_ID = `${ADDON_ID}/background-panel`; + +export default { + SET: `${ADDON_ID}:set`, + UNSET: `${ADDON_ID}:unset`, +}; diff --git a/addons/backgrounds/src/events.js b/addons/backgrounds/src/events.js deleted file mode 100644 index 25c9f6871f86..000000000000 --- a/addons/backgrounds/src/events.js +++ /dev/null @@ -1,6 +0,0 @@ -const ADDON_ID = 'backgrounds'; - -export default { - SET: `${ADDON_ID}:set`, - UNSET: `${ADDON_ID}:unset`, -}; diff --git a/addons/backgrounds/src/index.js b/addons/backgrounds/src/index.js index 859375d6607c..54419abb73a8 100644 --- a/addons/backgrounds/src/index.js +++ b/addons/backgrounds/src/index.js @@ -2,7 +2,7 @@ import addons, { makeDecorator } from '@storybook/addons'; import CoreEvents from '@storybook/core-events'; import deprecate from 'util-deprecate'; -import Events from './events'; +import Events, { ADDON_ID } from './constants'; let prevBackgrounds; @@ -12,12 +12,13 @@ const subscription = () => () => { }; export const withBackgrounds = makeDecorator({ - name: 'backgrounds', + name: ADDON_ID, parameterName: 'backgrounds', skipIfNoParametersOrOptions: true, allowDeprecatedUsage: true, wrapper: (getStory, context, { options, parameters }) => { - const backgrounds = parameters || options; + const data = parameters || options || []; + const backgrounds = Array.isArray(data) ? data : Object.values(data); if (backgrounds.length === 0) { return getStory(context); diff --git a/addons/backgrounds/src/register.js b/addons/backgrounds/src/register.js index c1a380e25443..0bd614430dae 100644 --- a/addons/backgrounds/src/register.js +++ b/addons/backgrounds/src/register.js @@ -1,11 +1,9 @@ import React from 'react'; import addons from '@storybook/addons'; +import { ADDON_ID, PANEL_ID } from './constants'; import BackgroundPanel from './BackgroundPanel'; -const ADDON_ID = 'storybook-addon-background'; -const PANEL_ID = `${ADDON_ID}/background-panel`; - addons.register(ADDON_ID, api => { const channel = addons.getChannel(); addons.addPanel(PANEL_ID, { diff --git a/addons/events/src/components/Event.js b/addons/events/src/components/Event.js index b81d178ee6a0..a24521fd7297 100644 --- a/addons/events/src/components/Event.js +++ b/addons/events/src/components/Event.js @@ -101,20 +101,6 @@ class Item extends Component { isTextAreaShowed: false, }; - static getDerivedStateFromProps = ({ payload }, { prevPayload }) => { - if (payload !== prevPayload) { - const payloadString = json.plain(payload); - - return { - failed: false, - payload: getJSONFromString(payloadString), - payloadString, - prevPayload, - }; - } - return null; - }; - onChange = ({ target: { value } }) => { const newState = { payloadString: value, @@ -131,9 +117,12 @@ class Item extends Component { }; onEmitClick = () => { - this.props.onEmit({ - name: this.props.name, - payload: this.state.payload, + const { onEmit, name } = this.props; + const { payload } = this.state; + + onEmit({ + name, + payload, }); }; @@ -143,9 +132,23 @@ class Item extends Component { })); }; + static getDerivedStateFromProps = ({ payload }, { prevPayload }) => { + if (payload !== prevPayload) { + const payloadString = json.plain(payload); + + return { + failed: false, + payload: getJSONFromString(payloadString), + payloadString, + prevPayload, + }; + } + return null; + }; + render() { const { title, name } = this.props; - const { failed, isTextAreaShowed } = this.state; + const { failed, isTextAreaShowed, payloadString } = this.state; return ( @@ -158,7 +161,7 @@ class Item extends Component { {isTextAreaShowed ? ( diff --git a/addons/events/src/components/Panel.js b/addons/events/src/components/Panel.js index 7061171ac8d8..413c7a6a2b60 100644 --- a/addons/events/src/components/Panel.js +++ b/addons/events/src/components/Panel.js @@ -28,11 +28,15 @@ export default class Events extends Component { }; componentDidMount() { - this.props.channel.on(EVENTS.ADD, this.onAdd); + const { channel } = this.props; + + channel.on(EVENTS.ADD, this.onAdd); } componentWillUnmount() { - this.props.channel.removeListener(EVENTS.ADD, this.onAdd); + const { channel } = this.props; + + channel.removeListener(EVENTS.ADD, this.onAdd); } onAdd = events => { @@ -40,7 +44,9 @@ export default class Events extends Component { }; onEmit = event => { - this.props.channel.emit(EVENTS.EMIT, event); + const { channel } = this.props; + + channel.emit(EVENTS.EMIT, event); }; render() { @@ -48,7 +54,9 @@ export default class Events extends Component { const { active } = this.props; return active ? ( - {events.map(event => )} + {events.map(event => ( + + ))} ) : null; } diff --git a/addons/graphql/src/components/FullScreen/index.js b/addons/graphql/src/components/FullScreen/index.js index 4126671d5c32..adcea598dbcb 100644 --- a/addons/graphql/src/components/FullScreen/index.js +++ b/addons/graphql/src/components/FullScreen/index.js @@ -2,8 +2,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import style from './style'; -export default function FullScreen(props) { - return
{props.children}
; +export default function FullScreen({ children }) { + return
{children}
; } FullScreen.defaultProps = { children: null }; diff --git a/addons/info/src/__snapshots__/index.test.js.snap b/addons/info/src/__snapshots__/index.test.js.snap index 842fb68d013e..e88575b55e15 100644 --- a/addons/info/src/__snapshots__/index.test.js.snap +++ b/addons/info/src/__snapshots__/index.test.js.snap @@ -1250,55 +1250,6 @@ exports[`addon Info should render and external markdown 1`] = ` -
-

- Prop Types -

-
-

- " - TestComponent - " Component -

- - - - No propTypes defined! - - - -
-
@@ -2650,55 +2601,6 @@ containing **bold**, *cursive* text, \`code\` and [a link](https://github.com)" -
-

- Prop Types -

-
-

- " - TestComponent - " Component -

- - - - No propTypes defined! - - - -
-
diff --git a/addons/info/src/components/Node.js b/addons/info/src/components/Node.js index 6369ec017947..c4f850a68ae6 100644 --- a/addons/info/src/components/Node.js +++ b/addons/info/src/components/Node.js @@ -76,7 +76,10 @@ export default function Node(props) { if (!children) { return (
- <{name} + + < + {name} +
- <{name} + + < + {name} + ))}
- </{name}> + + </ + {name} + > +
); diff --git a/addons/info/src/components/Props.js b/addons/info/src/components/Props.js index 5c40235fbd85..851b160ee1ea 100644 --- a/addons/info/src/components/Props.js +++ b/addons/info/src/components/Props.js @@ -9,9 +9,16 @@ const stylesheet = { }; export default function Props(props) { - const { maxPropsIntoLine, maxPropArrayLength, maxPropObjectKeys, maxPropStringLength } = props; - const nodeProps = props.node.props; - const { defaultProps } = props.node.type; + const { + maxPropsIntoLine, + maxPropArrayLength, + maxPropObjectKeys, + maxPropStringLength, + node, + singleLine, + } = props; + const nodeProps = node.props; + const { defaultProps } = node.type; if (!nodeProps || typeof nodeProps !== 'object') { return ; } @@ -26,7 +33,7 @@ export default function Props(props) { ); const breakIntoNewLines = names.length > maxPropsIntoLine; - const endingSpace = props.singleLine ? ' ' : ''; + const endingSpace = singleLine ? ' ' : ''; const items = []; names.forEach((name, i) => { @@ -34,7 +41,8 @@ export default function Props(props) { {breakIntoNewLines ? ( -
   +
+   
) : ( ' ' diff --git a/addons/info/src/components/Story.js b/addons/info/src/components/Story.js index b851fa113e26..5201f7e3eb7a 100644 --- a/addons/info/src/components/Story.js +++ b/addons/info/src/components/Story.js @@ -1,6 +1,6 @@ /* eslint no-underscore-dangle: 0 */ -import React, { createElement } from 'react'; +import React, { Component, createElement } from 'react'; import { polyfill } from 'react-lifecycles-compat'; import PropTypes from 'prop-types'; import global from 'global'; @@ -16,7 +16,7 @@ const { STORYBOOK_REACT_CLASSES } = global; const getName = type => type.displayName || type.name; -const stylesheet = { +const stylesheetBase = { button: { base: { fontFamily: 'sans-serif', @@ -101,29 +101,34 @@ const stylesheet = { }, }; -class Story extends React.Component { - constructor(...args) { - super(...args); +class Story extends Component { + constructor(props, ...args) { + super(props, ...args); this.state = { open: false, }; this.marksy = marksy({ createElement, - elements: this.props.components, + elements: props.components, }); } _renderStory() { - return
{this.props.children}
; + const { stylesheet } = this.state; + const { children } = this.props; + + return
{children}
; } _renderInline() { + const { stylesheet } = this.state; + return (
{this._renderInlineHeader()} {this._renderStory()} -
-
+
+
{this._getInfoContent()} {this._getComponentDescription()} {this._getSourceCode()} @@ -135,25 +140,30 @@ class Story extends React.Component { } _renderInlineHeader() { + const { stylesheet } = this.state; + const infoHeader = this._getInfoHeader(); return ( infoHeader && ( -
-
{infoHeader}
+
+
{infoHeader}
) ); } _renderOverlay() { + const { stylesheet, open } = this.state; + const { children } = this.props; + const buttonStyle = { - ...this.state.stylesheet.button.base, - ...this.state.stylesheet.button.topRight, + ...stylesheet.button.base, + ...stylesheet.button.topRight, }; - const infoStyle = Object.assign({}, this.state.stylesheet.info); - if (!this.state.open) { + const infoStyle = Object.assign({}, stylesheet.info); + if (!open) { infoStyle.display = 'none'; } @@ -169,7 +179,7 @@ class Story extends React.Component { return (
-
{this.props.children}
+
{children}
@@ -177,8 +187,8 @@ class Story extends React.Component { -
-
+
+
{this._getInfoHeader()} {this._getInfoContent()} {this._getComponentDescription()} @@ -192,38 +202,36 @@ class Story extends React.Component { } _getInfoHeader() { - if (!this.props.context || !this.props.showHeader) { + const { stylesheet } = this.state; + const { context, showHeader } = this.props; + + if (!context || !showHeader) { return null; } return ( -
-

{this.props.context.kind}

-

{this.props.context.story}

+
+

{context.kind}

+

{context.story}

); } _getInfoContent() { - if (!this.props.info) { + const { info, showInline } = this.props; + const { stylesheet } = this.state; + + if (!info) { return ''; } - if (React.isValidElement(this.props.info)) { + if (React.isValidElement(info)) { return ( -
- {this.props.info} -
+
{info}
); } - const lines = this.props.info.split('\n'); + const lines = info.split('\n'); while (lines[0].trim() === '') { lines.shift(); } @@ -233,15 +241,16 @@ class Story extends React.Component { padding = matches[0].length; } const source = lines.map(s => s.slice(padding)).join('\n'); - return
{this.marksy(source).tree}
; + return
{this.marksy(source).tree}
; } _getComponentDescription() { + const { context } = this.props; let retDiv = null; if (Object.keys(STORYBOOK_REACT_CLASSES).length) { Object.keys(STORYBOOK_REACT_CLASSES).forEach(key => { - if (STORYBOOK_REACT_CLASSES[key].name === this.props.context.story) { + if (STORYBOOK_REACT_CLASSES[key].name === context.story) { retDiv =
{STORYBOOK_REACT_CLASSES[key].docgenInfo.description}
; } }); @@ -251,22 +260,25 @@ class Story extends React.Component { } _getSourceCode() { - if (!this.props.showSource) { - return null; - } - const { + showSource, maxPropsIntoLine, maxPropObjectKeys, maxPropArrayLength, maxPropStringLength, + children, } = this.props; + const { stylesheet } = this.state; + + if (!showSource) { + return null; + } return (
-

Story Source

+

Story Source

-          {React.Children.map(this.props.children, (root, idx) => (
+          {React.Children.map(children, (root, idx) => (
              {
+    if (propTables) {
+      propTables.forEach(type => {
         types.set(type, true);
       });
     }
 
     // depth-first traverse and collect types
-    const extract = children => {
-      if (!children) {
+    const extract = innerChildren => {
+      if (!innerChildren) {
         return;
       }
-      if (Array.isArray(children)) {
-        children.forEach(extract);
+      if (Array.isArray(innerChildren)) {
+        innerChildren.forEach(extract);
         return;
       }
-      if (children.props && children.props.children) {
-        extract(children.props.children);
+      if (innerChildren.props && innerChildren.props.innerChildren) {
+        extract(innerChildren.props.innerChildren);
       }
       if (
-        typeof children === 'string' ||
-        typeof children.type === 'string' ||
-        (Array.isArray(this.props.propTablesExclude) && // also ignore excluded types
-          ~this.props.propTablesExclude.indexOf(children.type)) // eslint-disable-line no-bitwise
+        typeof innerChildren === 'string' ||
+        typeof innerChildren.type === 'string' ||
+        (Array.isArray(propTablesExclude) && // also ignore excluded types
+          ~propTablesExclude.indexOf(innerChildren.type)) // eslint-disable-line no-bitwise
       ) {
         return;
       }
-      if (children.type && !types.has(children.type)) {
-        types.set(children.type, true);
+      if (innerChildren.type && !types.has(innerChildren.type)) {
+        types.set(innerChildren.type, true);
       }
     };
 
     // extract components from children
-    extract(this.props.children);
+    extract(children);
 
     const array = Array.from(types.keys());
     array.sort((a, b) => getName(a) > getName(b));
 
-    const {
-      maxPropObjectKeys,
-      maxPropArrayLength,
-      maxPropStringLength,
-      excludedPropTypes,
-    } = this.props;
-    const propTables = array.map((type, i) => (
+    propTables = array.map((type, i) => (
       // eslint-disable-next-line react/no-array-index-key
       
-

"{getName(type)}" Component

+

"{getName(type)}" Component

-

Prop Types

+

Prop Types

{propTables}
); } render() { - // - return this.props.showInline ? this._renderInline() : this._renderOverlay(); + const { showInline } = this.props; + // + return showInline ? this._renderInline() : this._renderOverlay(); } } -Story.getDerivedStateFromProps = ({ styles }) => ({ stylesheet: styles(stylesheet) }); +Story.getDerivedStateFromProps = ({ styles }) => ({ stylesheet: styles(stylesheetBase) }); Story.displayName = 'Story'; diff --git a/addons/info/src/components/makeTableComponent.js b/addons/info/src/components/makeTableComponent.js index 173083a846df..2f2cdd979ccb 100644 --- a/addons/info/src/components/makeTableComponent.js +++ b/addons/info/src/components/makeTableComponent.js @@ -67,10 +67,12 @@ const propsFromPropTypes = type => { return; } + // eslint-disable-next-line react/destructuring-assignment if (!props[property]) { props[property] = { property }; } + // eslint-disable-next-line react/destructuring-assignment props[property].defaultValue = value; }); } @@ -84,10 +86,12 @@ export default function makeTableComponent(Component) { return null; } + /* eslint-disable react/destructuring-assignment */ const propDefinitionsMap = hasDocgen(props.type) ? propsFromDocgen(props.type) : propsFromPropTypes(props.type); const propDefinitions = Object.values(propDefinitionsMap); + /* eslint-enable react/destructuring-assignment */ return ; }; diff --git a/addons/info/src/components/markdown/code.js b/addons/info/src/components/markdown/code.js index db17696ca944..3663bbd0f1d1 100644 --- a/addons/info/src/components/markdown/code.js +++ b/addons/info/src/components/markdown/code.js @@ -18,6 +18,7 @@ export class Code extends React.Component { } render() { + const { language, code } = this.props; const codeStyle = { fontFamily: 'Menlo, Monaco, "Courier New", monospace', backgroundColor: '#fafafa', @@ -31,12 +32,12 @@ export class Code extends React.Component { overflowX: 'scroll', }; - const className = this.props.language ? `language-${this.props.language}` : ''; + const className = language ? `language-${language}` : ''; return (
         
-          {this.props.code}
+          {code}
         
       
); @@ -52,14 +53,14 @@ Code.defaultProps = { code: null, }; -export function Blockquote(props) { +export function Blockquote({ children }) { const style = { fontSize: '1.88em', fontFamily: 'Menlo, Monaco, "Courier New", monospace', borderLeft: '8px solid #fafafa', padding: '1rem', }; - return
{props.children}
; + return
{children}
; } Blockquote.propTypes = { children: PropTypes.node }; diff --git a/addons/info/src/components/markdown/htags.js b/addons/info/src/components/markdown/htags.js index b0f0df8d652a..50b542e601c4 100644 --- a/addons/info/src/components/markdown/htags.js +++ b/addons/info/src/components/markdown/htags.js @@ -11,7 +11,7 @@ const propTypes = { id: PropTypes.string, }; -export function H1(props) { +export function H1({ id, children }) { const styles = { ...baseFonts, borderBottom: '1px solid #eee', @@ -21,8 +21,8 @@ export function H1(props) { fontSize: '40px', }; return ( -

- {props.children} +

+ {children}

); } @@ -30,7 +30,7 @@ export function H1(props) { H1.defaultProps = defaultProps; H1.propTypes = propTypes; -export function H2(props) { +export function H2({ id, children }) { const styles = { ...baseFonts, fontWeight: 600, @@ -39,8 +39,8 @@ export function H2(props) { fontSize: '30px', }; return ( -

- {props.children} +

+ {children}

); } @@ -48,7 +48,7 @@ export function H2(props) { H2.defaultProps = defaultProps; H2.propTypes = propTypes; -export function H3(props) { +export function H3({ id, children }) { const styles = { ...baseFonts, fontWeight: 600, @@ -58,8 +58,8 @@ export function H3(props) { textTransform: 'uppercase', }; return ( -

- {props.children} +

+ {children}

); } @@ -67,7 +67,7 @@ export function H3(props) { H3.defaultProps = defaultProps; H3.propTypes = propTypes; -export function H4(props) { +export function H4({ id, children }) { const styles = { ...baseFonts, fontWeight: 600, @@ -76,8 +76,8 @@ export function H4(props) { fontSize: '20px', }; return ( -

- {props.children} +

+ {children}

); } @@ -85,7 +85,7 @@ export function H4(props) { H4.defaultProps = defaultProps; H4.propTypes = propTypes; -export function H5(props) { +export function H5({ id, children }) { const styles = { ...baseFonts, fontWeight: 600, @@ -94,8 +94,8 @@ export function H5(props) { fontSize: '18px', }; return ( -
- {props.children} +
+ {children}
); } @@ -103,7 +103,7 @@ export function H5(props) { H5.defaultProps = defaultProps; H5.propTypes = propTypes; -export function H6(props) { +export function H6({ id, children }) { const styles = { ...baseFonts, fontWeight: 400, @@ -112,8 +112,8 @@ export function H6(props) { fontSize: '18px', }; return ( -
- {props.children} +
+ {children}
); } diff --git a/addons/info/src/components/markdown/pre/copyButton.js b/addons/info/src/components/markdown/pre/copyButton.js index ff11d7a60d0f..e29632663d73 100644 --- a/addons/info/src/components/markdown/pre/copyButton.js +++ b/addons/info/src/components/markdown/pre/copyButton.js @@ -24,7 +24,7 @@ const Button = styled('button')( borderColor: '#ccc', }, }, - props => props.styles + ({ styles }) => styles ); const ContentWrapper = styled('div')( @@ -32,19 +32,19 @@ const ContentWrapper = styled('div')( transition: 'transform .2s ease', height: 16, }, - props => ({ - ...props.styles, - transform: props.toggled ? 'translateY(0px)' : 'translateY(-100%) translateY(-6px)', + ({ styles, toggled }) => ({ + ...styles, + transform: toggled ? 'translateY(0px)' : 'translateY(-100%) translateY(-6px)', }) ); -function CopyButton(props) { - const { copyButton = {}, copyButtonContent } = props.theme; +function CopyButton({ theme, onClick, toggled }) { + const { copyButton = {}, copyButtonContent } = theme; const { toggleText = 'Copied!', text = 'Copy', ...copyButtonStyles } = copyButton; return ( -
))({ display: 'block', diff --git a/addons/jest/src/hoc/provideJestResult.js b/addons/jest/src/hoc/provideJestResult.js index a72169a21ee2..f1f327856fc5 100644 --- a/addons/jest/src/hoc/provideJestResult.js +++ b/addons/jest/src/hoc/provideJestResult.js @@ -13,6 +13,7 @@ const provideTests = Component => }).isRequired, active: PropTypes.bool, }; + static defaultProps = { active: true, }; @@ -30,10 +31,12 @@ const provideTests = Component => } componentWillUnmount() { + const { channel } = this.props; + if (this.stopListeningOnStory) { this.stopListeningOnStory(); } - this.props.channel.removeListener('storybook/tests/add_tests', this.onAddTests); + channel.removeListener('storybook/tests/add_tests', this.onAddTests); } onAddTests = ({ kind, storyName, tests }) => { diff --git a/addons/knobs/src/components/Panel.js b/addons/knobs/src/components/Panel.js index c74464553233..d5e28fbe9f88 100644 --- a/addons/knobs/src/components/Panel.js +++ b/addons/knobs/src/components/Panel.js @@ -27,18 +27,22 @@ export default class Panel extends PureComponent { this.lastEdit = getTimestamp(); this.loadedFromUrl = false; } + componentDidMount() { - this.props.channel.on('addon:knobs:setKnobs', this.setKnobs); - this.props.channel.on('addon:knobs:setOptions', this.setOptions); + const { channel, api } = this.props; + channel.on('addon:knobs:setKnobs', this.setKnobs); + channel.on('addon:knobs:setOptions', this.setOptions); - this.stopListeningOnStory = this.props.api.onStory(() => { + this.stopListeningOnStory = api.onStory(() => { this.setState({ knobs: {} }); - this.props.channel.emit('addon:knobs:reset'); + channel.emit('addon:knobs:reset'); }); } componentWillUnmount() { - this.props.channel.removeListener('addon:knobs:setKnobs', this.setKnobs); + const { channel } = this.props; + + channel.removeListener('addon:knobs:setKnobs', this.setKnobs); this.stopListeningOnStory(); } @@ -75,7 +79,9 @@ export default class Panel extends PureComponent { }; reset = () => { - this.props.channel.emit('addon:knobs:reset'); + const { channel } = this.props; + + channel.emit('addon:knobs:reset'); }; copy = () => { @@ -93,7 +99,9 @@ export default class Panel extends PureComponent { }; emitChange = changedKnob => { - this.props.channel.emit('addon:knobs:knobChange', changedKnob); + const { channel } = this.props; + + channel.emit('addon:knobs:knobChange', changedKnob); }; handleChange = changedKnob => { @@ -110,7 +118,9 @@ export default class Panel extends PureComponent { }; handleClick = knob => { - this.props.channel.emit('addon:knobs:knobClick', knob); + const { channel } = this.props; + + channel.emit('addon:knobs:knobClick', knob); }; render() { diff --git a/addons/knobs/src/components/PropForm.js b/addons/knobs/src/components/PropForm.js index 0b07504a8296..109fa3229b6b 100644 --- a/addons/knobs/src/components/PropForm.js +++ b/addons/knobs/src/components/PropForm.js @@ -15,14 +15,16 @@ const InvalidType = () => Invalid Type; export default class PropForm extends Component { makeChangeHandler(name, type) { + const { onFieldChange } = this.props; return value => { const change = { name, type, value }; - this.props.onFieldChange(change); + + onFieldChange(change); }; } render() { - const { knobs } = this.props; + const { knobs, onFieldClick } = this.props; return (
@@ -32,7 +34,7 @@ export default class PropForm extends Component { return ( - + ); })} diff --git a/addons/knobs/src/components/types/Array.js b/addons/knobs/src/components/types/Array.js index 28e2851dd37e..85cc608bccd2 100644 --- a/addons/knobs/src/components/types/Array.js +++ b/addons/knobs/src/components/types/Array.js @@ -12,14 +12,17 @@ function formatArray(value, separator) { class ArrayType extends React.Component { shouldComponentUpdate(nextProps) { - return nextProps.knob.value !== this.props.knob.value; + const { knob } = this.props; + + return nextProps.knob.value !== knob.value; } handleChange = e => { - const { knob } = this.props; + const { knob, onChange } = this.props; const { value } = e.target; const newVal = formatArray(value, knob.separator); - this.props.onChange(newVal); + + onChange(newVal); }; render() { diff --git a/addons/knobs/src/components/types/Color.js b/addons/knobs/src/components/types/Color.js index 0d3521f86118..f0e1c4ce8841 100644 --- a/addons/knobs/src/components/types/Color.js +++ b/addons/knobs/src/components/types/Color.js @@ -27,16 +27,22 @@ class ColorType extends React.Component { componentDidMount() { document.addEventListener('mousedown', this.handleWindowMouseDown); } + shouldComponentUpdate(nextProps) { - return nextProps.knob.value !== this.props.knob.value; + const { knob } = this.props; + + return nextProps.knob.value !== knob.value; } + componentWillUnmount() { document.removeEventListener('mousedown', this.handleWindowMouseDown); } handleWindowMouseDown = e => { - if (!this.state.displayColorPicker) return; - if (this.popover.contains(e.target)) return; + const { displayColorPicker } = this.state; + if (!displayColorPicker || this.popover.contains(e.target)) { + return; + } this.setState({ displayColorPicker: false, @@ -44,13 +50,17 @@ class ColorType extends React.Component { }; handleClick = () => { + const { displayColorPicker } = this.state; + this.setState({ - displayColorPicker: !this.state.displayColorPicker, + displayColorPicker: !displayColorPicker, }); }; handleChange = color => { - this.props.onChange(`rgba(${color.rgb.r},${color.rgb.g},${color.rgb.b},${color.rgb.a})`); + const { onChange } = this.props; + + onChange(`rgba(${color.rgb.r},${color.rgb.g},${color.rgb.b},${color.rgb.a})`); }; render() { diff --git a/addons/knobs/src/components/types/Date/index.js b/addons/knobs/src/components/types/Date/index.js index edb8ffbb6565..52ba31efea0b 100644 --- a/addons/knobs/src/components/types/Date/index.js +++ b/addons/knobs/src/components/types/Date/index.js @@ -10,12 +10,16 @@ const DateInput = styled(Datetime)(style); class DateType extends React.Component { shouldComponentUpdate(nextProps) { - return nextProps.knob.value !== this.props.knob.value; + const { knob } = this.props; + + return nextProps.knob.value !== knob.value; } handleChange = date => { + const { onChange } = this.props; const value = date.valueOf(); - this.props.onChange(value); + + onChange(value); }; render() { diff --git a/addons/knobs/src/components/types/Number.js b/addons/knobs/src/components/types/Number.js index 8936baeaec05..763b0b89da1b 100644 --- a/addons/knobs/src/components/types/Number.js +++ b/addons/knobs/src/components/types/Number.js @@ -34,10 +34,13 @@ const RangeWrapper = styled('div')({ class NumberType extends React.Component { shouldComponentUpdate(nextProps) { - return nextProps.knob.value !== this.props.knob.value; + const { knob } = this.props; + + return nextProps.knob.value !== knob.value; } handleChange = event => { + const { onChange } = this.props; const { value } = event.target; let parsedValue = Number(value); @@ -46,7 +49,7 @@ class NumberType extends React.Component { parsedValue = null; } - this.props.onChange(parsedValue); + onChange(parsedValue); }; render() { diff --git a/addons/knobs/src/components/types/Object.js b/addons/knobs/src/components/types/Object.js index 08ef0f1c0cc2..7936cc5325ed 100644 --- a/addons/knobs/src/components/types/Object.js +++ b/addons/knobs/src/components/types/Object.js @@ -22,6 +22,8 @@ class ObjectType extends Component { handleChange = e => { const { value } = e.target; + const { json: stateJson } = this.state; + const { knob, onChange } = this.props; try { const json = JSON.parse(value.trim()); @@ -30,8 +32,8 @@ class ObjectType extends Component { json, failed: false, }); - if (deepEqual(this.props.knob.value, this.state.json)) { - this.props.onChange(json); + if (deepEqual(knob.value, stateJson)) { + onChange(json); } } catch (err) { this.setState({ diff --git a/addons/knobs/src/components/types/Radio.js b/addons/knobs/src/components/types/Radio.js index 948651f95d55..6b9c382654d9 100644 --- a/addons/knobs/src/components/types/Radio.js +++ b/addons/knobs/src/components/types/Radio.js @@ -23,8 +23,8 @@ class RadiosType extends Component { renderRadioButton(label, value) { const opts = { label, value }; - const { onChange } = this.props; - const { name } = this.props.knob; + const { onChange, knob } = this.props; + const { name } = knob; const id = `${name}-${opts.value}`; return ( @@ -35,7 +35,7 @@ class RadiosType extends Component { name={name} value={opts.value} onChange={e => onChange(e.target.value)} - checked={value === this.props.knob.value} + checked={value === knob.value} />
diff --git a/examples/cra-kitchen-sink/src/stories/force-rerender.stories.js b/examples/cra-kitchen-sink/src/stories/force-rerender.stories.js index 92b83adfdcc3..07e1a2d19568 100644 --- a/examples/cra-kitchen-sink/src/stories/force-rerender.stories.js +++ b/examples/cra-kitchen-sink/src/stories/force-rerender.stories.js @@ -8,5 +8,7 @@ const increment = () => { }; storiesOf('Force ReRender', module).add('button', () => ( - + )); diff --git a/examples/cra-kitchen-sink/src/stories/index.stories.js b/examples/cra-kitchen-sink/src/stories/index.stories.js index 719c97b5810e..bb57baa5f5dd 100644 --- a/examples/cra-kitchen-sink/src/stories/index.stories.js +++ b/examples/cra-kitchen-sink/src/stories/index.stories.js @@ -1,3 +1,5 @@ +/* eslint-disable react/destructuring-assignment */ + import React from 'react'; import { storiesOf } from '@storybook/react'; diff --git a/examples/crna-kitchen-sink/storybook/stories/Button/index.android.js b/examples/crna-kitchen-sink/storybook/stories/Button/index.android.js index 767da77a264c..3c4c405180da 100644 --- a/examples/crna-kitchen-sink/storybook/stories/Button/index.android.js +++ b/examples/crna-kitchen-sink/storybook/stories/Button/index.android.js @@ -2,10 +2,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import { TouchableNativeFeedback } from 'react-native'; -export default function Button(props) { - return ( - {props.children} - ); +export default function Button({ onPress, children }) { + return {children}; } Button.defaultProps = { diff --git a/examples/crna-kitchen-sink/storybook/stories/Button/index.ios.js b/examples/crna-kitchen-sink/storybook/stories/Button/index.ios.js index ad76aec50e30..37c8437e72e4 100644 --- a/examples/crna-kitchen-sink/storybook/stories/Button/index.ios.js +++ b/examples/crna-kitchen-sink/storybook/stories/Button/index.ios.js @@ -2,8 +2,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import { TouchableHighlight } from 'react-native'; -export default function Button(props) { - return {props.children}; +export default function Button({ onPress, children }) { + return {children}; } Button.defaultProps = { diff --git a/examples/crna-kitchen-sink/storybook/stories/CenterView/index.js b/examples/crna-kitchen-sink/storybook/stories/CenterView/index.js index 8fa23359ed88..29732b27ab24 100644 --- a/examples/crna-kitchen-sink/storybook/stories/CenterView/index.js +++ b/examples/crna-kitchen-sink/storybook/stories/CenterView/index.js @@ -3,8 +3,8 @@ import PropTypes from 'prop-types'; import { View } from 'react-native'; import style from './style'; -export default function CenterView(props) { - return {props.children}; +export default function CenterView({ children }) { + return {children}; } CenterView.defaultProps = { diff --git a/examples/crna-kitchen-sink/storybook/stories/Knobs/index.js b/examples/crna-kitchen-sink/storybook/stories/Knobs/index.js index a06fbcfe38f5..6c65a02cc46d 100644 --- a/examples/crna-kitchen-sink/storybook/stories/Knobs/index.js +++ b/examples/crna-kitchen-sink/storybook/stories/Knobs/index.js @@ -55,7 +55,11 @@ export default () => { My birthday is: {new Date(birthday).toLocaleDateString('en-US', dateOptions)} My wallet contains: ${dollars.toFixed(2)} In my backpack, I have: - {items.map(item => {item})} + + {items.map(item => ( + {item} + ))} + {salutation} ); diff --git a/examples/crna-kitchen-sink/storybook/stories/Welcome/index.js b/examples/crna-kitchen-sink/storybook/stories/Welcome/index.js index 2f33bc492b49..8e0fe99bcc7f 100644 --- a/examples/crna-kitchen-sink/storybook/stories/Welcome/index.js +++ b/examples/crna-kitchen-sink/storybook/stories/Welcome/index.js @@ -20,10 +20,14 @@ export default class Welcome extends React.Component { }, }; - showApp(event) { + showApp = event => { + const { showApp } = this.props; + event.preventDefault(); - if (this.props.showApp) this.props.showApp(); - } + if (showApp) { + showApp(); + } + }; render() { return ( diff --git a/examples/html-kitchen-sink/stories/index.stories.js b/examples/html-kitchen-sink/stories/index.stories.js index 1dcedbdb3522..e0cae017c023 100644 --- a/examples/html-kitchen-sink/stories/index.stories.js +++ b/examples/html-kitchen-sink/stories/index.stories.js @@ -1,3 +1,5 @@ +/* eslint-disable react/button-has-type */ + import { document } from 'global'; import { storiesOf } from '@storybook/html'; import { action } from '@storybook/addon-actions'; diff --git a/examples/mithril-kitchen-sink/src/Button.js b/examples/mithril-kitchen-sink/src/Button.js index 8fcb462dd537..edec915a04b1 100644 --- a/examples/mithril-kitchen-sink/src/Button.js +++ b/examples/mithril-kitchen-sink/src/Button.js @@ -14,7 +14,7 @@ const style = { const Button = { view: vnode => ( - ), diff --git a/examples/mithril-kitchen-sink/src/Welcome.js b/examples/mithril-kitchen-sink/src/Welcome.js index c24a34d9c152..e85d5493797f 100644 --- a/examples/mithril-kitchen-sink/src/Welcome.js +++ b/examples/mithril-kitchen-sink/src/Welcome.js @@ -70,6 +70,7 @@ const Link = { const NavButton = { view: vnode => (
), diff --git a/examples/official-storybook/components/BaseButton.js b/examples/official-storybook/components/BaseButton.js index e53dda8d7836..17b2ce719fda 100644 --- a/examples/official-storybook/components/BaseButton.js +++ b/examples/official-storybook/components/BaseButton.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; /** BaseButton component description imported from comments inside the component file */ const BaseButton = ({ disabled, label, onClick, style }) => ( - ); diff --git a/examples/official-storybook/components/DelayedRender.js b/examples/official-storybook/components/DelayedRender.js index 1a5710beeb76..85ec79e1a6af 100644 --- a/examples/official-storybook/components/DelayedRender.js +++ b/examples/official-storybook/components/DelayedRender.js @@ -5,6 +5,7 @@ export default class DelayedRender extends Component { static propTypes = { children: PropTypes.node.isRequired, }; + state = { show: false, }; @@ -22,6 +23,8 @@ export default class DelayedRender extends Component { } render() { - return this.state.show ? this.props.children :
; + const { show } = this.state; + const { children } = this.props; + return show ? children :
; } } diff --git a/examples/official-storybook/components/DocgenButton.js b/examples/official-storybook/components/DocgenButton.js index a7e948a82a03..c6e0cb6357b5 100644 --- a/examples/official-storybook/components/DocgenButton.js +++ b/examples/official-storybook/components/DocgenButton.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; /** DocgenButton component description imported from comments inside the component file */ const DocgenButton = ({ disabled, label, onClick }) => ( - ); diff --git a/examples/official-storybook/components/FlowTypeButton.js b/examples/official-storybook/components/FlowTypeButton.js index be85c3a40d4a..05b5c0a3eaf7 100644 --- a/examples/official-storybook/components/FlowTypeButton.js +++ b/examples/official-storybook/components/FlowTypeButton.js @@ -39,7 +39,7 @@ type PropsType = { /** FlowTypeButton component description imported from comments inside the component file */ const FlowTypeButton = ({ label, onClick, disabled }: PropsType) => ( - ); diff --git a/examples/official-storybook/components/ImportedPropsButton.js b/examples/official-storybook/components/ImportedPropsButton.js index e38013d735f3..e12a73b6c959 100644 --- a/examples/official-storybook/components/ImportedPropsButton.js +++ b/examples/official-storybook/components/ImportedPropsButton.js @@ -1,9 +1,11 @@ +/* eslint-disable react/prop-types */ + import React from 'react'; import DocgenButton from './DocgenButton'; /** Button component description */ const ImportedPropsButton = ({ disabled, label, onClick }) => ( - ); diff --git a/examples/official-storybook/components/addon-a11y/Button.js b/examples/official-storybook/components/addon-a11y/Button.js index d9c58bd13acd..293f6ca97303 100644 --- a/examples/official-storybook/components/addon-a11y/Button.js +++ b/examples/official-storybook/components/addon-a11y/Button.js @@ -21,6 +21,7 @@ const styles = { function Button({ content, disabled, contrast }) { return ( @@ -13,13 +18,16 @@ exports[`Storyshots Addons|a11y Disabled 1`] = ` exports[`Storyshots Addons|a11y Invalid contrast 1`] = ` `; exports[`Storyshots Addons|a11y Label 1`] = ` - `; @@ -29,6 +37,7 @@ exports[`Storyshots Addons|a11y delayed render 1`] = `
`; exports[`Storyshots Addons|a11y/Button Content 1`] = ` @@ -37,6 +46,7 @@ exports[`Storyshots Addons|a11y/Button Content 1`] = ` exports[`Storyshots Addons|a11y/Button Default 1`] = ` @@ -46,6 +56,7 @@ exports[`Storyshots Addons|a11y/Button Disabled 1`] = ` @@ -54,6 +65,7 @@ exports[`Storyshots Addons|a11y/Button Disabled 1`] = ` exports[`Storyshots Addons|a11y/Button Invalid contrast 1`] = ` @@ -62,6 +74,7 @@ exports[`Storyshots Addons|a11y/Button Invalid contrast 1`] = ` exports[`Storyshots Addons|a11y/Button Label 1`] = ` diff --git a/examples/official-storybook/stories/__snapshots__/addon-backgrounds.stories.storyshot b/examples/official-storybook/stories/__snapshots__/addon-backgrounds.stories.storyshot index ddcf188c21b9..396dbec9f278 100644 --- a/examples/official-storybook/stories/__snapshots__/addon-backgrounds.stories.storyshot +++ b/examples/official-storybook/stories/__snapshots__/addon-backgrounds.stories.storyshot @@ -1,49 +1,65 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Storyshots Addons|Backgrounds disabled via [] 1`] = ` - `; exports[`Storyshots Addons|Backgrounds overriden 1`] = ` - `; exports[`Storyshots Addons|Backgrounds skipped via disable:true 1`] = ` - `; exports[`Storyshots Addons|Backgrounds story 1 1`] = ` - `; exports[`Storyshots Addons|Backgrounds story 2 1`] = ` - `; exports[`Storyshots Addons|Backgrounds.deprecated overriden 1`] = ` - `; exports[`Storyshots Addons|Backgrounds.deprecated story 1 1`] = ` - `; exports[`Storyshots Addons|Backgrounds.deprecated story 2 1`] = ` - `; diff --git a/examples/official-storybook/stories/__snapshots__/addon-centered.stories.storyshot b/examples/official-storybook/stories/__snapshots__/addon-centered.stories.storyshot index 59f20667de70..e3f36b7bdf72 100644 --- a/examples/official-storybook/stories/__snapshots__/addon-centered.stories.storyshot +++ b/examples/official-storybook/stories/__snapshots__/addon-centered.stories.storyshot @@ -7,7 +7,9 @@ exports[`Storyshots Addons|Centered story 1 1`] = `
-
diff --git a/examples/official-storybook/stories/__snapshots__/addon-info.stories.storyshot b/examples/official-storybook/stories/__snapshots__/addon-info.stories.storyshot index 4f7e22b7e243..79198981beb1 100644 --- a/examples/official-storybook/stories/__snapshots__/addon-info.stories.storyshot +++ b/examples/official-storybook/stories/__snapshots__/addon-info.stories.storyshot @@ -5,7 +5,9 @@ exports[`Storyshots Addons|Info.Decorator Use Info as story decorator 1`] = `
-
@@ -421,33 +423,6 @@ exports[`Storyshots Addons|Info.GitHub issues #1814 1`] = `
-
-

- Prop Types -

-
-

- "" Component -

- - No propTypes defined! - -
-
-

- "" Component -

- - No propTypes defined! - -
-
@@ -459,7 +434,9 @@ exports[`Storyshots Addons|Info.JSX Displays JSX in description 1`] = `
-
@@ -775,7 +752,9 @@ exports[`Storyshots Addons|Info.Markdown Displays Markdown in description 1`] =
-
@@ -1106,7 +1085,9 @@ exports[`Storyshots Addons|Info.Markdown From external Markdown file 1`] = `
-
@@ -1406,7 +1387,9 @@ exports[`Storyshots Addons|Info.Markdown From internal Markdown file 1`] = `
-
@@ -1718,7 +1701,9 @@ exports[`Storyshots Addons|Info.Options.TableComponent Use a custom component fo
-
@@ -1905,7 +1890,9 @@ exports[`Storyshots Addons|Info.Options.excludedPropTypes Excludes propTypes tha
-
@@ -2162,7 +2149,9 @@ exports[`Storyshots Addons|Info.Options.header Shows or hides Info Addon header
-
@@ -2448,7 +2437,9 @@ exports[`Storyshots Addons|Info.Options.inline Inlines component inside story 1`
-
@@ -2718,7 +2709,9 @@ exports[`Storyshots Addons|Info.Options.maxPropsIntoLine === 0 Object and array
-
@@ -3688,7 +3681,9 @@ exports[`Storyshots Addons|Info.Options.maxPropsIntoLine === 3 Object and array
-
@@ -4456,7 +4451,9 @@ exports[`Storyshots Addons|Info.Options.propTables Shows additional component pr
-
@@ -4843,10 +4840,14 @@ exports[`Storyshots Addons|Info.Options.propTablesExclude Exclude component from style="position:relative;z-index:0" >
- -
@@ -5018,167 +5019,6 @@ exports[`Storyshots Addons|Info.Options.propTablesExclude Exclude component from
-
-

- Prop Types -

-
-

- "BaseButton" Component -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- property - - propType - - required - - default - - description -
- disabled - - - - - - - - false - - -
- label - - - - yes - - - - -
- onClick - - - - - - - - onClick - - -
- style - - - - - - - - {} - - -
-
-
@@ -5190,7 +5030,9 @@ exports[`Storyshots Addons|Info.Options.source Shows or hides Info Addon source
-
@@ -5408,7 +5250,9 @@ exports[`Storyshots Addons|Info.Options.styles Extend info styles with an object
-
@@ -5681,7 +5525,9 @@ exports[`Storyshots Addons|Info.Options.styles Full control over styles using a
-
@@ -5950,7 +5796,9 @@ exports[`Storyshots Addons|Info.Options.styles Full control over styles using a `; exports[`Storyshots Addons|Info.Parameters Disable the addon entirely 1`] = ` - `; @@ -5960,7 +5808,9 @@ exports[`Storyshots Addons|Info.Parameters Overwrite the parameters with markdow
-
@@ -6309,7 +6159,9 @@ exports[`Storyshots Addons|Info.Parameters Overwrite the text parameter with mar
-
@@ -6608,7 +6460,9 @@ exports[`Storyshots Addons|Info.Parameters Overwriting and extending the paramet
-
@@ -6853,7 +6707,9 @@ exports[`Storyshots Addons|Info.Parameters Using paramaters across all stories 1
-
@@ -7105,7 +6961,9 @@ exports[`Storyshots Addons|Info.React Docgen Comments from Flow declarations 1`]
-
@@ -7355,7 +7213,9 @@ exports[`Storyshots Addons|Info.React Docgen Comments from PropType declarations
-
@@ -8291,7 +8151,9 @@ exports[`Storyshots Addons|Info.React Docgen Comments from component declaration
-
@@ -8592,7 +8454,9 @@ exports[`Storyshots Addons|Info.React Docgen Comments from named export componen style="position:relative;z-index:0" >
-
@@ -8893,7 +8757,9 @@ exports[`Storyshots Addons|Info.deprecated Displays Markdown in description 1`]
-
diff --git a/examples/official-storybook/stories/__snapshots__/addon-links.stories.storyshot b/examples/official-storybook/stories/__snapshots__/addon-links.stories.storyshot index 7fe4396b8c84..61e43342a10c 100644 --- a/examples/official-storybook/stories/__snapshots__/addon-links.stories.storyshot +++ b/examples/official-storybook/stories/__snapshots__/addon-links.stories.storyshot @@ -1,13 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Storyshots Addons|Links.Button First 1`] = ` - `; exports[`Storyshots Addons|Links.Button Second 1`] = ` - `; diff --git a/examples/official-storybook/stories/__snapshots__/addon-notes.stories.storyshot b/examples/official-storybook/stories/__snapshots__/addon-notes.stories.storyshot index 94e74767d4a0..53d15c851250 100644 --- a/examples/official-storybook/stories/__snapshots__/addon-notes.stories.storyshot +++ b/examples/official-storybook/stories/__snapshots__/addon-notes.stories.storyshot @@ -1,37 +1,49 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Storyshots Addons|Notes with a markdown table 1`] = ` - `; exports[`Storyshots Addons|Notes withNotes 1`] = ` - `; exports[`Storyshots Addons|Notes withNotes rendering imported markdown 1`] = ` - `; exports[`Storyshots Addons|Notes withNotes rendering inline, github-flavored markdown 1`] = ` - `; exports[`Storyshots Addons|Notes.deprecated using decorator arguments, withMarkdownNotes 1`] = ` - `; exports[`Storyshots Addons|Notes.deprecated using decorator arguments, withNotes 1`] = ` - `; diff --git a/examples/official-storybook/stories/__snapshots__/other-dirname.stories.storyshot b/examples/official-storybook/stories/__snapshots__/other-dirname.stories.storyshot index 65caac82c818..c0d5aef14144 100644 --- a/examples/official-storybook/stories/__snapshots__/other-dirname.stories.storyshot +++ b/examples/official-storybook/stories/__snapshots__/other-dirname.stories.storyshot @@ -9,7 +9,9 @@ exports[`Storyshots Other|function macroWrapper(args) { } return macro(args); }/Dirname Example story 1 1`] = ` - `; @@ -23,7 +25,9 @@ exports[`Storyshots Other|function macroWrapper(args) { } return macro(args); }/Dirname Example story 2 1`] = ` - `; diff --git a/examples/official-storybook/stories/addon-knobs.stories.js b/examples/official-storybook/stories/addon-knobs.stories.js index a2452413805f..da8ec1f7ac67 100644 --- a/examples/official-storybook/stories/addon-knobs.stories.js +++ b/examples/official-storybook/stories/addon-knobs.stories.js @@ -21,10 +21,17 @@ import { const ItemLoader = ({ isLoading, items }) => { if (isLoading) { return

Loading data

; - } else if (!items.length) { + } + if (!items.length) { return

No items loaded

; } - return
    {items.map(i =>
  • {i}
  • )}
; + return ( +
    + {items.map(i => ( +
  • {i}
  • + ))} +
+ ); }; ItemLoader.propTypes = { @@ -83,7 +90,11 @@ storiesOf('Addons|Knobs.withKnobs', module)

I live in NY for {years} years.

My wallet contains: ${dollars.toFixed(2)}

In my backpack, I have:

-
    {items.map(item =>
  • {item}
  • )}
+
    + {items.map(item => ( +
  • {item}
  • + ))} +

{salutation}

When I am happy I look like this: happy @@ -162,7 +173,11 @@ storiesOf('Addons|Knobs.withKnobs', module)

Fruit: {fruit}

Other Fruit: {otherFruit}

Items:

-
    {items.map(item =>
  • {item}
  • )}
+
    + {items.map(item => ( +
  • {item}
  • + ))} +
); }) diff --git a/examples/official-storybook/stories/addon-links.stories.js b/examples/official-storybook/stories/addon-links.stories.js index 15ffd413d791..e3b07aece2bb 100644 --- a/examples/official-storybook/stories/addon-links.stories.js +++ b/examples/official-storybook/stories/addon-links.stories.js @@ -10,10 +10,14 @@ storiesOf('Addons|Links.Link', module) storiesOf('Addons|Links.Button', module) .add('First', () => ( - + )) .add('Second', () => ( - + )); storiesOf('Addons|Links.Select', module) diff --git a/examples/react-native-vanilla/storybook/stories/Button/index.android.js b/examples/react-native-vanilla/storybook/stories/Button/index.android.js index 767da77a264c..3c4c405180da 100644 --- a/examples/react-native-vanilla/storybook/stories/Button/index.android.js +++ b/examples/react-native-vanilla/storybook/stories/Button/index.android.js @@ -2,10 +2,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import { TouchableNativeFeedback } from 'react-native'; -export default function Button(props) { - return ( - {props.children} - ); +export default function Button({ onPress, children }) { + return {children}; } Button.defaultProps = { diff --git a/examples/react-native-vanilla/storybook/stories/Button/index.ios.js b/examples/react-native-vanilla/storybook/stories/Button/index.ios.js index ad76aec50e30..37c8437e72e4 100644 --- a/examples/react-native-vanilla/storybook/stories/Button/index.ios.js +++ b/examples/react-native-vanilla/storybook/stories/Button/index.ios.js @@ -2,8 +2,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import { TouchableHighlight } from 'react-native'; -export default function Button(props) { - return {props.children}; +export default function Button({ onPress, children }) { + return {children}; } Button.defaultProps = { diff --git a/examples/react-native-vanilla/storybook/stories/CenterView/index.js b/examples/react-native-vanilla/storybook/stories/CenterView/index.js index 8fa23359ed88..29732b27ab24 100644 --- a/examples/react-native-vanilla/storybook/stories/CenterView/index.js +++ b/examples/react-native-vanilla/storybook/stories/CenterView/index.js @@ -3,8 +3,8 @@ import PropTypes from 'prop-types'; import { View } from 'react-native'; import style from './style'; -export default function CenterView(props) { - return {props.children}; +export default function CenterView({ children }) { + return {children}; } CenterView.defaultProps = { diff --git a/examples/react-native-vanilla/storybook/stories/Knobs/index.js b/examples/react-native-vanilla/storybook/stories/Knobs/index.js index 7a90361e1d4a..d3c552f91165 100644 --- a/examples/react-native-vanilla/storybook/stories/Knobs/index.js +++ b/examples/react-native-vanilla/storybook/stories/Knobs/index.js @@ -56,7 +56,11 @@ export default () => { My birthday is: {new Date(birthday).toLocaleDateString('en-US', dateOptions)} My wallet contains: ${dollars.toFixed(2)} In my backpack, I have: - {items.map(item => {item})} + + {items.map(item => ( + {item} + ))} + {salutation} ); diff --git a/examples/react-native-vanilla/storybook/stories/Welcome/index.js b/examples/react-native-vanilla/storybook/stories/Welcome/index.js index 2f33bc492b49..119401fc78e6 100644 --- a/examples/react-native-vanilla/storybook/stories/Welcome/index.js +++ b/examples/react-native-vanilla/storybook/stories/Welcome/index.js @@ -20,10 +20,14 @@ export default class Welcome extends React.Component { }, }; - showApp(event) { + showApp = event => { + const { showApp } = this.props; event.preventDefault(); - if (this.props.showApp) this.props.showApp(); - } + + if (showApp) { + showApp(); + } + }; render() { return ( diff --git a/lib/addons/src/make-decorator.js b/lib/addons/src/make-decorator.js index e7df28f726f1..7e7153c908a1 100644 --- a/lib/addons/src/make-decorator.js +++ b/lib/addons/src/make-decorator.js @@ -1,3 +1,5 @@ +/* eslint-disable react/destructuring-assignment */ + import deprecate from 'util-deprecate'; // Create a decorator that can be used both in the (deprecated) old "hoc" style: diff --git a/lib/addons/src/make-decorator.test.js b/lib/addons/src/make-decorator.test.js index 9beb3a706511..53f3dd8cfeb5 100644 --- a/lib/addons/src/make-decorator.test.js +++ b/lib/addons/src/make-decorator.test.js @@ -1,6 +1,6 @@ import deprecate from 'util-deprecate'; import { makeDecorator } from './make-decorator'; -import { defaultDecorateStory } from '../../../lib/core/src/client/preview/client_api'; +import { defaultDecorateStory } from '../../core/src/client/preview/client_api'; jest.mock('util-deprecate'); let deprecatedFns = []; diff --git a/lib/channels/src/index.test.js b/lib/channels/src/index.test.js index 7497f7e9cba7..b53bf0457429 100644 --- a/lib/channels/src/index.test.js +++ b/lib/channels/src/index.test.js @@ -1,6 +1,6 @@ /* eslint no-underscore-dangle: 0 */ -import Channel from './'; +import Channel from '.'; describe('Channel', () => { let transport = null; diff --git a/lib/cli/generators/HTML/template/stories/index.stories.js b/lib/cli/generators/HTML/template/stories/index.stories.js index 3a61ccde0144..a61a5a55117b 100644 --- a/lib/cli/generators/HTML/template/stories/index.stories.js +++ b/lib/cli/generators/HTML/template/stories/index.stories.js @@ -1,12 +1,14 @@ -/* global document */ +/* eslint-disable no-console, react/button-has-type */ + +import { document } from 'global'; import { storiesOf } from '@storybook/html'; storiesOf('Demo', module) .add('heading', () => '

Hello World

') .add('button', () => { const button = document.createElement('button'); + button.type = 'button'; button.innerText = 'Hello Button'; - // eslint-disable-next-line no-console button.addEventListener('click', e => console.log(e)); return button; }); diff --git a/lib/cli/generators/MITHRIL/template/stories/Button.js b/lib/cli/generators/MITHRIL/template/stories/Button.js index 8fcb462dd537..edec915a04b1 100644 --- a/lib/cli/generators/MITHRIL/template/stories/Button.js +++ b/lib/cli/generators/MITHRIL/template/stories/Button.js @@ -14,7 +14,7 @@ const style = { const Button = { view: vnode => ( - ), diff --git a/lib/cli/generators/MITHRIL/template/stories/Welcome.js b/lib/cli/generators/MITHRIL/template/stories/Welcome.js index b5ac4cb8ce91..cef0d3127fd3 100644 --- a/lib/cli/generators/MITHRIL/template/stories/Welcome.js +++ b/lib/cli/generators/MITHRIL/template/stories/Welcome.js @@ -71,6 +71,7 @@ const Link = { const NavButton = { view: vnode => ( ), diff --git a/lib/cli/test/snapshots/mithril/stories/Welcome.js b/lib/cli/test/snapshots/mithril/stories/Welcome.js index b5ac4cb8ce91..cef0d3127fd3 100644 --- a/lib/cli/test/snapshots/mithril/stories/Welcome.js +++ b/lib/cli/test/snapshots/mithril/stories/Welcome.js @@ -71,6 +71,7 @@ const Link = { const NavButton = { view: vnode => (