Skip to content

Commit 9352546

Browse files
committed
Merge pull request react-bootstrap#832 from AlexKVal/commaStyle
Impose comma and one-var styles.
2 parents d49ce21 + 55802fd commit 9352546

File tree

6 files changed

+27
-25
lines changed

6 files changed

+27
-25
lines changed

Diff for: .eslintrc

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
],
1313
"rules": {
1414
"comma-spacing": 2,
15+
"comma-style": [2, "last"],
16+
"one-var": [2, { "initialized": "never" }],
1517
"key-spacing": 0,
1618
"no-underscore-dangle": 0,
1719
"no-unused-vars": [2, { "vars": "all", "args": "none" }],

Diff for: docs/src/ComponentsPage.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ const ComponentsPage = React.createClass({
3030
},
3131

3232
componentDidMount() {
33-
let elem = React.findDOMNode(this.refs.sideNav),
34-
domUtils = Affix.domUtils,
35-
sideNavOffsetTop = domUtils.getOffset(elem).top,
36-
sideNavMarginTop = parseInt(domUtils.getComputedStyles(elem.firstChild).marginTop, 10),
37-
topNavHeight = React.findDOMNode(this.refs.topNav).offsetHeight;
33+
let elem = React.findDOMNode(this.refs.sideNav);
34+
let domUtils = Affix.domUtils;
35+
let sideNavOffsetTop = domUtils.getOffset(elem).top;
36+
let sideNavMarginTop = parseInt(domUtils.getComputedStyles(elem.firstChild).marginTop, 10);
37+
let topNavHeight = React.findDOMNode(this.refs.topNav).offsetHeight;
3838

3939
this.setState({
4040
navOffsetTop: sideNavOffsetTop - topNavHeight - sideNavMarginTop,

Diff for: src/CollapsibleNav.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ const CollapsibleNav = React.createClass({
2929
for (let key in nodes) {
3030
if (nodes.hasOwnProperty(key)) {
3131

32-
let n = React.findDOMNode(nodes[key])
33-
, h = n.offsetHeight
34-
, computedStyles = domUtils.getComputedStyles(n);
32+
let n = React.findDOMNode(nodes[key]);
33+
let h = n.offsetHeight;
34+
let computedStyles = domUtils.getComputedStyles(n);
3535

3636
height += (h +
3737
parseInt(computedStyles.marginTop, 10) +

Diff for: src/FadeMixin.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ export default {
5757
},
5858

5959
componentWillUnmount() {
60-
let els = getElementsAndSelf(React.findDOMNode(this), ['fade']),
61-
container = (this.props.container && React.findDOMNode(this.props.container)) ||
60+
let els = getElementsAndSelf(React.findDOMNode(this), ['fade']);
61+
let container = (this.props.container && React.findDOMNode(this.props.container)) ||
6262
domUtils.ownerDocument(this).body;
6363

6464
if (els.length) {

Diff for: src/Nav.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ const Nav = React.createClass({
3636
},
3737

3838
getCollapsibleDimensionValue() {
39-
let node = React.findDOMNode(this.refs.ul),
40-
height = node.offsetHeight,
41-
computedStyles = domUtils.getComputedStyles(node);
39+
let node = React.findDOMNode(this.refs.ul);
40+
let height = node.offsetHeight;
41+
let computedStyles = domUtils.getComputedStyles(node);
4242

4343
return height + parseInt(computedStyles.marginTop, 10) + parseInt(computedStyles.marginBottom, 10);
4444
},

Diff for: test/PanelSpec.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,21 @@ describe('Panel', function () {
3636
});
3737

3838
it('Should have custom component header', function () {
39-
let header = <h3>Heading</h3>,
40-
instance = ReactTestUtils.renderIntoDocument(
41-
<Panel header={header}>Panel content</Panel>
42-
);
39+
let header = <h3>Heading</h3>;
40+
let instance = ReactTestUtils.renderIntoDocument(
41+
<Panel header={header}>Panel content</Panel>
42+
);
4343
header = React.findDOMNode(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'panel-heading'));
4444
assert.equal(header.firstChild.nodeName, 'H3');
4545
assert.ok(header.firstChild.className.match(/\bpanel-title\b/));
4646
assert.equal(header.firstChild.innerHTML, 'Heading');
4747
});
4848

4949
it('Should have custom component header with anchor', function () {
50-
let header = <h3>Heading</h3>,
51-
instance = ReactTestUtils.renderIntoDocument(
52-
<Panel header={header} collapsible={true}>Panel content</Panel>
53-
);
50+
let header = <h3>Heading</h3>;
51+
let instance = ReactTestUtils.renderIntoDocument(
52+
<Panel header={header} collapsible={true}>Panel content</Panel>
53+
);
5454
header = React.findDOMNode(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'panel-heading'));
5555
assert.equal(header.firstChild.nodeName, 'H3');
5656
assert.ok(header.firstChild.className.match(/\bpanel-title\b/));
@@ -59,10 +59,10 @@ describe('Panel', function () {
5959
});
6060

6161
it('Should have custom component header with custom class', function () {
62-
let header = <h3 className="custom-class">Heading</h3>,
63-
instance = ReactTestUtils.renderIntoDocument(
64-
<Panel header={header}>Panel content</Panel>
65-
);
62+
let header = <h3 className="custom-class">Heading</h3>;
63+
let instance = ReactTestUtils.renderIntoDocument(
64+
<Panel header={header}>Panel content</Panel>
65+
);
6666
header = React.findDOMNode(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'panel-heading'));
6767
assert.equal(header.firstChild.nodeName, 'H3');
6868
assert.ok(header.firstChild.className.match(/\bpanel-title\b/));

0 commit comments

Comments
 (0)