diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..1b34a0a --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,40 @@ +{ + "env": { + "commonjs": true, + "es6": true, + "node": true, + "mocha": true + }, + "extends": "eslint:recommended", + "parserOptions": { + "sourceType": "module" + }, + "rules": { + "strict": [ + 2, + "function" + ], + "curly": 2, + "eqeqeq": 2, + "wrap-iife": [ + 2, + "any" + ], + "no-use-before-define": [ + 2, + { + "functions": false + } + ], + "new-cap": 2, + "no-caller": 2, + "dot-notation": 0, + "no-undef": 2, + "no-unused-vars": 2, + "no-cond-assign": [ + 2, + "except-parens" + ], + "no-eq-null": 2 + } +} \ No newline at end of file diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index f11e817..0000000 --- a/.jshintrc +++ /dev/null @@ -1,23 +0,0 @@ -{ - "strict": true, - "curly": true, - "eqeqeq": true, - "immed": true, - "latedef": "nofunc", - "newcap": true, - "noarg": true, - "sub": true, - "undef": true, - "unused": true, - "boss": true, - "eqnull": true, - "node": true, - "globals": { - "describe": false, - "it": false, - "before": false, - "after": false, - "beforeEach": false, - "afterEach": false - } -} diff --git a/.travis.yml b/.travis.yml index 269fd45..74685aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - "4.1" - - "4.0" - - "0.12" - - "0.10" + - "4" + - "6" + - "7" + - "8" diff --git a/README.md b/README.md index 0f46951..e11762d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ### 動作環境 -* Node.js : 0.10.0以上 +* Node.js : 4以上 ### セットアップ @@ -27,12 +27,16 @@ $ npm install ```sh $ npm test -> javascript-mocha@0.1.0 test /path/to/projects/javascript-mocha -> npm run lint && mocha --require intelli-espower-loader +> javascript-mocha@0.1.0 pretest /path/to/projects/javascript-mocha +> npm run lint > javascript-mocha@0.1.0 lint /path/to/projects/javascript-mocha -> jshint lib test +> eslint 'lib/**' 'test/**' + + +> javascript-mocha@0.1.0 test /path/to/projects/javascript-mocha +> mocha --require intelli-espower-loader @@ -40,10 +44,10 @@ $ npm test .status ✓ は、trueであるべき #say() - ✓ は、'Hello TDDBC!'が返ってくるべき + ✓ は、"Hello TDDBC!"が返ってくるべき - 2 passing (5ms) + 2 passing (9ms) $ ``` diff --git a/lib/sample.js b/lib/sample.js index 7c87592..740eaec 100644 --- a/lib/sample.js +++ b/lib/sample.js @@ -1,11 +1,9 @@ -'use strict'; - function Sample() { this.status = true; } Sample.prototype.say = function () { - return "Hello TDDBC!"; + return 'Hello TDDBC!'; }; module.exports = Sample; diff --git a/package.json b/package.json index dc476b3..7a0826e 100644 --- a/package.json +++ b/package.json @@ -9,10 +9,10 @@ "url": "https://github.com/tddbc/javascript-mocha/issues" }, "devDependencies": { - "espower-loader": "^1.0.0", + "eslint": "^4.1.1", + "espower-loader": "^1.2.2", "intelli-espower-loader": "^1.0.1", - "jshint": "^2.9.1", - "mocha": "^2.4.5", + "mocha": "^3.4.2", "power-assert": "^1.2.0" }, "directories": { @@ -25,18 +25,16 @@ "keywords": [ "TDDBC" ], - "license": { - "type": "MIT", - "url": "https://github.com/tddbc/javascript-mocha/blob/master/LICENSE-MIT" - }, + "license": "MIT", "main": "lib/sample.js", "repository": { "type": "git", "url": "git://github.com/tddbc/javascript-mocha.git" }, "scripts": { - "lint": "jshint lib test", - "test": "npm run lint && mocha --require intelli-espower-loader", + "lint": "eslint 'lib/**' 'test/**'", + "pretest": "npm run lint", + "test": "mocha --require intelli-espower-loader", "watch": "mocha --require intelli-espower-loader --watch" } } diff --git a/test/SampleTest.js b/test/SampleTest.js index 1b5443c..e171421 100644 --- a/test/SampleTest.js +++ b/test/SampleTest.js @@ -1,6 +1,4 @@ -'use strict'; - -var assert = require('power-assert'); +var assert = require('assert'); var Sample = require('../lib/sample'); @@ -18,7 +16,7 @@ describe('Sample', function () { }); describe('#say()', function () { - it("は、'Hello TDDBC!'が返ってくるべき", function () { + it('は、"Hello TDDBC!"が返ってくるべき', function () { assert(sut.say() === 'Hello TDDBC!'); }); });