Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit b9df2bb

Browse files
Fixed eslint warnings.
1 parent 731b94b commit b9df2bb

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, { PropTypes } from 'react';
1+
/* eslint-disable react/prop-types */
2+
import React, { PropTypes } from 'react'
23

34
const SmartKnobedComponentMissingProps = ({
45
foo = '',
@@ -9,10 +10,10 @@ const SmartKnobedComponentMissingProps = ({
910
<p>{foo}</p>
1011
<p>{bar}</p>
1112
</code>
12-
);
13+
)
1314

1415
SmartKnobedComponentMissingProps.propTypes = {
1516
foo: PropTypes.string.isRequired,
16-
};
17+
}
1718

18-
export default SmartKnobedComponentMissingProps;
19+
export default SmartKnobedComponentMissingProps

example/stories/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { storiesOf } from '@kadira/storybook'
33
import { withSmartKnobs } from '../../src'
44
import { withKnobs, select } from '@kadira/storybook-addon-knobs';
55

6-
import SmartKnobedComponent from './SmartKnobedComponent';
7-
import SmartKnobedComponentMissingProps from './SmartKnobedComponentMissingProps';
6+
import SmartKnobedComponent from './SmartKnobedComponent'
7+
import SmartKnobedComponentMissingProps from './SmartKnobedComponentMissingProps'
88

99
const stub = fn => fn();
1010

@@ -19,7 +19,7 @@ storiesOf('Smart Knobs missing props', module)
1919
.addDecorator(withSmartKnobs)
2020
.addDecorator(withKnobs)
2121
.add('example', () => (
22-
<SmartKnobedComponentMissingProps foo="baz" />
22+
<SmartKnobedComponentMissingProps foo='baz' />
2323
))
2424

2525
storiesOf('Smart Knobs with manual knobs', module)

src/index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,18 @@ export const withSmartKnobs = (story, context) => {
6363
}
6464

6565
const finalProps = props ? Object.keys(props).reduce((acc, n) => {
66-
const item = props[n];
66+
const item = props[n]
67+
6768
if (!item.type) {
68-
console.warn(`There is a prop with defaultValue ${item.defaultValue.value} but it wasnt specified on element.propTypes. Check story: "${context.kind}".`);
69-
return acc;
69+
console.warn(`There is a prop with defaultValue ${item.defaultValue.value} but it wasnt specified on element.propTypes. Check story: "${context.kind}".`)
70+
return acc
7071
}
7172

7273
return {
7374
...acc,
7475
[n]: item,
75-
};
76-
}, {}) : {};
76+
}
77+
}, {}) : {}
7778

7879
return cloneElement(component, resolvePropValues(finalProps, defaultProps))
7980
}

0 commit comments

Comments
 (0)