Skip to content

Commit

Permalink
tests: add and follow eslint rules (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo Arias authored Apr 23, 2018
1 parent a3d4256 commit b7624da
Show file tree
Hide file tree
Showing 8 changed files with 258 additions and 72 deletions.
52 changes: 52 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"extends" : [
"standard",
"plugin:promise/recommended",
"plugin:react/recommended"
],
"plugins": [
"promise"
],
"env": {
"browser" : true,
"node" : true,
"mocha" : true,
"jest" : true
},
"globals" : {
"artifacts": false,
"contract": false,
"assert": false,
"web3": false
},
"rules": {

// Strict mode
"strict": [2, "global"],

// Code style
"indent": [2, 2],
"quotes": [2, "single"],
"semi": ["error", "always"],
"space-before-function-paren": ["error", "always"],
"no-use-before-define": 0,
"eqeqeq": [2, "smart"],
"dot-notation": [2, {"allowKeywords": true, "allowPattern": ""}],
"no-redeclare": [2, {"builtinGlobals": true}],
"no-trailing-spaces": [2, { "skipBlankLines": true }],
"eol-last": 1,
"comma-spacing": [2, {"before": false, "after": true}],
"camelcase": [2, {"properties": "always"}],
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
"comma-dangle": [1, "always-multiline"],
"no-dupe-args": 2,
"no-dupe-keys": 2,
"no-debugger": 0,
"no-undef": 2,
"object-curly-spacing": [2, "always"],
"max-len": [2, 120, 2],
"generator-star-spacing": ["error", "before"],
"promise/avoid-new": 0,
"promise/always-return": 0
}
}
212 changes: 169 additions & 43 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
"chai-bignumber": "^2.0.2",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"eslint-config-standard": "^11.0.0",
"eslint-plugin-import": "^2.11.0",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-promise": "^3.7.0",
"eslint-plugin-standard": "^3.0.1",
"jsdom": "^11.7.0",
"mocha": "^5.0.5",
"redux-test-utils": "^0.2.2",
Expand All @@ -40,6 +45,9 @@
"test:react": "mocha test/react --require babel-core/register --require test/react/setup.js",
"eject": "react-scripts eject",
"lint:sol": "solium -d contracts",
"lint:sol:fix": "solium -d contracts --fix"
"lint:sol:fix": "solium -d contracts --fix",
"lint:js": "eslint .",
"lint:js:fix": "eslint . --fix",
"lint": "npm run lint:sol && npm run lint:js"
}
}
12 changes: 6 additions & 6 deletions src/components/Alert.react.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { connect } from 'react-redux'
import AlertActions from '../actions/alerts'
import React from 'react';
import { connect } from 'react-redux';
import AlertActions from '../actions/alerts';

class Alert extends React.Component {

Expand All @@ -10,7 +10,7 @@ class Alert extends React.Component {
<div>
<p>{alert.message} <span onClick={this._cleanAlert}>x</span>
</p>
</div>
</div>;
}

_cleanAlert(e) {
Expand All @@ -20,10 +20,10 @@ class Alert extends React.Component {
}

function mapStateToProps({ alert }) {
return { alert }
return { alert };
}

export default connect(
mapStateToProps,
AlertActions
)(Alert)
)(Alert);
Loading

0 comments on commit b7624da

Please sign in to comment.