diff --git a/.eslintrc b/.eslintrc
index 4a437fae5a..629a1d0276 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -16,6 +16,7 @@
"no-underscore-dangle": 0,
"no-unused-vars": [1, { "vars": "all", "args": "none" }],
"no-var": 2,
+ "object-shorthand": 1,
"quotes": [1, "single", "avoid-escape"],
"react/display-name": 0,
"react/jsx-no-undef": 1,
diff --git a/docs/examples/CollapsibleParagraph.js b/docs/examples/CollapsibleParagraph.js
index d917d63f24..c316691d11 100644
--- a/docs/examples/CollapsibleParagraph.js
+++ b/docs/examples/CollapsibleParagraph.js
@@ -1,20 +1,20 @@
const CollapsibleParagraph = React.createClass({
mixins: [CollapsibleMixin],
- getCollapsibleDOMNode: function(){
+ getCollapsibleDOMNode(){
return this.refs.panel.getDOMNode();
},
- getCollapsibleDimensionValue: function(){
+ getCollapsibleDimensionValue(){
return this.refs.panel.getDOMNode().scrollHeight;
},
- onHandleToggle: function(e){
+ onHandleToggle(e){
e.preventDefault();
this.setState({expanded:!this.state.expanded});
},
- render: function(){
+ render(){
let styles = this.getCollapsibleClassSet();
let text = this.isExpanded() ? 'Hide' : 'Show';
return (
diff --git a/docs/src/IntroductionPage.js b/docs/src/IntroductionPage.js
index 810fa65bd3..206c3eecea 100644
--- a/docs/src/IntroductionPage.js
+++ b/docs/src/IntroductionPage.js
@@ -5,7 +5,7 @@ import PageHeader from './PageHeader';
import PageFooter from './PageFooter';
const IntroductionPage = React.createClass({
- render: function () {
+ render() {
return (
diff --git a/docs/src/ReactPlayground.js b/docs/src/ReactPlayground.js
index a88899890d..1d9152678b 100644
--- a/docs/src/ReactPlayground.js
+++ b/docs/src/ReactPlayground.js
@@ -192,7 +192,7 @@ const ReactPlayground = React.createClass({
},
handleCodeModeSwitch(mode) {
- this.setState({mode: mode});
+ this.setState({mode});
},
handleCodeModeToggle(e) {
@@ -209,7 +209,7 @@ const ReactPlayground = React.createClass({
mode = this.MODES.NONE;
}
- this.setState({mode: mode});
+ this.setState({mode});
},
compileCode() {
diff --git a/ie8/server.js b/ie8/server.js
index da4fdd2a7c..3e457a7e30 100644
--- a/ie8/server.js
+++ b/ie8/server.js
@@ -9,7 +9,7 @@ let app = express();
if (development) {
let webpackConfig = webpackConfigBuilder({
- development: development,
+ development,
ie8: true
});
let publicPath = webpackConfig.output.publicPath;
@@ -23,7 +23,7 @@ if (development) {
app = app
.use(webpackMiddleware(webpack(webpackConfig), {
noInfo: false,
- publicPath: publicPath,
+ publicPath,
stats: {
colors: true
}
diff --git a/src/Affix.js b/src/Affix.js
index 0a902a5bfb..9648fa5166 100644
--- a/src/Affix.js
+++ b/src/Affix.js
@@ -5,7 +5,7 @@ import domUtils from './utils/domUtils';
const Affix = React.createClass({
statics: {
- domUtils: domUtils
+ domUtils
},
mixins: [AffixMixin],
diff --git a/src/AffixMixin.js b/src/AffixMixin.js
index 11e1214ee8..b911bad4f4 100644
--- a/src/AffixMixin.js
+++ b/src/AffixMixin.js
@@ -92,7 +92,7 @@ const AffixMixin = {
this.setState({
affixClass: affixType,
- affixPositionTop: affixPositionTop
+ affixPositionTop
});
},
diff --git a/src/Button.js b/src/Button.js
index 27f1fa31e4..e1f9ed2cd4 100644
--- a/src/Button.js
+++ b/src/Button.js
@@ -31,7 +31,7 @@ const Button = React.createClass({
classes = {
active: this.props.active,
'btn-block': this.props.block,
- ...classes
+ ...classes // eslint-disable-line object-shorthand
};
if (this.props.navItem) {
diff --git a/src/Carousel.js b/src/Carousel.js
index afc7ae0b08..a07b6d6aa6 100644
--- a/src/Carousel.js
+++ b/src/Carousel.js
@@ -249,7 +249,7 @@ const Carousel = React.createClass({
active: isActive,
ref: child.ref,
key: child.key ? child.key : index,
- index: index,
+ index,
animateOut: isPreviousActive,
animateIn: isActive && this.state.previousActiveIndex != null && this.props.slide,
direction: this.state.direction,
@@ -278,8 +278,8 @@ const Carousel = React.createClass({
this.setState({
activeIndex: index,
- previousActiveIndex: previousActiveIndex,
- direction: direction
+ previousActiveIndex,
+ direction
});
}
}
diff --git a/src/CollapsibleNav.js b/src/CollapsibleNav.js
index 4f5fa7300d..c6392ef010 100644
--- a/src/CollapsibleNav.js
+++ b/src/CollapsibleNav.js
@@ -98,7 +98,7 @@ const specCollapsibleNav = {
activeKey: this.props.activeKey,
activeHref: this.props.activeHref,
ref: 'nocollapse_' + key,
- key: key,
+ key,
navItem: true
}
);
@@ -114,7 +114,7 @@ const specCollapsibleNav = {
activeHref: this.props.activeHref,
onSelect: createChainedFunction(child.props.onSelect, this.props.onSelect),
ref: 'collapsible_' + key,
- key: key,
+ key,
navItem: true
}
);
diff --git a/src/FadeMixin.js b/src/FadeMixin.js
index 5156153d6b..ddef53e59e 100644
--- a/src/FadeMixin.js
+++ b/src/FadeMixin.js
@@ -56,7 +56,7 @@ export default {
}
},
- componentWillUnmount: function () {
+ componentWillUnmount() {
let els = getElementsAndSelf(React.findDOMNode(this), ['fade']),
container = (this.props.container && React.findDOMNode(this.props.container)) ||
domUtils.ownerDocument(this).body;
diff --git a/src/Input.js b/src/Input.js
index ef48dffe10..d0870481cc 100644
--- a/src/Input.js
+++ b/src/Input.js
@@ -178,7 +178,7 @@ class Input extends React.Component {
renderFormGroup(children) {
if (this.props.type === 'submit') {
- let {bsStyle, ...other} = this.props; /* eslint no-unused-vars: 0 */
+ let {bsStyle, ...other} = this.props; /* eslint no-unused-vars: 0 object-shorthand: 0 */
return
{children};
}
diff --git a/src/Nav.js b/src/Nav.js
index b3097cc9a4..252592efa1 100644
--- a/src/Nav.js
+++ b/src/Nav.js
@@ -37,7 +37,7 @@ const Nav = React.createClass({
return React.findDOMNode(this);
},
- getCollapsibleDimensionValue: function () {
+ getCollapsibleDimensionValue() {
let node = React.findDOMNode(this.refs.ul),
height = node.offsetHeight,
computedStyles = domUtils.getComputedStyles(node);
diff --git a/src/NavItem.js b/src/NavItem.js
index 5364413220..9bc768df48 100644
--- a/src/NavItem.js
+++ b/src/NavItem.js
@@ -29,10 +29,10 @@ const NavItem = React.createClass({
title,
target,
children,
- ...props } = this.props;
+ ...props } = this.props; // eslint-disable-line object-shorthand
let classes = {
- 'active': active,
- 'disabled': disabled
+ active,
+ disabled
};
let linkProps = {
href,
diff --git a/src/OverlayTrigger.js b/src/OverlayTrigger.js
index 88e01b280b..c71bd2213a 100644
--- a/src/OverlayTrigger.js
+++ b/src/OverlayTrigger.js
@@ -216,7 +216,7 @@ const OverlayTrigger = React.createClass({
}
},
- getPosition: function () {
+ getPosition() {
let node = React.findDOMNode(this);
let container = this.getContainerDOMNode();
diff --git a/src/styleMaps.js b/src/styleMaps.js
index 83435899c6..67992ae22d 100644
--- a/src/styleMaps.js
+++ b/src/styleMaps.js
@@ -31,7 +31,7 @@ const styleMaps = {
'tabs': 'tabs',
'pills': 'pills'
},
- addStyle: function(name) {
+ addStyle(name) {
styleMaps.STYLES[name] = name;
},
SIZES: {
diff --git a/src/utils/EventListener.js b/src/utils/EventListener.js
index 3e29560ed4..2c8cf02ff0 100644
--- a/src/utils/EventListener.js
+++ b/src/utils/EventListener.js
@@ -32,18 +32,18 @@ const EventListener = {
* @param {function} callback Callback function.
* @return {object} Object with a `remove` method.
*/
- listen: function(target, eventType, callback) {
+ listen(target, eventType, callback) {
if (target.addEventListener) {
target.addEventListener(eventType, callback, false);
return {
- remove: function() {
+ remove() {
target.removeEventListener(eventType, callback, false);
}
};
} else if (target.attachEvent) {
target.attachEvent('on' + eventType, callback);
return {
- remove: function() {
+ remove() {
target.detachEvent('on' + eventType, callback);
}
};
diff --git a/src/utils/TransitionEvents.js b/src/utils/TransitionEvents.js
index fe21e0d7d8..2e52bf2f30 100644
--- a/src/utils/TransitionEvents.js
+++ b/src/utils/TransitionEvents.js
@@ -88,7 +88,7 @@ function removeEventListener(node, eventName, eventListener) {
}
const ReactTransitionEvents = {
- addEndEventListener: function(node, eventListener) {
+ addEndEventListener(node, eventListener) {
if (endEvents.length === 0) {
// If CSS transitions are not supported, trigger an "end animation"
// event immediately.
@@ -100,7 +100,7 @@ const ReactTransitionEvents = {
});
},
- removeEndEventListener: function(node, eventListener) {
+ removeEndEventListener(node, eventListener) {
if (endEvents.length === 0) {
return;
}
diff --git a/src/utils/ValidComponentChildren.js b/src/utils/ValidComponentChildren.js
index 1585d8f06d..fa4456fde7 100644
--- a/src/utils/ValidComponentChildren.js
+++ b/src/utils/ValidComponentChildren.js
@@ -86,5 +86,5 @@ export default {
map: mapValidComponents,
forEach: forEachValidComponents,
numberOf: numberOfValidComponents,
- hasValidComponent: hasValidComponent
+ hasValidComponent
};
diff --git a/src/utils/domUtils.js b/src/utils/domUtils.js
index d69c292e1f..5ba8e3334d 100644
--- a/src/utils/domUtils.js
+++ b/src/utils/domUtils.js
@@ -114,9 +114,9 @@ function offsetParentFunc(elem) {
}
export default {
- ownerDocument: ownerDocument,
- getComputedStyles: getComputedStyles,
- getOffset: getOffset,
- getPosition: getPosition,
+ ownerDocument,
+ getComputedStyles,
+ getOffset,
+ getPosition,
offsetParent: offsetParentFunc
};
diff --git a/test/BootstrapMixinSpec.js b/test/BootstrapMixinSpec.js
index dea0bac9ce..333870506b 100644
--- a/test/BootstrapMixinSpec.js
+++ b/test/BootstrapMixinSpec.js
@@ -10,7 +10,7 @@ describe('BootstrapMixin', function () {
Component = React.createClass({
mixins: [BootstrapMixin],
- render: function () {
+ render() {
return React.DOM.button(this.props);
}
});
diff --git a/test/CollapsableMixinSpec.js b/test/CollapsableMixinSpec.js
index 4e1dd76f77..f3480f9634 100644
--- a/test/CollapsableMixinSpec.js
+++ b/test/CollapsableMixinSpec.js
@@ -12,15 +12,15 @@ describe('CollapsableMixin', function () {
Component = React.createClass({
mixins: [CollapsableMixin],
- getCollapsableDOMNode: function(){
+ getCollapsableDOMNode(){
return this.refs.panel.getDOMNode();
},
- getCollapsableDimensionValue: function(){
+ getCollapsableDimensionValue(){
return 15;
},
- render: function(){
+ render(){
let styles = this.getCollapsableClassSet();
return (
diff --git a/test/CollapsableNavSpec.js b/test/CollapsableNavSpec.js
index 99b1d13ae6..2940bab513 100644
--- a/test/CollapsableNavSpec.js
+++ b/test/CollapsableNavSpec.js
@@ -8,7 +8,7 @@ import {shouldWarn} from './helpers';
describe('Deprecations for collapsable property in CollapsibleNav', function () {
it('Should not warn about deprecation when collaps_i_ble property is used', function () {
let Component = React.createClass({
- render: function() {
+ render() {
return (
);
@@ -21,7 +21,7 @@ describe('Deprecations for collapsable property in CollapsibleNav', function ()
it('Should warn about deprecation when collaps_a_ble property is used', function () {
let Component = React.createClass({
- render: function() {
+ render() {
return (
);
@@ -36,7 +36,7 @@ describe('Deprecations for collapsable property in CollapsibleNav', function ()
describe('Deprecations for collapsable property in Panel', function () {
it('Should not warn about deprecation when collaps_i_ble property is used', function () {
let Component = React.createClass({
- render: function() {
+ render() {
return (
);
@@ -49,7 +49,7 @@ describe('Deprecations for collapsable property in Panel', function () {
it('Should warn about deprecation when collaps_a_ble property is used', function () {
let Component = React.createClass({
- render: function() {
+ render() {
return (
);
@@ -64,7 +64,7 @@ describe('Deprecations for collapsable property in Panel', function () {
describe('Deprecations for collapsable property in Nav', function () {
it('Should not warn about deprecation when collaps_i_ble property is used', function () {
let Component = React.createClass({
- render: function() {
+ render() {
return (
);
@@ -77,7 +77,7 @@ describe('Deprecations for collapsable property in Nav', function () {
it('Should warn about deprecation when collaps_a_ble property is used', function () {
let Component = React.createClass({
- render: function() {
+ render() {
return (
);
diff --git a/test/CollapsibleMixinSpec.js b/test/CollapsibleMixinSpec.js
index c4e0599c64..3cafc25d01 100644
--- a/test/CollapsibleMixinSpec.js
+++ b/test/CollapsibleMixinSpec.js
@@ -12,15 +12,15 @@ describe('CollapsibleMixin', function () {
Component = React.createClass({
mixins: [CollapsibleMixin],
- getCollapsibleDOMNode: function(){
+ getCollapsibleDOMNode(){
return this.refs.panel.getDOMNode();
},
- getCollapsibleDimensionValue: function(){
+ getCollapsibleDimensionValue(){
return 15;
},
- render: function(){
+ render(){
let styles = this.getCollapsibleClassSet();
return (
@@ -222,9 +222,9 @@ describe('CollapsibleMixin', function () {
Component = React.createClass({
mixins: [CollapsibleMixin],
- getCollapsableDimension: function(){},
+ getCollapsableDimension(){},
- render: function(){
+ render(){
return (
);
}
});
@@ -241,9 +241,9 @@ describe('CollapsibleMixin', function () {
Component = React.createClass({
mixins: [CollapsibleMixin],
- getCollapsibleDimension: function(){},
+ getCollapsibleDimension(){},
- render: function(){
+ render(){
return (
);
}
});
diff --git a/test/CollapsibleNavSpec.js b/test/CollapsibleNavSpec.js
index e7396ff93b..4b5a350bd2 100644
--- a/test/CollapsibleNavSpec.js
+++ b/test/CollapsibleNavSpec.js
@@ -8,7 +8,7 @@ import NavItem from '../src/NavItem';
describe('CollapsibleNav', function () {
it('Should create div and add collapse class', function () {
let Parent = React.createClass({
- render: function() {
+ render() {
return (
@@ -27,7 +27,7 @@ describe('CollapsibleNav', function () {
it('Should handle multiple Nav elements', function () {
let Parent = React.createClass({
- render: function() {
+ render() {
return (
@@ -51,7 +51,7 @@ describe('CollapsibleNav', function () {
it('Should just render children and move along if not in ', function () {
let Parent = React.createClass({
- render: function() {
+ render() {
return (