Skip to content

Commit

Permalink
Updated eslint plugins and improve code style
Browse files Browse the repository at this point in the history
  • Loading branch information
igorprado committed Sep 2, 2016
1 parent 36aea23 commit 3e15cf8
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 41 deletions.
22 changes: 14 additions & 8 deletions .eslintrc
Expand Up @@ -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,
Expand All @@ -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"],
Expand All @@ -42,6 +47,7 @@
"no-else-return": 0,
"no-console": 0,
"no-throw-literal": 0,
"id-length": 0
"id-length": 0,
"max-len": 0
}
}
15 changes: 8 additions & 7 deletions package.json
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
28 changes: 15 additions & 13 deletions src/NotificationItem.jsx
Expand Up @@ -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({
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -283,7 +285,7 @@ var NotificationItem = React.createClass({
if (notification.message) {
if (this.props.allowHTML) {
message = (
<div className="notification-message" style={ this._styles.messageWrapper } dangerouslySetInnerHTML={ this._allowHTML(notification.message) }></div>
<div className="notification-message" style={ this._styles.messageWrapper } dangerouslySetInnerHTML={ this._allowHTML(notification.message) } />
);
} else {
message = (
Expand Down
28 changes: 15 additions & 13 deletions src/NotificationSystem.jsx
Expand Up @@ -186,20 +186,22 @@ var NotificationSystem = React.createClass({
return position === notification.position;
});

if (_notifications.length) {
return (
<NotificationContainer
ref={ 'container-' + position }
key={ position }
position={ position }
notifications={ _notifications }
getStyles={ self._getStyles }
onRemove={ self._didNotificationRemoved }
noAnimation={ self.props.noAnimation }
allowHTML={ self.props.allowHTML }
/>
);
if (!_notifications.length) {
return null;
}

return (
<NotificationContainer
ref={ 'container-' + position }
key={ position }
position={ position }
notifications={ _notifications }
getStyles={ self._getStyles }
onRemove={ self._didNotificationRemoved }
noAnimation={ self.props.noAnimation }
allowHTML={ self.props.allowHTML }
/>
);
});
}

Expand Down

0 comments on commit 3e15cf8

Please sign in to comment.