diff --git a/examples/basic/app.js b/examples/basic/app.js
index 9d9282d..7fdf7eb 100644
--- a/examples/basic/app.js
+++ b/examples/basic/app.js
@@ -1,7 +1,7 @@
import React from 'react';
import FlipCard from '../../lib/main';
-var App = React.createClass({
+let App = React.createClass({
getInitialState() {
return {
isFlipped: false
@@ -54,7 +54,7 @@ var App = React.createClass({
Back
-
+
{/*
The `disabled` attribute allows turning off the auto-flip
on hover, or focus. This allows manual control over flipping.
diff --git a/lib/components/FlipCard.js b/lib/components/FlipCard.js
index db9a2be..bda421f 100644
--- a/lib/components/FlipCard.js
+++ b/lib/components/FlipCard.js
@@ -16,7 +16,7 @@ export default React.createClass({
onFlip: PropTypes.func,
onKeyDown: PropTypes.func,
children(props, propName, componentName) {
- var prop = props[propName];
+ let prop = props[propName];
if (React.Children.count(prop) !== 2) {
return new Error(
@@ -52,7 +52,7 @@ export default React.createClass({
setTimeout(() => {
this.setState({
isFlipped: newProps.flipped
- })
+ });
}, 0);
},
@@ -68,7 +68,7 @@ export default React.createClass({
// If isFlipped has changed need to notify
if (this.state.isFlipped !== nextState.isFlipped) {
this.notifyFlip = true;
- }
+ }
},
componentDidUpdate() {
@@ -82,6 +82,7 @@ export default React.createClass({
this.focusElement = null;
}
// Direct focus to the back if needed
+ /* eslint brace-style:0 */
else if (this.focusBack) {
this.refs.back.getDOMNode().focus();
this.focusBack = false;
@@ -139,7 +140,7 @@ export default React.createClass({
}
},
- render() {
+ render() {
return (
);
}, TypeError);
});
- it('should flip vertically', function () {
- var card = TestUtils.renderIntoDocument(
+ it('should flip vertically', function() {
+ let card = TestUtils.renderIntoDocument(
foo
bar
@@ -20,9 +21,9 @@ describe('react-flipcard', function () {
equal(card.getDOMNode().classList.contains('ReactFlipCard--vertical'), true);
equal(card.getDOMNode().classList.contains('ReactFlipCard--horizontal'), false);
});
-
- it('should flip horizontally by default', function () {
- var card = TestUtils.renderIntoDocument(
+
+ it('should flip horizontally by default', function() {
+ let card = TestUtils.renderIntoDocument(
foo
bar
@@ -32,8 +33,8 @@ describe('react-flipcard', function () {
equal(card.getDOMNode().classList.contains('ReactFlipCard--horizontal'), true);
});
- it('should default to enabled', function () {
- var card = TestUtils.renderIntoDocument(
+ it('should default to enabled', function() {
+ let card = TestUtils.renderIntoDocument(
foo
bar
@@ -41,9 +42,9 @@ describe('react-flipcard', function () {
);
equal(card.getDOMNode().classList.contains('ReactFlipCard--enabled'), true);
});
-
- it('should allow disabling', function () {
- var card = TestUtils.renderIntoDocument(
+
+ it('should allow disabling', function() {
+ let card = TestUtils.renderIntoDocument(
foo
bar
@@ -51,7 +52,7 @@ describe('react-flipcard', function () {
);
equal(card.getDOMNode().classList.contains('ReactFlipCard--enabled'), false);
});
-
+
// TODO: Why doesn't this work?
// it('should call onFlip', function (done) {
// var called = false;
diff --git a/lib/helpers/classSet.js b/lib/helpers/classSet.js
index 9226c35..7223186 100644
--- a/lib/helpers/classSet.js
+++ b/lib/helpers/classSet.js
@@ -1,9 +1,11 @@
module.exports = function classSet(classNames) {
- if (typeof classNames == 'object') {
- return Object.keys(classNames).filter(function(className) {
+ let result = null;
+ if (typeof classNames === 'object') {
+ result = Object.keys(classNames).filter((className) => {
return classNames[className];
}).join(' ');
} else {
- return Array.prototype.join.call(arguments, ' ');
+ result = Array.prototype.join.call(arguments, ' ');
}
+ return result;
};
diff --git a/lib/helpers/contains.js b/lib/helpers/contains.js
index 2d03372..1f173bf 100644
--- a/lib/helpers/contains.js
+++ b/lib/helpers/contains.js
@@ -1,4 +1,5 @@
// Checks to see if a parent element contains a child element
+/* eslint no-param-reassign:0, no-cond-assign:0 */
module.exports = function contains(parent, child) {
do {
if (parent === child) {
diff --git a/lib/helpers/injectStyle.js b/lib/helpers/injectStyle.js
index bc76b49..80a4dfb 100644
--- a/lib/helpers/injectStyle.js
+++ b/lib/helpers/injectStyle.js
@@ -1,4 +1,4 @@
-var CSS = `
+const CSS = `
.ReactFlipCard {
-webkit-perspective: 1000;
-moz-perspective: 1000;
@@ -7,8 +7,8 @@ var CSS = `
-ms-transform: perspective(1000px);
-moz-transform: perspective(1000px);
- -moz-transform-style: preserve-3d;
- -ms-transform-style: preserve-3d;
+ -moz-transform-style: preserve-3d;
+ -ms-transform-style: preserve-3d;
display: inline-block;
}
@@ -30,7 +30,7 @@ var CSS = `
-ms-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
-}
+}
/* END: Accommodating for IE */
.ReactFlipCard__Flipper {
@@ -138,13 +138,13 @@ var CSS = `
/* END: Accommodating for IE */
`;
-export default function () {
- var style = document.getElementById('react-flipcard-style');
+export default function() {
+ let style = document.getElementById('react-flipcard-style');
if (!style) {
style = document.createElement('style');
style.setAttribute('id', 'react-flipcard-style');
- var head = document.querySelector('head');
+ let head = document.querySelector('head');
head.insertBefore(style, head.firstChild);
}
style.innerHTML = CSS;
-};
+}
diff --git a/package.json b/package.json
index 8bfaba2..f90a416 100644
--- a/package.json
+++ b/package.json
@@ -4,8 +4,8 @@
"description": "React flip card component",
"main": "lib/main.js",
"scripts": {
- "test": "rackt test --ci --browsers Firefox",
- "start": "rackt dev"
+ "test": "rackt test --single-run --browsers Firefox",
+ "start": "rackt server"
},
"repository": {
"type": "git",
@@ -21,10 +21,10 @@
},
"homepage": "https://github.com/mzabriskie/react-flipcard",
"devDependencies": {
- "rackt-cli": "^0.3.2",
+ "rackt-cli": "^0.4.0",
"react": "^0.13.3"
},
"peerDependencies": {
"react": "^0.13.3"
}
-}
\ No newline at end of file
+}