diff --git a/.eslintrc b/.eslintrc index 7e00e12148..ae5570a5d6 100644 --- a/.eslintrc +++ b/.eslintrc @@ -13,15 +13,12 @@ "babel" ], "rules": { - "brace-style": 0, "constructor-super": 2, "comma-dangle": 0, "comma-spacing": 2, "comma-style": [2, "last"], - "default-case": 0, "func-names": 0, "guard-for-in": 0, - "indent": 0, "one-var": [2, { "initialized": "never" }], "padded-blocks": 0, "prefer-const": 0, diff --git a/docs/examples/ButtonInput.js b/docs/examples/ButtonInput.js index e1c64bdfb2..774940998d 100644 --- a/docs/examples/ButtonInput.js +++ b/docs/examples/ButtonInput.js @@ -17,8 +17,8 @@ const ButtonInputExample = React.createClass({ let length = this.refs.input.getValue().length; let style = 'danger'; - if (length > 10) { style = 'success'; } - else if (length > 5) { style = 'warning'; } + if (length > 10) style = 'success'; + else if (length > 5) style = 'warning'; let disabled = style !== 'success'; diff --git a/docs/examples/Input.js b/docs/examples/Input.js index 980413339a..c98d7911e7 100644 --- a/docs/examples/Input.js +++ b/docs/examples/Input.js @@ -7,9 +7,9 @@ const ExampleInput = React.createClass({ validationState() { let length = this.state.value.length; - if (length > 10) { return 'success'; } - else if (length > 5) { return 'warning'; } - else if (length > 0) { return 'error'; } + if (length > 10) return 'success'; + else if (length > 5) return 'warning'; + else if (length > 0) return 'error'; }, handleChange() { diff --git a/docs/src/PropTable.js b/docs/src/PropTable.js index 46fb2314c8..4feaed34a4 100644 --- a/docs/src/PropTable.js +++ b/docs/src/PropTable.js @@ -146,28 +146,28 @@ const PropTable = React.createClass({ let doclets = prop.doclets || {}; switch (name) { - case 'object': - return name; - case 'union': - return type.value.reduce((current, val, i, list) => { - let item = this.getType({ type: val }); - if (React.isValidElement(item)) { - item = React.cloneElement(item, {key: i}); - } - current = current.concat(item); - - return i === (list.length - 1) ? current : current.concat(' | '); - }, []); - case 'array': - let child = this.getType({ type: type.value }); - - return {'array<'}{ child }{'>'}; - case 'enum': - return this.renderEnum(type); - case 'custom': - return cleanDocletValue(doclets.type || name); - default: - return name; + case 'object': + return name; + case 'union': + return type.value.reduce((current, val, i, list) => { + let item = this.getType({ type: val }); + if (React.isValidElement(item)) { + item = React.cloneElement(item, {key: i}); + } + current = current.concat(item); + + return i === (list.length - 1) ? current : current.concat(' | '); + }, []); + case 'array': + let child = this.getType({ type: type.value }); + + return {'array<'}{ child }{'>'}; + case 'enum': + return this.renderEnum(type); + case 'custom': + return cleanDocletValue(doclets.type || name); + default: + return name; } }, diff --git a/src/AffixMixin.js b/src/AffixMixin.js index af97e131c7..8e013dd4dc 100644 --- a/src/AffixMixin.js +++ b/src/AffixMixin.js @@ -30,7 +30,7 @@ const AffixMixin = { checkPosition() { let DOMNode, scrollHeight, scrollTop, position, offsetTop, offsetBottom, - affix, affixType, affixPositionTop; + affix, affixType, affixPositionTop; // TODO: or not visible if (!this.isMounted()) { diff --git a/src/Carousel.js b/src/Carousel.js index 8801661c2d..c306b6285b 100644 --- a/src/Carousel.js +++ b/src/Carousel.js @@ -249,18 +249,18 @@ const Carousel = React.createClass({ this.state.previousActiveIndex === index && this.props.slide; return cloneElement( - child, - { - active: isActive, - ref: child.ref, - key: child.key ? child.key : index, - index, - animateOut: isPreviousActive, - animateIn: isActive && this.state.previousActiveIndex != null && this.props.slide, - direction: this.state.direction, - onAnimateOutEnd: isPreviousActive ? this.handleItemAnimateOutEnd : null - } - ); + child, + { + active: isActive, + ref: child.ref, + key: child.key ? child.key : index, + index, + animateOut: isPreviousActive, + animateIn: isActive && this.state.previousActiveIndex != null && this.props.slide, + direction: this.state.direction, + onAnimateOutEnd: isPreviousActive ? this.handleItemAnimateOutEnd : null + } + ); }, handleSelect(index, direction) { diff --git a/src/Dropdown.js b/src/Dropdown.js index 3800bec484..92b07b1983 100644 --- a/src/Dropdown.js +++ b/src/Dropdown.js @@ -105,21 +105,21 @@ class Dropdown extends React.Component { }; switch(event.keyCode) { - case keycode.codes.down: - if (!this.props.open) { - this.toggleOpen(); - } - else { - focusNext(); - } - event.preventDefault(); - break; - case keycode.codes.esc: - case keycode.codes.tab: - if (this.props.open) { - this.handleClose(event); - } - break; + case keycode.codes.down: + if (!this.props.open) { + this.toggleOpen(); + } else { + focusNext(); + } + event.preventDefault(); + break; + case keycode.codes.esc: + case keycode.codes.tab: + if (this.props.open) { + this.handleClose(event); + } + break; + default: } } @@ -133,8 +133,7 @@ class Dropdown extends React.Component { // to the next focusable input if (event && event.keyCode === keycode.codes.tab){ setTimeout(this.toggleOpen); - } - else { + } else { this.toggleOpen(); } diff --git a/src/DropdownMenu.js b/src/DropdownMenu.js index 770684e26b..ed81eb21fe 100644 --- a/src/DropdownMenu.js +++ b/src/DropdownMenu.js @@ -20,18 +20,19 @@ class DropdownMenu extends React.Component { handleKeyDown(event) { switch(event.keyCode) { - case keycode.codes.down: - this.focusNext(); - event.preventDefault(); - break; - case keycode.codes.up: - this.focusPrevious(); - event.preventDefault(); - break; - case keycode.codes.esc: - case keycode.codes.tab: - this.props.onClose(event); - break; + case keycode.codes.down: + this.focusNext(); + event.preventDefault(); + break; + case keycode.codes.up: + this.focusPrevious(); + event.preventDefault(); + break; + case keycode.codes.esc: + case keycode.codes.tab: + this.props.onClose(event); + break; + default: } } diff --git a/src/InputBase.js b/src/InputBase.js index c5745d3867..c1e193053e 100644 --- a/src/InputBase.js +++ b/src/InputBase.js @@ -76,8 +76,9 @@ class InputBase extends React.Component { let inputGroupClassName; switch (this.props.bsSize) { - case 'small': inputGroupClassName = 'input-group-sm'; break; - case 'large': inputGroupClassName = 'input-group-lg'; break; + case 'small': inputGroupClassName = 'input-group-sm'; break; + case 'large': inputGroupClassName = 'input-group-lg'; break; + default: } return addonBefore || addonAfter || buttonBefore || buttonAfter ? ( @@ -98,10 +99,10 @@ class InputBase extends React.Component { } switch (this.props.bsStyle) { - case 'success': return ; - case 'warning': return ; - case 'error': return ; - default: return ; + case 'success': return ; + case 'warning': return ; + case 'error': return ; + default: return ; } } else { return null; @@ -157,24 +158,24 @@ class InputBase extends React.Component { } switch (this.props.type) { - case 'select': - return ( - - ); - case 'textarea': - return