Skip to content

Commit 1181c55

Browse files
committed
Merge pull request react-bootstrap#638 from AlexKVal/object-shorthand
Add new ealint `object-shorthand` rule.
2 parents 3017b18 + 02a8764 commit 1181c55

32 files changed

+73
-72
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"no-underscore-dangle": 0,
1717
"no-unused-vars": [1, { "vars": "all", "args": "none" }],
1818
"no-var": 2,
19+
"object-shorthand": 1,
1920
"quotes": [1, "single", "avoid-escape"],
2021
"react/display-name": 0,
2122
"react/jsx-no-undef": 1,

docs/examples/CollapsibleParagraph.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
const CollapsibleParagraph = React.createClass({
22
mixins: [CollapsibleMixin],
33

4-
getCollapsibleDOMNode: function(){
4+
getCollapsibleDOMNode(){
55
return this.refs.panel.getDOMNode();
66
},
77

8-
getCollapsibleDimensionValue: function(){
8+
getCollapsibleDimensionValue(){
99
return this.refs.panel.getDOMNode().scrollHeight;
1010
},
1111

12-
onHandleToggle: function(e){
12+
onHandleToggle(e){
1313
e.preventDefault();
1414
this.setState({expanded:!this.state.expanded});
1515
},
1616

17-
render: function(){
17+
render(){
1818
let styles = this.getCollapsibleClassSet();
1919
let text = this.isExpanded() ? 'Hide' : 'Show';
2020
return (

docs/src/IntroductionPage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import PageHeader from './PageHeader';
55
import PageFooter from './PageFooter';
66

77
const IntroductionPage = React.createClass({
8-
render: function () {
8+
render() {
99
return (
1010
<div>
1111
<NavMain activePage="introduction" />

docs/src/ReactPlayground.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ const ReactPlayground = React.createClass({
192192
},
193193

194194
handleCodeModeSwitch(mode) {
195-
this.setState({mode: mode});
195+
this.setState({mode});
196196
},
197197

198198
handleCodeModeToggle(e) {
@@ -209,7 +209,7 @@ const ReactPlayground = React.createClass({
209209
mode = this.MODES.NONE;
210210
}
211211

212-
this.setState({mode: mode});
212+
this.setState({mode});
213213
},
214214

215215
compileCode() {

ie8/server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let app = express();
99

1010
if (development) {
1111
let webpackConfig = webpackConfigBuilder({
12-
development: development,
12+
development,
1313
ie8: true
1414
});
1515
let publicPath = webpackConfig.output.publicPath;
@@ -23,7 +23,7 @@ if (development) {
2323
app = app
2424
.use(webpackMiddleware(webpack(webpackConfig), {
2525
noInfo: false,
26-
publicPath: publicPath,
26+
publicPath,
2727
stats: {
2828
colors: true
2929
}

src/Affix.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import domUtils from './utils/domUtils';
55

66
const Affix = React.createClass({
77
statics: {
8-
domUtils: domUtils
8+
domUtils
99
},
1010

1111
mixins: [AffixMixin],

src/AffixMixin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ const AffixMixin = {
9292

9393
this.setState({
9494
affixClass: affixType,
95-
affixPositionTop: affixPositionTop
95+
affixPositionTop
9696
});
9797
},
9898

src/Button.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const Button = React.createClass({
3131
classes = {
3232
active: this.props.active,
3333
'btn-block': this.props.block,
34-
...classes
34+
...classes // eslint-disable-line object-shorthand
3535
};
3636

3737
if (this.props.navItem) {

src/Carousel.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ const Carousel = React.createClass({
249249
active: isActive,
250250
ref: child.ref,
251251
key: child.key ? child.key : index,
252-
index: index,
252+
index,
253253
animateOut: isPreviousActive,
254254
animateIn: isActive && this.state.previousActiveIndex != null && this.props.slide,
255255
direction: this.state.direction,
@@ -278,8 +278,8 @@ const Carousel = React.createClass({
278278

279279
this.setState({
280280
activeIndex: index,
281-
previousActiveIndex: previousActiveIndex,
282-
direction: direction
281+
previousActiveIndex,
282+
direction
283283
});
284284
}
285285
}

src/CollapsibleNav.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const specCollapsibleNav = {
9898
activeKey: this.props.activeKey,
9999
activeHref: this.props.activeHref,
100100
ref: 'nocollapse_' + key,
101-
key: key,
101+
key,
102102
navItem: true
103103
}
104104
);
@@ -114,7 +114,7 @@ const specCollapsibleNav = {
114114
activeHref: this.props.activeHref,
115115
onSelect: createChainedFunction(child.props.onSelect, this.props.onSelect),
116116
ref: 'collapsible_' + key,
117-
key: key,
117+
key,
118118
navItem: true
119119
}
120120
);

0 commit comments

Comments
 (0)