Skip to content

Commit

Permalink
Lint harder
Browse files Browse the repository at this point in the history
  • Loading branch information
nkbt committed Aug 6, 2017
1 parent 8b220a4 commit 65ec99e
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"extends": "airbnb",
"parser": "babel-eslint",
"env": {
"browser": true
},
"plugins": [
"babel"
],
Expand Down
6 changes: 5 additions & 1 deletion example/App/Hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export class Hooks extends React.PureComponent {
this.setState({isResting: true});
};

onRef = ref => {
this.ref = ref;
};

render() {
const {isOpened, height, width, paragraphs} = this.state;

Expand Down Expand Up @@ -82,7 +86,7 @@ export class Hooks extends React.PureComponent {
<label className="label">
resting: {this.state.isResting ? 'true' : 'false'}
</label>
<label className="label" ref={ref => (this.ref = ref)} />
<label className="label" ref={this.onRef} />
</div>
<Collapse
isOpened={isOpened}
Expand Down
4 changes: 3 additions & 1 deletion example/App/Issue59.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/* eslint-disable jsx-a11y/no-static-element-interactions */
import React from 'react';
import {Collapse} from '../../src';


const styles = {
ba: {
borderWidth: '1px',
borderStyle: 'solid'
borderStyle: 'solid',
cursor: 'pointer'
},
mb3: {
marginBottom: '1rem'
Expand Down
8 changes: 4 additions & 4 deletions example/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const App = () => (

<section className="section">
<h2>
<a target="_blank" href="https://github.com/nkbt/react-collapse/issues/40">40</a>.
<a target="_blank" rel="noopener noreferrer" href="https://github.com/nkbt/react-collapse/issues/40">40</a>.
Re-render nested components
</h2>
<Issue40 />
Expand All @@ -82,15 +82,15 @@ export const App = () => (

<section className="section">
<h2>
<a target="_blank" href="https://github.com/nkbt/react-collapse/issues/59">59</a>.
<a target="_blank" rel="noopener noreferrer" href="https://github.com/nkbt/react-collapse/issues/59">59</a>.
Instantly collapses if re-rendered during collapse
</h2>
<Issue59 />
</section>

<section className="section">
<h2>
<a target="_blank" href="https://github.com/nkbt/react-collapse/issues/66">66</a>.
<a target="_blank" rel="noopener noreferrer" href="https://github.com/nkbt/react-collapse/issues/66">66</a>.
Unnecessary unmount with keepCollapsedContent
</h2>
<p>Opened by default</p>
Expand All @@ -101,7 +101,7 @@ export const App = () => (

<section className="section">
<h2>
<a target="_blank" href="https://github.com/nkbt/react-collapse/issues/163">163</a>.
<a target="_blank" rel="noopener noreferrer" href="https://github.com/nkbt/react-collapse/issues/163">163</a>.
Overflow in collapse
</h2>
<Issue163 />
Expand Down
9 changes: 5 additions & 4 deletions src/Collapse.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react/no-did-update-set-state,react/no-did-mount-set-state */
import React from 'react';
import PropTypes from 'prop-types';
import {Motion, spring} from 'react-motion';
Expand Down Expand Up @@ -40,6 +41,7 @@ export class Collapse extends React.PureComponent {


static defaultProps = {
springConfig: {},
forceInitialAnimation: false,
hasNestedCollapse: false,
fixedHeight: -1,
Expand Down Expand Up @@ -219,10 +221,9 @@ export class Collapse extends React.PureComponent {

render() {
return (
<Motion
{...this.getMotionProps()}
onRest={this.onRest}
children={this.renderContent} />
<Motion {...this.getMotionProps()} onRest={this.onRest}>
{this.renderContent}
</Motion>
);
}
}
4 changes: 4 additions & 0 deletions src/UnmountClosed.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export class UnmountClosed extends React.PureComponent {
onRest: PropTypes.func
};

static defaultProps = {
onRest: undefined
};

constructor(props) {
super(props);
this.state = {
Expand Down

0 comments on commit 65ec99e

Please sign in to comment.