From 52c4cbad426cdf46b42a8b1449b2ca5e5e286db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20O=E2=80=99Shannessy?= Date: Tue, 22 Sep 2015 14:29:04 -0700 Subject: [PATCH 1/2] Update linting dependencies, fix errors --- .eslintrc | 6 +++++- package.json | 9 +++++---- src/appear.jsx | 3 ++- src/base.jsx | 2 +- src/block-quote.jsx | 3 ++- src/code-pane.jsx | 3 ++- src/code.jsx | 3 ++- src/deck.jsx | 2 +- src/fill.jsx | 3 ++- src/fit.jsx | 3 ++- src/heading.jsx | 12 ++++++------ src/image.jsx | 3 ++- src/layout.jsx | 3 ++- src/link.jsx | 3 ++- src/list-item.jsx | 3 ++- src/list.jsx | 3 ++- src/overview.jsx | 2 -- src/presenter.jsx | 7 ++++--- src/quote.jsx | 3 ++- src/s.jsx | 1 + src/slide.jsx | 5 +++-- src/text.jsx | 8 ++++---- src/transitions.jsx | 2 +- src/utils/context.jsx | 2 +- 24 files changed, 56 insertions(+), 38 deletions(-) diff --git a/.eslintrc b/.eslintrc index 941c0c818..ae6301748 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,3 +1,7 @@ --- "extends": - - "defaults/configurations/walmart/es6-react" \ No newline at end of file + - "eslint-config-defaults/configurations/walmart/es6-react" + +"rules": + "indent": [2, 2, {"SwitchCase": 1}] + "max-len": 0 diff --git a/package.json b/package.json index b4003ba3b..0598e3c77 100644 --- a/package.json +++ b/package.json @@ -30,12 +30,13 @@ "autoprefixer-core": "^5.2.1", "babel": "^5.6.14", "babel-core": "^5.6.15", - "babel-eslint": "^3.1.23", + "babel-eslint": "^4.1.3", "babel-loader": "^5.2.2", "css-loader": "^0.15.1", - "eslint": "^0.24.0", - "eslint-config-defaults": "^3.0.3", - "eslint-plugin-react": "^2.6.4", + "eslint": "^1.5.1", + "eslint-config-defaults": "^6.0.0", + "eslint-plugin-filenames": "^0.1.2", + "eslint-plugin-react": "^3.4.2", "file-loader": "^0.8.4", "json-loader": "^0.5.2", "node-libs-browser": "^0.5.2", diff --git a/src/appear.jsx b/src/appear.jsx index e48d55482..b43a8abe2 100644 --- a/src/appear.jsx +++ b/src/appear.jsx @@ -6,7 +6,8 @@ import assign from "object-assign"; const Appear = React.createClass({ mixins: [tweenState.Mixin], propTypes: { - children: React.PropTypes.node + children: React.PropTypes.node, + style: React.PropTypes.object }, contextTypes: { flux: React.PropTypes.object, diff --git a/src/base.jsx b/src/base.jsx index c621a065f..005a99b0e 100644 --- a/src/base.jsx +++ b/src/base.jsx @@ -1,4 +1,4 @@ -/*eslint max-statements:0,complexity:0*/ +/*eslint max-statements:0,complexity:0,no-invalid-this:0*/ import React from "react/addons"; const getStyles = function getStyles() { diff --git a/src/block-quote.jsx b/src/block-quote.jsx index ddcc39ad2..34624c3fb 100644 --- a/src/block-quote.jsx +++ b/src/block-quote.jsx @@ -14,7 +14,8 @@ class BlockQuote extends Base { } BlockQuote.propTypes = { - children: React.PropTypes.node + children: React.PropTypes.node, + style: React.PropTypes.object }; BlockQuote.contextTypes = { diff --git a/src/code-pane.jsx b/src/code-pane.jsx index 90a6586ac..f5a7c8d4e 100644 --- a/src/code-pane.jsx +++ b/src/code-pane.jsx @@ -29,7 +29,8 @@ CodePane.contextTypes = { CodePane.propTypes = { lang: React.PropTypes.string, - source: React.PropTypes.string + source: React.PropTypes.string, + style: React.PropTypes.object }; CodePane.defaultProps = { diff --git a/src/code.jsx b/src/code.jsx index d66f6c241..6b204d1a2 100644 --- a/src/code.jsx +++ b/src/code.jsx @@ -14,7 +14,8 @@ class Code extends Base { } Code.propTypes = { - children: React.PropTypes.node + children: React.PropTypes.node, + style: React.PropTypes.object }; Code.contextTypes = { diff --git a/src/deck.jsx b/src/deck.jsx index 5e4b315c0..ac61d6aa7 100644 --- a/src/deck.jsx +++ b/src/deck.jsx @@ -128,7 +128,7 @@ class Deck extends React.Component { } _getHash(slide) { let hash = slide; - if ('id' in this.props.children[slide].props) { + if ("id" in this.props.children[slide].props) { hash = this.props.children[slide].props.id; } return hash; diff --git a/src/fill.jsx b/src/fill.jsx index 5a6ee59bb..05990810f 100644 --- a/src/fill.jsx +++ b/src/fill.jsx @@ -16,7 +16,8 @@ class Fill extends React.Component { } Fill.propTypes = { - children: React.PropTypes.node + children: React.PropTypes.node, + style: React.PropTypes.object }; export default Fill; diff --git a/src/fit.jsx b/src/fit.jsx index b1fadd263..9997031f3 100644 --- a/src/fit.jsx +++ b/src/fit.jsx @@ -16,7 +16,8 @@ class Fit extends React.Component { } Fit.propTypes = { - children: React.PropTypes.node + children: React.PropTypes.node, + style: React.PropTypes.object }; export default Fit; diff --git a/src/heading.jsx b/src/heading.jsx index c82435f36..d83df4f89 100644 --- a/src/heading.jsx +++ b/src/heading.jsx @@ -44,18 +44,18 @@ class Heading extends Base { const Tag = "H" + this.props.size; const styles = { container: { - display: 'block', - width: '100%', + display: "block", + width: "100%", height: this.state.height }, text: { fontSize: 16, - display: 'block', + display: "block", margin: "0", padding: "0", lineHeight: this.props.lineHeight, transform: "scale(" + this.state.scale + ")", - transformOrigin: 'center top' + transformOrigin: "center top" } }; return this.props.fit @@ -71,8 +71,8 @@ class Heading extends Base { : React.createElement(Tag, { - style: [this.context.styles.components.heading["h" + this.props.size], this.getStyles(), this.props.style] - }, this.props.children); + style: [this.context.styles.components.heading["h" + this.props.size], this.getStyles(), this.props.style] + }, this.props.children); } } diff --git a/src/image.jsx b/src/image.jsx index 990c658f1..b0a864075 100644 --- a/src/image.jsx +++ b/src/image.jsx @@ -32,7 +32,8 @@ Image.propTypes = { React.PropTypes.number ]), display: React.PropTypes.string, - src: React.PropTypes.string + src: React.PropTypes.string, + style: React.PropTypes.object }; Image.contextTypes = { diff --git a/src/layout.jsx b/src/layout.jsx index bc768e319..01fef8678 100644 --- a/src/layout.jsx +++ b/src/layout.jsx @@ -16,7 +16,8 @@ class Layout extends React.Component { } Layout.propTypes = { - children: React.PropTypes.node + children: React.PropTypes.node, + style: React.PropTypes.object }; export default Layout; diff --git a/src/link.jsx b/src/link.jsx index e5f24c9c3..fd8f15fd1 100644 --- a/src/link.jsx +++ b/src/link.jsx @@ -15,7 +15,8 @@ class Link extends Base { Link.propTypes = { children: React.PropTypes.node, - href: React.PropTypes.string + href: React.PropTypes.string, + style: React.PropTypes.object }; Link.contextTypes = { diff --git a/src/list-item.jsx b/src/list-item.jsx index 1282cdf57..205dd4955 100644 --- a/src/list-item.jsx +++ b/src/list-item.jsx @@ -14,7 +14,8 @@ class ListItem extends Base { } ListItem.propTypes = { - children: React.PropTypes.node + children: React.PropTypes.node, + style: React.PropTypes.object }; ListItem.contextTypes = { diff --git a/src/list.jsx b/src/list.jsx index d069cd01b..c9fa34fad 100644 --- a/src/list.jsx +++ b/src/list.jsx @@ -14,7 +14,8 @@ class List extends Base { } List.propTypes = { - children: React.PropTypes.node + children: React.PropTypes.node, + style: React.PropTypes.object }; List.contextTypes = { diff --git a/src/overview.jsx b/src/overview.jsx index a13272e08..f9aa2ec63 100644 --- a/src/overview.jsx +++ b/src/overview.jsx @@ -1,5 +1,3 @@ -/*global setInterval*/ - import React from "react/addons"; import cloneWithProps from "react/lib/cloneWithProps"; import Base from "./base"; diff --git a/src/presenter.jsx b/src/presenter.jsx index 29c84c5bd..3a46eb7e0 100644 --- a/src/presenter.jsx +++ b/src/presenter.jsx @@ -29,7 +29,7 @@ class Presenter extends Base { _renderMainSlide() { const child = this.props.slides[this.props.slide]; const presenterStyle = { - position: "relative", + position: "relative" }; return cloneWithProps(child, { key: this.props.slide, @@ -42,7 +42,7 @@ class Presenter extends Base { }); } componentDidMount() { - this.time = setInterval(()=> { + this.time = setInterval(() => { this.setState({ time: startTime(new Date()) }); @@ -61,7 +61,7 @@ class Presenter extends Base { left: "50%", transform: "translate(-50%, -50%)", margin: 0, - color: 'white' + color: "white" }; const child = this.props.slides[parseInt(this.props.slide) + 1]; return child ? cloneWithProps(child, { @@ -183,6 +183,7 @@ class Presenter extends Base { Presenter.propTypes = { lastSlide: React.PropTypes.number, + hash: React.PropTypes.number, slides: React.PropTypes.array, slide: React.PropTypes.number }; diff --git a/src/quote.jsx b/src/quote.jsx index 95eb167aa..0855dfdb2 100644 --- a/src/quote.jsx +++ b/src/quote.jsx @@ -14,7 +14,8 @@ class Quote extends Base { } Quote.propTypes = { - children: React.PropTypes.node + children: React.PropTypes.node, + style: React.PropTypes.object }; Quote.contextTypes = { diff --git a/src/s.jsx b/src/s.jsx index 2d1b5221c..992fb522d 100644 --- a/src/s.jsx +++ b/src/s.jsx @@ -28,6 +28,7 @@ class S extends React.Component { S.propTypes = { children: React.PropTypes.node, + style: React.PropTypes.object, type: React.PropTypes.array }; diff --git a/src/slide.jsx b/src/slide.jsx index 7243b765c..3d7981de1 100644 --- a/src/slide.jsx +++ b/src/slide.jsx @@ -18,6 +18,7 @@ const Slide = React.createClass({ }, propTypes: { align: React.PropTypes.string, + hash: React.PropTypes.number, presenterStyle: React.PropTypes.object, children: React.PropTypes.node, notes: React.PropTypes.string, @@ -76,12 +77,12 @@ const Slide = React.createClass({ } : {}; const overViewStyles = { inner: { - flexDirection: 'column' + flexDirection: "column" }, content: { width: "100%" } - } + }; const styles = { outer: { position: this.context.export ? "relative" : "absolute", diff --git a/src/text.jsx b/src/text.jsx index 927ca3f6a..678b77fb8 100644 --- a/src/text.jsx +++ b/src/text.jsx @@ -43,18 +43,18 @@ class Text extends Base { render() { const styles = { container: { - display: 'block', - width: '100%', + display: "block", + width: "100%", height: this.state.height }, text: { fontSize: 16, - display: 'block', + display: "block", margin: "0", padding: "0", lineHeight: this.props.lineHeight, transform: "scale(" + this.state.scale + ")", - transformOrigin: 'center top' + transformOrigin: "center top" } }; return this.props.fit diff --git a/src/transitions.jsx b/src/transitions.jsx index efab8ae0d..ce5b5624a 100644 --- a/src/transitions.jsx +++ b/src/transitions.jsx @@ -52,7 +52,7 @@ export default { this.setState({ z: 1 - }, ()=> { + }, () => { if (this.props.transition.indexOf("fade") !== -1) { this.tweenState("opacity", { diff --git a/src/utils/context.jsx b/src/utils/context.jsx index 1a1da2c27..d05d80d9b 100644 --- a/src/utils/context.jsx +++ b/src/utils/context.jsx @@ -35,7 +35,7 @@ const context = function context(Component, params) { overview: location.query && "overview" in location.query, export: location.query && "export" in location.query, print: location.query && "print" in location.query, - slide: slide + slide }; }, From 251b30b268655d173d8a4eae97844b19069ced0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20O=E2=80=99Shannessy?= Date: Tue, 22 Sep 2015 14:47:14 -0700 Subject: [PATCH 2/2] Enable lint outside of src, fix other issues --- .eslintignore | 1 + index.jsx | 6 +++--- package.json | 2 +- presentation/deck.jsx | 6 +++--- themes/default/html.js | 40 ++++++++++++++++++++-------------------- themes/default/index.js | 10 +++++----- themes/default/print.js | 4 ++-- webpack.config.js | 19 ++++++++++--------- 8 files changed, 45 insertions(+), 43 deletions(-) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..849ddff3b --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +dist/ diff --git a/index.jsx b/index.jsx index 09ba36b6d..5e0870d67 100644 --- a/index.jsx +++ b/index.jsx @@ -29,11 +29,11 @@ Presentation.contextTypes = { router: React.PropTypes.object }; -Presentation = context(Presentation, {styles: config.theme, print: config.print, flux}); +const PresentationContext = context(Presentation, {styles: config.theme, print: config.print, flux}); React.render( - - + + , document.body); diff --git a/package.json b/package.json index 0598e3c77..09e3a8e10 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "start": "webpack-dev-server", - "lint": "eslint --ext .js,.jsx src", + "lint": "eslint --ext .js,.jsx .", "build": "webpack", "deploy": "npm run build && surge -p ./dist" }, diff --git a/presentation/deck.jsx b/presentation/deck.jsx index 6bc9bd709..b98b02c8f 100644 --- a/presentation/deck.jsx +++ b/presentation/deck.jsx @@ -36,13 +36,13 @@ export default class extends React.Component { Hit Your Right Arrow To Begin! - - + + Wait what? - + ', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '
', - '', - '', - '' - ].join('') - } -} \ No newline at end of file + "200.html": data.defaultTemplate(), + "index.html": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "
", + "", + "", + "" + ].join("") + }; +}; diff --git a/themes/default/index.js b/themes/default/index.js index 0cfd1ce50..57cc45809 100644 --- a/themes/default/index.js +++ b/themes/default/index.js @@ -11,8 +11,8 @@ const fonts = { }; module.exports = { - colors: colors, - fonts: fonts, + colors, + fonts, global: { body: { background: colors.primary, @@ -80,15 +80,15 @@ module.exports = { bar: { container: { position: "absolute", - height: '10px', - width: '100%', + height: "10px", + width: "100%", bottom: 0, left: 0, transition: "all 1s ease-in-out 0.2s", zIndex: 1000 }, bar: { - height: '100%', + height: "100%", background: colors.tertiary, transition: "all 0.3s ease-out" } diff --git a/themes/default/print.js b/themes/default/print.js index 49dc97586..7304503c8 100644 --- a/themes/default/print.js +++ b/themes/default/print.js @@ -11,8 +11,8 @@ const fonts = { }; module.exports = { - colors: colors, - fonts: fonts, + colors, + fonts, global: { body: { background: "white", diff --git a/webpack.config.js b/webpack.config.js index f504675a7..f15155d8c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,9 +1,10 @@ -var getConfig = require('hjs-webpack') -var config = require('./presentation/config'); +/*eslint-disable no-var*/ +var getConfig = require("hjs-webpack"); +var config = require("./presentation/config"); var webpackConfig = getConfig({ - in: './index.jsx', - out: 'dist', + in: "./index.jsx", + out: "dist", clearBeforeBuild: true, html: config.html }); @@ -12,12 +13,12 @@ webpackConfig.module.loaders[0] = { test: /(\.js$)|(\.jsx$)/, exclude: /node_modules/, loaders: [ - 'babel-loader?stage=1' + "babel-loader?stage=1" ] -} +}; -if (process.argv[1].indexOf('webpack-dev-server') !== -1) { - webpackConfig.module.loaders[0].loaders.unshift('react-hot') +if (process.argv[1].indexOf("webpack-dev-server") !== -1) { + webpackConfig.module.loaders[0].loaders.unshift("react-hot"); } -module.exports = webpackConfig; \ No newline at end of file +module.exports = webpackConfig;