Skip to content

Commit 52a3ade

Browse files
committed
add eslint and mochacli tasks, default watch task, fix tests
1 parent 1699460 commit 52a3ade

File tree

9 files changed

+217
-168
lines changed

9 files changed

+217
-168
lines changed

.eslintrc

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
},
1010
"rules": {
1111
"curly": 0,
12+
"eqeqeq": 0,
1213
"quotes": 0,
1314
"strict": 0
1415
}

Gruntfile.js

+30-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,37 @@ module.exports = function(grunt) {
1212
"lib/debugAbi.js": "src/debugAbi.js"
1313
}
1414
}
15+
},
16+
eslint: {
17+
options: {
18+
configFile: '.eslintrc'
19+
},
20+
target: ['Gruntfile.js', 'src/*.js']
21+
},
22+
mochacli: {
23+
options: {
24+
bail: true
25+
},
26+
all: ['test/*.js']
27+
},
28+
watch: {
29+
src: {
30+
files: ["src/*.js"],
31+
tasks: ["eslint", "babel"],
32+
options: {
33+
spawn: false
34+
}
35+
}
1536
}
1637
});
38+
1739
grunt.loadNpmTasks('grunt-babel');
18-
grunt.registerTask("default", ["babel"]);
40+
grunt.loadNpmTasks('grunt-eslint');
41+
grunt.loadNpmTasks('grunt-mocha-cli');
42+
grunt.loadNpmTasks('grunt-contrib-watch');
43+
44+
grunt.registerTask("lint", ["eslint"]);
45+
grunt.registerTask("build", ["eslint", "babel"]);
46+
grunt.registerTask('test', ["build", 'mochacli']);
47+
grunt.registerTask("default", ["build", "watch:src"]);
1948
};

lib/btc-swap.js

+7-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/btc-swap.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/keccak.js

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/keccak.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Ethereum Bitcoin Swap library",
55
"main": "lib/btc-swap.js",
66
"scripts": {
7-
"test": "grunt && mocha"
7+
"test": "grunt build && mocha"
88
},
99
"repository": {
1010
"type": "git",
@@ -23,15 +23,19 @@
2323
},
2424
"homepage": "https://github.com/etherex/btc-swap#readme",
2525
"devDependencies": {
26-
"babel-core": "^5.7.2",
26+
"babel-core": "^5.7.4",
27+
"eslint": "^0.24.1",
2728
"grunt": "^0.4.5",
28-
"grunt-babel": "^5.0.1"
29+
"grunt-babel": "^5.0.1",
30+
"grunt-contrib-watch": "^0.6.1",
31+
"grunt-eslint": "^16.0.0",
32+
"grunt-mocha-cli": "^1.13.1",
33+
"mocha": "^2.2.5"
2934
},
3035
"dependencies": {
3136
"bignumber.js": "^2.0.7",
3237
"bitcoin-proof": "^1.0.0",
3338
"bitcoinjs-lib": "^1.5.7",
34-
"mocha": "^2.2.5",
3539
"web3": "^0.8.1"
3640
}
3741
}

0 commit comments

Comments
 (0)