diff --git a/.eslintrc b/.eslintrc index 9667e02..6b0a502 100644 --- a/.eslintrc +++ b/.eslintrc @@ -7,14 +7,17 @@ "mocha": true }, "plugins": [ - "react" + "react", + "import" ], - "ecmaFeatures": { - "modules": true, - "jsx": true + "parserOptions": { + "ecmaFeatures": { + "modules": true, + "jsx": true + } }, "rules": { - "react/display-name": [2, { "acceptTranspilerName": true }], + "react/display-name": 2, "react/jsx-curly-spacing": [2, "always"], "react/jsx-no-duplicate-props": 2, "react/jsx-no-undef": 2, @@ -26,11 +29,13 @@ "react/no-unknown-property": 2, "react/prop-types": 2, "react/react-in-jsx-scope": 2, - "react/require-extension": 2, "react/self-closing-comp": 2, - "react/wrap-multilines": 2, + "react/jsx-wrap-multilines": 2, "react/sort-comp": 0, + "import/extensions": 2, + + "space-before-function-paren": 0, "quotes": [2, "single", "avoid-escape"], "jsx-quotes": [2, "prefer-double"], "comma-dangle": [2, "never"], @@ -42,6 +47,7 @@ "no-else-return": 0, "no-console": 0, "no-throw-literal": 0, - "id-length": 0 + "id-length": 0, + "max-len": 0 } } diff --git a/package.json b/package.json index c508757..e89162c 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "build": "jsx -x jsx ./src ./dist & jsx ./src ./dist", "lint": "eslint src --ext .jsx,.js", "start": "NODE_ENV=development node devServer.js", - "build-example": "rimraf example/build/ && webpack --stats --config webpack.config.prod.js" + "build:example": "rimraf example/build/ && webpack --stats --config webpack.config.prod.js" }, "repository": { "type": "git", @@ -41,15 +41,17 @@ "devDependencies": { "autoprefixer-loader": "^3.1.0", "babel-core": "^6.14.0", - "babel-eslint": "^4.1.3", + "babel-eslint": "^6.1.2", "babel-loader": "^6.2.5", "babel-plugin-react-class-display-name": "^0.1.0", "babel-plugin-react-transform": "^2.0.2", "babel-preset-airbnb": "^2.0.0", - "css-loader": "^0.19.0", - "eslint": "1.9.0", - "eslint-config-airbnb": "^0.1.0", - "eslint-plugin-react": "^3.5.1", + "css-loader": "^0.24.0", + "eslint": "3.4.0", + "eslint-config-airbnb": "^10.0.1", + "eslint-plugin-import": "^1.14.0", + "eslint-plugin-jsx-a11y": "^2.2.1", + "eslint-plugin-react": "^6.2.0", "expect": "^1.12.1", "express": "^4.13.3", "extract-text-webpack-plugin": "^0.8.2", @@ -68,7 +70,6 @@ "karma-webpack": "^1.7.0", "mocha": "^2.3.3", "node-sass": "^3.3.3", - "npm": "^3.3.6", "react": "^15.0.0", "react-addons-test-utils": "^15.0.0", "react-dom": "^15.0.0", diff --git a/src/NotificationItem.jsx b/src/NotificationItem.jsx index 2db3eff..f0020df 100644 --- a/src/NotificationItem.jsx +++ b/src/NotificationItem.jsx @@ -6,20 +6,22 @@ var merge = require('object-assign'); /* From Modernizr */ var whichTransitionEvent = function() { - var t; var el = document.createElement('fakeelement'); + var transition; var transitions = { - 'transition': 'transitionend', - 'OTransition': 'oTransitionEnd', - 'MozTransition': 'transitionend', - 'WebkitTransition': 'webkitTransitionEnd' + transition: 'transitionend', + OTransition: 'oTransitionEnd', + MozTransition: 'transitionend', + WebkitTransition: 'webkitTransitionEnd' }; - for (t in transitions) { - if (el.style[t] !== undefined) { - return transitions[t]; + Object.keys(transitions).forEach(function(transitionKey) { + if (el.style[transitionKey] !== undefined) { + transition = transitions[transitionKey]; } - } + }); + + return transition; }; var NotificationItem = React.createClass({ @@ -247,13 +249,13 @@ var NotificationItem = React.createClass({ var message = null; if (this.state.visible) { - className = className + ' notification-visible'; + className += ' notification-visible'; } else { - className = className + ' notification-hidden'; + className += ' notification-hidden'; } if (!notification.dismissible) { - className = className + ' notification-not-dismissible'; + className += ' notification-not-dismissible'; } if (this.props.getStyles.overrideStyle) { @@ -283,7 +285,7 @@ var NotificationItem = React.createClass({ if (notification.message) { if (this.props.allowHTML) { message = ( -
+
); } else { message = ( diff --git a/src/NotificationSystem.jsx b/src/NotificationSystem.jsx index fc820c6..9b299fd 100644 --- a/src/NotificationSystem.jsx +++ b/src/NotificationSystem.jsx @@ -186,20 +186,22 @@ var NotificationSystem = React.createClass({ return position === notification.position; }); - if (_notifications.length) { - return ( - - ); + if (!_notifications.length) { + return null; } + + return ( + + ); }); }