diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index a8be29392b99..000000000000 --- a/.eslintrc +++ /dev/null @@ -1,29 +0,0 @@ -{ - "extends": [ - "./node_modules/eslint-config-airbnb-base/rules/es6.js" - ], - "plugins": [ - "prettier" - ], - "parser": "babel-eslint", - "parserOptions": { - "sourceType": "module" - }, - "env": { - "es6": true, - "node": true - }, - "rules": { - "strict": 0, - "prettier/prettier": ["warn", { - "printWidth": 100, - "tabWidth": 2, - "bracketSpacing": true, - # "trailingComma": "es5", - "singleQuote": true - }], - "quotes": ["warn", "single"], - "arrow-parens": ["warn", "as-needed"] - # "comma-dangle": ["warn", "always"] - } -} diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000000..ea25eb04850a --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,28 @@ +module.exports = { + extends: [ + './node_modules/eslint-config-airbnb-base/rules/es6.js', + ], + plugins: [ + 'prettier', + ], + parser: 'babel-eslint', + parserOptions: { + sourceType: 'module', + }, + env: { + es6: true, + node: true, + }, + rules: { + strict: 0, + 'prettier/prettier': ['warn', { + printWidth: 100, + tabWidth: 2, + bracketSpacing: true, + trailingComma: 'all', + singleQuote: true, + }], + quotes: ['warn', 'single'], + 'arrow-parens': ['warn', 'as-needed'], + }, +} diff --git a/package.json b/package.json index 9e97e82e8ecb..c9cff6725965 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "storybook", "devDependencies": { - "babel-eslint": "^7.2.1", + "babel-eslint": "^7.2.2", "eslint": "^3.19.0", - "eslint-config-airbnb-base": "^11.1.2", + "eslint-config-airbnb-base": "^11.1.3", "eslint-plugin-import": "^2.2.0", "eslint-plugin-prettier": "^2.0.1", - "lerna": "2.0.0-rc.1", - "prettier": "^0.22.0" + "lerna": "2.0.0-rc.2", + "prettier": "^1.1.0" }, "scripts": { "postinstall": "lerna bootstrap", diff --git a/packages/addon-actions/src/components/ActionLogger/index.js b/packages/addon-actions/src/components/ActionLogger/index.js index 4ecfd31ad1a5..203d2f1bf4d8 100644 --- a/packages/addon-actions/src/components/ActionLogger/index.js +++ b/packages/addon-actions/src/components/ActionLogger/index.js @@ -9,12 +9,9 @@ class ActionLogger extends Component { if (latest) { const borderLeft = style.action.borderLeft; latest.style.borderLeft = 'solid 5px #aaa'; - setTimeout( - () => { - latest.style.borderLeft = borderLeft; - }, - 300 - ); + setTimeout(() => { + latest.style.borderLeft = borderLeft; + }, 300); } } @@ -53,7 +50,7 @@ class ActionLogger extends Component { ActionLogger.propTypes = { onClear: PropTypes.func, - actions: PropTypes.array + actions: PropTypes.array, }; export default ActionLogger; diff --git a/packages/addon-actions/src/components/ActionLogger/style.js b/packages/addon-actions/src/components/ActionLogger/style.js index d370a9b8c31f..d82497e1adad 100644 --- a/packages/addon-actions/src/components/ActionLogger/style.js +++ b/packages/addon-actions/src/components/ActionLogger/style.js @@ -2,14 +2,14 @@ export default { wrapper: { flex: 1, display: 'flex', - position: 'relative' + position: 'relative', }, actions: { flex: 1, margin: 0, padding: '8px 2px 20px 0', overflowY: 'auto', - color: '#666' + color: '#666', }, action: { display: 'flex', @@ -17,21 +17,21 @@ export default { borderLeft: '5px solid white', borderBottom: '1px solid #fafafa', transition: 'all 0.1s', - alignItems: 'center' + alignItems: 'center', }, countwrap: { - paddingBottom: 2 + paddingBottom: 2, }, counter: { margin: '0 5px 0 5px', backgroundColor: '#777777', color: '#ffffff', padding: '1px 5px', - borderRadius: '20px' + borderRadius: '20px', }, inspector: { flex: 1, - padding: '0 0 0 5px' + padding: '0 0 0 5px', }, button: { position: 'absolute', @@ -44,6 +44,6 @@ export default { padding: '5px 10px', borderRadius: '4px 0 0 0', color: 'rgba(0, 0, 0, 0.5)', - outline: 'none' - } + outline: 'none', + }, }; diff --git a/packages/addon-actions/src/containers/ActionLogger/index.js b/packages/addon-actions/src/containers/ActionLogger/index.js index 49c70ef1b1a2..a4668784b059 100644 --- a/packages/addon-actions/src/containers/ActionLogger/index.js +++ b/packages/addon-actions/src/containers/ActionLogger/index.js @@ -38,7 +38,7 @@ export default class ActionLogger extends React.Component { render() { const props = { actions: this.state.actions, - onClear: () => this.clearActions() + onClear: () => this.clearActions(), }; return ; } diff --git a/packages/addon-actions/src/manager.js b/packages/addon-actions/src/manager.js index 14c80cc4fff4..4728e7ac6d3d 100644 --- a/packages/addon-actions/src/manager.js +++ b/packages/addon-actions/src/manager.js @@ -8,7 +8,7 @@ export function register() { const channel = addons.getChannel(); addons.addPanel(PANEL_ID, { title: 'Action Logger', - render: () => + render: () => , }); }); } diff --git a/packages/addon-actions/src/preview.js b/packages/addon-actions/src/preview.js index 963ab29d28b8..a2dfd1b31a0f 100644 --- a/packages/addon-actions/src/preview.js +++ b/packages/addon-actions/src/preview.js @@ -16,7 +16,7 @@ export function action(name) { const randomId = Math.random().toString(16).slice(2); channel.emit(EVENT_ID, { id: randomId, - data: { name, args } + data: { name, args }, }); }; diff --git a/packages/addon-comments/src/index.js b/packages/addon-comments/src/index.js index 99555c12786d..4a7863a01254 100644 --- a/packages/addon-comments/src/index.js +++ b/packages/addon-comments/src/index.js @@ -7,7 +7,7 @@ const buttonStyles = { backgroundColor: '#FFFFFF', cursor: 'pointer', fontSize: 15, - padding: '3px 10px' + padding: '3px 10px', }; const Button = ({ children, onClick, style = {} }) => ( @@ -19,7 +19,7 @@ const Button = ({ children, onClick, style = {} }) => ( Button.propTypes = { children: PropTypes.string.isRequired, onClick: PropTypes.func, - style: PropTypes.object + style: PropTypes.object, }; export default Button; diff --git a/packages/addon-comments/src/manager/components/CommentForm/index.js b/packages/addon-comments/src/manager/components/CommentForm/index.js index 9eda02fe05f6..c2259db8fdcb 100644 --- a/packages/addon-comments/src/manager/components/CommentForm/index.js +++ b/packages/addon-comments/src/manager/components/CommentForm/index.js @@ -17,7 +17,7 @@ marked.setOptions({ pedantic: false, sanitize: true, smartLists: true, - smartypants: false + smartypants: false, }); export default class CommentForm extends Component { @@ -85,5 +85,5 @@ export default class CommentForm extends Component { } CommentForm.propTypes = { - addComment: PropTypes.func + addComment: PropTypes.func, }; diff --git a/packages/addon-comments/src/manager/components/CommentForm/style.js b/packages/addon-comments/src/manager/components/CommentForm/style.js index 3efb44b649f6..99ec998e9ff4 100644 --- a/packages/addon-comments/src/manager/components/CommentForm/style.js +++ b/packages/addon-comments/src/manager/components/CommentForm/style.js @@ -7,19 +7,19 @@ const button = { padding: '7px 15px', fontSize: 12, lineHeight: 1, - color: 'rgba(0, 0, 0, 0.5)' + color: 'rgba(0, 0, 0, 0.5)', }; export default { wrapper: { display: 'flex', alignItems: 'center', - borderTop: '1px solid rgb(234, 234, 234)' + borderTop: '1px solid rgb(234, 234, 234)', }, submitButton: { ...button, cursor: 'pointer', - borderRadius: '0 0 4px 0' + borderRadius: '0 0 4px 0', }, input: { flex: 1, @@ -34,6 +34,6 @@ export default { lineHeight: 1.6, color: 'rgba(0, 0, 0, 0.8)', fontFamily: 'sans-serif', - resize: 'none' - } + resize: 'none', + }, }; diff --git a/packages/addon-comments/src/manager/components/CommentItem/index.js b/packages/addon-comments/src/manager/components/CommentItem/index.js index 88cc0122b7f6..023c451eb9ea 100644 --- a/packages/addon-comments/src/manager/components/CommentItem/index.js +++ b/packages/addon-comments/src/manager/components/CommentItem/index.js @@ -74,5 +74,5 @@ export default class CommentItem extends Component { CommentItem.propTypes = { deleteComment: PropTypes.func, comment: PropTypes.object, - ownComment: PropTypes.bool + ownComment: PropTypes.bool, }; diff --git a/packages/addon-comments/src/manager/components/CommentItem/style.js b/packages/addon-comments/src/manager/components/CommentItem/style.js index fd3388d98e2f..b27c4942e3af 100644 --- a/packages/addon-comments/src/manager/components/CommentItem/style.js +++ b/packages/addon-comments/src/manager/components/CommentItem/style.js @@ -2,28 +2,28 @@ const commentItem = { display: 'flex', paddingBottom: '5px', WebkitFontSmoothing: 'antialiased', - transition: 'opacity 0.5s' + transition: 'opacity 0.5s', }; export default { commentItem: { - ...commentItem + ...commentItem, }, commentItemloading: { ...commentItem, - opacity: 0.25 + opacity: 0.25, }, commentAside: { - margin: '5px 10px 0 0' + margin: '5px 10px 0 0', }, commentAvatar: { width: 32, height: 32, - borderRadius: 5 + borderRadius: 5, }, commentContent: { position: 'relative', - flex: 1 + flex: 1, }, commentHead: { // @@ -33,19 +33,19 @@ export default { fontSize: 13, lineHeight: 1, fontWeight: 'bold', - marginRight: 5 + marginRight: 5, }, commentTime: { fontFamily: 'sans-serif', fontSize: 11, lineHeight: 1, - color: 'rgb(150, 150, 150)' + color: 'rgb(150, 150, 150)', }, commentText: { fontFamily: 'sans-serif', fontSize: 13, lineHeight: 1.7, - maxWidth: 650 + maxWidth: 650, }, commentDelete: { fontFamily: 'sans-serif', @@ -53,6 +53,6 @@ export default { top: 2, right: 0, fontSize: 11, - color: 'rgb(200, 200, 200)' - } + color: 'rgb(200, 200, 200)', + }, }; diff --git a/packages/addon-comments/src/manager/components/CommentList/index.js b/packages/addon-comments/src/manager/components/CommentList/index.js index b122369052e4..790c659153a5 100644 --- a/packages/addon-comments/src/manager/components/CommentList/index.js +++ b/packages/addon-comments/src/manager/components/CommentList/index.js @@ -53,5 +53,5 @@ export default class CommentList extends Component { CommentList.propTypes = { comments: PropTypes.array, user: PropTypes.object, - deleteComment: PropTypes.func + deleteComment: PropTypes.func, }; diff --git a/packages/addon-comments/src/manager/components/CommentList/style.js b/packages/addon-comments/src/manager/components/CommentList/style.js index e502e4654f04..8b9aab9d0af1 100644 --- a/packages/addon-comments/src/manager/components/CommentList/style.js +++ b/packages/addon-comments/src/manager/components/CommentList/style.js @@ -2,11 +2,11 @@ export default { wrapper: { flex: 1, overflow: 'auto', - padding: '7px 15px' + padding: '7px 15px', }, noComments: { fontFamily: 'sans-serif', fontSize: 13, - padding: '10px 0' - } + padding: '10px 0', + }, }; diff --git a/packages/addon-comments/src/manager/components/CommentsPanel/index.js b/packages/addon-comments/src/manager/components/CommentsPanel/index.js index f5832a58838c..0c09975c852f 100644 --- a/packages/addon-comments/src/manager/components/CommentsPanel/index.js +++ b/packages/addon-comments/src/manager/components/CommentsPanel/index.js @@ -39,5 +39,5 @@ export default class CommentsPanel extends Component { CommentsPanel.propTypes = { loading: PropTypes.bool, user: PropTypes.object, - appNotAvailable: PropTypes.bool + appNotAvailable: PropTypes.bool, }; diff --git a/packages/addon-comments/src/manager/components/CommentsPanel/style.js b/packages/addon-comments/src/manager/components/CommentsPanel/style.js index 6f92dfce5ecf..00ca94c7ae17 100644 --- a/packages/addon-comments/src/manager/components/CommentsPanel/style.js +++ b/packages/addon-comments/src/manager/components/CommentsPanel/style.js @@ -3,7 +3,7 @@ export default { flex: 1, display: 'flex', flexDirection: 'column', - position: 'relative' + position: 'relative', }, message: { flex: 1, @@ -15,7 +15,7 @@ export default { fontSize: 11, letterSpacing: 1, textDecoration: 'none', - textTransform: 'uppercase' + textTransform: 'uppercase', }, button: { textDecoration: 'none', @@ -24,6 +24,6 @@ export default { background: 'rgb(240, 240, 240)', borderRadius: 5, textTransform: 'none', - fontSize: 12 - } + fontSize: 12, + }, }; diff --git a/packages/addon-comments/src/manager/containers/CommentsPanel/dataStore.js b/packages/addon-comments/src/manager/containers/CommentsPanel/dataStore.js index 7c0523f2ef29..17e1a13d6baa 100644 --- a/packages/addon-comments/src/manager/containers/CommentsPanel/dataStore.js +++ b/packages/addon-comments/src/manager/containers/CommentsPanel/dataStore.js @@ -19,7 +19,7 @@ export default class DataStore { const key = this._getStoryKey(currentStory); this.cache[key] = { comments, - addedAt: Date.now() + addedAt: Date.now(), }; } @@ -50,7 +50,7 @@ export default class DataStore { () => { this._loadUsers().then(() => this._loadComments()); }, - 1000 * 60 // Reload for every minute + 1000 * 60, // Reload for every minute ); } @@ -94,16 +94,13 @@ export default class DataStore { return null; } return this.db.getCollection('users').get(query, options).then(users => { - this.users = users.reduce( - (newUsers, user) => { - const usersObj = { - ...newUsers - }; - usersObj[user.id] = user; - return usersObj; - }, - {} - ); + this.users = users.reduce((newUsers, user) => { + const usersObj = { + ...newUsers, + }; + usersObj[user.id] = user; + return usersObj; + }, {}); }); }); } @@ -193,7 +190,7 @@ export default class DataStore { const doc = { ...comment, ...this.currentStory, - sbProtected: true + sbProtected: true, }; return this.db.getCollection('comments').set(doc); diff --git a/packages/addon-comments/src/manager/containers/CommentsPanel/index.js b/packages/addon-comments/src/manager/containers/CommentsPanel/index.js index 703a68cd36db..dcb5ef8d23de 100644 --- a/packages/addon-comments/src/manager/containers/CommentsPanel/index.js +++ b/packages/addon-comments/src/manager/containers/CommentsPanel/index.js @@ -14,7 +14,7 @@ export default class Container extends Component { user: null, users: [], comments: [], - loading: true + loading: true, }; } @@ -86,7 +86,7 @@ export default class Container extends Component { const comment = { text, time, - userId: user.id + userId: user.id, }; this.store.addComment(comment); @@ -103,7 +103,7 @@ export default class Container extends Component { loading: this.state.loading, appNotAvailable: this.state.appNotAvailable, deleteComment: commentId => this.deleteComment(commentId), - addComment: text => this.addComment(text) + addComment: text => this.addComment(text), }; return ; @@ -111,5 +111,5 @@ export default class Container extends Component { } Container.propTypes = { - api: PropTypes.object + api: PropTypes.object, }; diff --git a/packages/addon-comments/src/manager/index.js b/packages/addon-comments/src/manager/index.js index 207bfacdc63f..574d224494c0 100644 --- a/packages/addon-comments/src/manager/index.js +++ b/packages/addon-comments/src/manager/index.js @@ -10,7 +10,7 @@ export function init() { // add 'Comments' panel addons.addPanel(PANEL_ID, { title: 'Comments', - render: () => + render: () => , }); }); } diff --git a/packages/addon-comments/src/stories/index.js b/packages/addon-comments/src/stories/index.js index 245ebe2741a2..98a7783dfe2c 100644 --- a/packages/addon-comments/src/stories/index.js +++ b/packages/addon-comments/src/stories/index.js @@ -7,7 +7,7 @@ import CommentsPanel from '../manager/components/CommentsPanel'; const userObj = { avatar: 'http://www.gravatar.com/avatar/?d=identicon', - name: 'User A' + name: 'User A', }; const commentsList = [ @@ -15,29 +15,29 @@ const commentsList = [ loading: false, user: { avatar: 'http://www.gravatar.com/avatar/?d=identicon', - name: 'User A' + name: 'User A', }, time: 'Wed Oct 12 2016 13:36:59 GMT+0530 (IST)', - text: 'Lorem ipsum dolor sit amet,
Ut odio massa, rutrum et purus id.
' + text: 'Lorem ipsum dolor sit amet,
Ut odio massa, rutrum et purus id.
', }, { loading: false, user: { avatar: 'http://www.gravatar.com/avatar/?d=identicon', - name: 'User B' + name: 'User B', }, time: 'Wed Oct 12 2016 13:38:46 GMT+0530 (IST)', - text: 'Vivamus tortor nisi, efficitur in rutrum ac, tempor et mauris. In et rutrum enim' + text: 'Vivamus tortor nisi, efficitur in rutrum ac, tempor et mauris. In et rutrum enim', }, { loading: true, user: { avatar: 'http://www.gravatar.com/avatar/?d=identicon', - name: 'User C' + name: 'User C', }, time: 'Wed Oct 12 2016 13:38:55 GMT+0530 (IST)', - text: 'sample comment 3' - } + text: 'sample comment 3', + }, ]; storiesOf('Button', module) @@ -47,7 +47,7 @@ storiesOf('Button', module) const style = { fontSize: 20, textTransform: 'uppercase', - color: '#FF8833' + color: '#FF8833', }; return ; }); diff --git a/packages/addon-comments/src/tests/dataStore.js b/packages/addon-comments/src/tests/dataStore.js index d2e9fce6fb44..110de0afed7d 100644 --- a/packages/addon-comments/src/tests/dataStore.js +++ b/packages/addon-comments/src/tests/dataStore.js @@ -17,14 +17,14 @@ const myDb = { }, set() { return new Promise(dbSetPromiseReturn); - } + }, }; }, persister: { _getAppInfo() { return Promise.resolve(true); - } - } + }, + }, }; addons.setDatabase(myDb); @@ -38,14 +38,14 @@ describe('DataStore', () => { expect(dbGetPromiseReturn.called).to.equal(false); expect(theStore.currentStory).to.deep.equal({ sbKind: 'Components', - sbStory: 'CommentList - No Comments' + sbStory: 'CommentList - No Comments', }); }); it('set current user', () => { theStore.setCurrentUser({ id: 'user-id', - name: 'user-name' + name: 'user-name', }); expect(theStore.user).to.deep.equal({ id: 'user-id', name: 'user-name' }); @@ -57,7 +57,7 @@ describe('DataStore', () => { expect(dbGetPromiseReturn.called).to.equal(true); expect(theStore.currentStory).to.deep.equal({ sbKind: 'Components', - sbStory: 'CommentList - No Comments' + sbStory: 'CommentList - No Comments', }); }); @@ -65,7 +65,7 @@ describe('DataStore', () => { const comment = { text: 'sample comment', time: 1476435982029, - userId: 'user-id' + userId: 'user-id', }; theStore.addComment(comment); diff --git a/packages/addon-graphql/demo/index.js b/packages/addon-graphql/demo/index.js index b3852a0f68c7..debae1bb27e0 100644 --- a/packages/addon-graphql/demo/index.js +++ b/packages/addon-graphql/demo/index.js @@ -14,8 +14,8 @@ const userType = new graphql.GraphQLObjectType({ name: 'User', fields: { id: { type: graphql.GraphQLString }, - name: { type: graphql.GraphQLString } - } + name: { type: graphql.GraphQLString }, + }, }); // Define the schema with one top-level field, `user`, that @@ -30,7 +30,7 @@ const schema = new graphql.GraphQLSchema({ type: userType, // `args` describes the arguments that the `user` query accepts args: { - id: { type: graphql.GraphQLString } + id: { type: graphql.GraphQLString }, }, // The resolve function describes how to "resolve" or fulfill // the incoming query. @@ -38,10 +38,10 @@ const schema = new graphql.GraphQLSchema({ // to get the User from `data` resolve(_, args) { return data[args.id]; - } - } - } - }) + }, + }, + }, + }), }); express().use(cors()).use('/graphql', graphqlHTTP({ schema, pretty: true })).listen(3000); diff --git a/packages/addon-graphql/src/components/FullScreen/style.js b/packages/addon-graphql/src/components/FullScreen/style.js index 5001a7e1f9cc..9d36b5a767d9 100644 --- a/packages/addon-graphql/src/components/FullScreen/style.js +++ b/packages/addon-graphql/src/components/FullScreen/style.js @@ -4,6 +4,6 @@ export default { top: 0, right: 0, bottom: 0, - left: 0 - } + left: 0, + }, }; diff --git a/packages/addon-graphql/src/preview.js b/packages/addon-graphql/src/preview.js index cda20a3ae1e0..54807c35c078 100644 --- a/packages/addon-graphql/src/preview.js +++ b/packages/addon-graphql/src/preview.js @@ -5,7 +5,7 @@ import 'graphiql/graphiql.css'; const FETCH_OPTIONS = { method: 'post', - headers: { 'Content-Type': 'application/json' } + headers: { 'Content-Type': 'application/json' }, }; function getDefautlFetcher(url) { diff --git a/packages/addon-info/example/Button.js b/packages/addon-info/example/Button.js index 1fd1c16b38ca..df7c34c01288 100644 --- a/packages/addon-info/example/Button.js +++ b/packages/addon-info/example/Button.js @@ -13,8 +13,8 @@ Object.assign(Button, { label: PropTypes.string.isRequired, style: PropTypes.object, disabled: PropTypes.bool, - onClick: PropTypes.func - } + onClick: PropTypes.func, + }, }); export default Button; diff --git a/packages/addon-info/example/story.js b/packages/addon-info/example/story.js index 4021b96fdb7c..e24e26a5b0d8 100644 --- a/packages/addon-info/example/story.js +++ b/packages/addon-info/example/story.js @@ -16,7 +16,7 @@ storiesOf('Button').addWithInfo( Click the "?" mark at top-right to view the info.

- ) + ), ); storiesOf('Button').addWithInfo( @@ -25,7 +25,7 @@ storiesOf('Button').addWithInfo( This is the basic usage with the button with providing a label to show the text. `, () =>