diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..379c48d --- /dev/null +++ b/.eslintrc @@ -0,0 +1,16 @@ +{ + "extends": "eslint:recommended", + "env": { + "node": true, + "mocha": true, + "es6": true + }, + "rules": { + "indent": [ 2, 4, { "SwitchCase": 1 } ], + "linebreak-style": [ 2, "unix" ], + "no-unused-vars": [2, { "args": "none" }], + "semi": [ 2, "always" ], + "comma-dangle": [ 0 ], + "no-constant-condition" : [ 0 ], + }, +} diff --git a/.istanbul.yml b/.istanbul.yml new file mode 100644 index 0000000..f0996d3 --- /dev/null +++ b/.istanbul.yml @@ -0,0 +1,7 @@ +check: + global: + statements: 90 + branches: 50 + functions: 90 + lines: 90 + excludes: [] diff --git a/.jscsrc b/.jscsrc deleted file mode 100644 index 883d86c..0000000 --- a/.jscsrc +++ /dev/null @@ -1,47 +0,0 @@ -{ - "maxErrors": -1, - "requireCurlyBraces": [ - "if", - "else", - "for", - "while", - "do", - "try", - "catch" - ], - "requireSpaceAfterKeywords": [ - "do", - "for", - "if", - "else", - "switch", - "case", - "try", - "catch", - "void", - "while", - "return", - "typeof" - ], - "disallowKeywordsOnNewLine": [ - "else" - ], - "requireSpacesInsideObjectBrackets": "all", - "disallowSpaceBeforePostfixUnaryOperators": [ - "++", - "--" - ], - "disallowTrailingWhitespace": true, - "requireParenthesesAroundIIFE": true, - "requireSpaceBeforeBlockStatements": true, - "requireSpacesInConditionalExpression": true, - "requireSpacesInFunctionExpression": { - "beforeOpeningCurlyBrace": true - }, - "requireSpaceBeforeBinaryOperators": true, - "requireSpaceAfterBinaryOperators": true, - "safeContextKeyword": ["self"], - "validateIndentation": 4, - "validateLineBreaks": "LF", - "disallowYodaConditions": true -} diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 80249d3..0000000 --- a/.jshintrc +++ /dev/null @@ -1,28 +0,0 @@ -{ - "globals": { - "after": false, - "afterEach": false, - "before": false, - "beforeEach": false, - "describe": false, - "it": false, - "window": false - }, - "bitwise": true, - "curly": true, - "eqeqeq": true, - "expr": true, - "immed": true, - "latedef": true, - "laxbreak": true, - "loopfunc": true, - "newcap": false, - "noarg": true, - "node": true, - "predef": [ "-Promise" ], - "strict": false, - "smarttabs": true, - "sub": true, - "undef": true, - "unused": "vars" -} diff --git a/.travis.yml b/.travis.yml index b4545df..185dd18 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,10 +23,9 @@ services: - mysql before_script: - - npm install -g jshint - - npm install -g jscs - mysql -e "create database IF NOT EXISTS test;" -uroot script: - - npm run -s lint - npm test + - npm run test-coverage + - npm run check-coverage diff --git a/README.md b/README.md index 4f9a8cc..42de24a 100644 --- a/README.md +++ b/README.md @@ -103,9 +103,3 @@ npm test ``` Both are run automatically by Travis. - -When developing you may run into failures during linting where jscs complains -about your coding style and an easy way to fix those files is to simply run -`jscs --fix test` or `jscs --fix lib` from the root directory of the project. -After jscs fixes things you should proceed to check that those changes are -reasonable as auto-fixing may not produce the nicest of looking code. diff --git a/index.js b/index.js index f0fb0f0..2687ff7 100644 --- a/index.js +++ b/index.js @@ -44,8 +44,8 @@ function MysqlAdapter(config, Juttle) { }); _.extend(baseSql.write.prototype, { - procName: 'write-mysql' - }); + procName: 'write-mysql' + }); return baseSql; } diff --git a/package.json b/package.json index 9f4f39c..4b08528 100644 --- a/package.json +++ b/package.json @@ -12,10 +12,12 @@ "license": "Apache-2.0", "repository": "juttle/juttle-mysql-adapter", "scripts": { - "test": "mocha test/*.spec.js", - "jshint": "jshint *.js test/*.js", - "style": "jscs *.js test/*.js", - "lint": "npm run jshint && npm run style" + "test": "npm run unit && npm run lint", + "test-coverage": "istanbul cover node_modules/.bin/_mocha -- test/*.spec.js", + "unit": "mocha test/*.spec.js", + "hist": "mocha test/*.spec.js -g live -i", + "lint": "eslint **/*.js *.js", + "check-coverage": "istanbul check-coverage" }, "dependencies": { "juttle-sql-adapter-common": "^0.3.3", @@ -24,11 +26,10 @@ "underscore": "^1.8.3" }, "devDependencies": { - "sqlite3": "^3.1.1", "chai": "^1.10.0", - "jshint": "^2.9.1-rc1", - "mocha": "^2.3.4", - "jscs": "^2.6.0" + "eslint": "^1.10.3", + "istanbul": "^0.4.2", + "mocha": "^2.3.4" }, "engines": { "node": ">=4.2.0",