From a7ab1036906bb7638193a9e991cb62c86108880a Mon Sep 17 00:00:00 2001 From: dcodeIO Date: Sat, 4 Mar 2017 05:22:49 +0100 Subject: [PATCH] Other: More precise linter configuration --- .codeclimate.yml | 10 +++++++++- .eslintignore | 15 +++++++++++++++ .travis.yml | 2 ++ bench/prof.js | 2 +- bench/read.js | 2 +- bench/suite.js | 2 +- bench/write.js | 6 +++--- debug.js | 1 + examples/streaming-rpc.js | 4 ++-- light.js | 1 + minimal.js | 1 + package.json | 6 +++--- runtime.js | 1 + tests/other_package.js | 7 +++++-- 14 files changed, 46 insertions(+), 14 deletions(-) create mode 100644 .eslintignore diff --git a/.codeclimate.yml b/.codeclimate.yml index 5b25cf490..f9ba9735f 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -4,4 +4,12 @@ engines: ratings: paths: - "src/**.js" -exclude_paths: + - "lib/aspromise/**.js" + - "lib/base64/**.js" + - "lib/eventemitter/**.js" + - "lib/fetch/**.js" + - "lib/inquire/**.js" + - "lib/path/**.js" + - "lib/pool/**.js" + - "lib/utf8/**.js" +exclude_paths: \ No newline at end of file diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..09b578093 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,15 @@ +bench/* +bin/* +cli/* +coverage/* +dist/* +docs/* +gulpfile.js +lib/deep-equal/* +lib/prelude.js +lib/polyfill.js +lib/tape-adapter.js +lib/tsd-jsdoc/* +sandbox/* +scripts/* +**/tests/* diff --git a/.travis.yml b/.travis.yml index 80709b0b1..4bc9fa989 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,8 @@ addons: apt: sources: ubuntu-toolchain-r-test packages: g++-4.8 + code_climate: + repo_token: 20d88c0ad0ae53be53f48ef57cfec8ff6d8fc86381f742b50747335f3cebdc69 matrix: include: diff --git a/bench/prof.js b/bench/prof.js index e27739494..e62a4dba4 100644 --- a/bench/prof.js +++ b/bench/prof.js @@ -21,7 +21,7 @@ if (process.execArgv.indexOf("--prof") < 0) { fs.unlink(file); }); process.stdout.write("generating profile (may take a while) ...\n"); - child_process.execSync("node --prof --trace-deopt " + process.execArgv.join(" ") + " " + process.argv.slice(1).join(' '), { + child_process.execSync("node --prof --trace-deopt " + process.execArgv.join(" ") + " " + process.argv.slice(1).join(" "), { cwd: process.cwd(), stdio: "inherit" }); diff --git a/bench/read.js b/bench/read.js index fc4bf8b3e..fd37c3873 100644 --- a/bench/read.js +++ b/bench/read.js @@ -120,7 +120,7 @@ function readString(bytes) { readString(array); }) .add("readString buffer", function() { - readString(buffer) + readString(buffer); }) .add("toString buffer", function() { buffer.toString("utf8", 0, buffer.length); diff --git a/bench/suite.js b/bench/suite.js index f6bdeabc1..e8016d23e 100644 --- a/bench/suite.js +++ b/bench/suite.js @@ -27,7 +27,7 @@ function newSuite(name) { if (fastest.indexOf(bench) === 0) return; var hz = hz = getHz(bench); - var percent = (1 - (hz / fastestHz)) * 100; + var percent = (1 - hz / fastestHz) * 100; process.stdout.write(chalk.white(pad(bench.name, padSize)) + " was " + chalk.red(percent.toFixed(1) + "% slower") + "\n"); }); } diff --git a/bench/write.js b/bench/write.js index 811c528c8..fb210a3d4 100644 --- a/bench/write.js +++ b/bench/write.js @@ -178,13 +178,13 @@ buffer = new Buffer(1000); writeString(array, 0, str); }) .add("writeString buffer", function() { - writeString(buffer, 0, str) + writeString(buffer, 0, str); }) .add("write buffer", function() { - buffer.write(str, 0) + buffer.write(str, 0); }) .add("utf8Write buffer", function() { - buffer.utf8Write(str, 0) + buffer.utf8Write(str, 0); }) /* .add("byteLength array", function() { byteLength(str) diff --git a/debug.js b/debug.js index b7939c251..6efc2f560 100644 --- a/debug.js +++ b/debug.js @@ -1 +1,2 @@ +"use strict"; module.exports = require("./src/index-debug"); \ No newline at end of file diff --git a/examples/streaming-rpc.js b/examples/streaming-rpc.js index f3c0c2317..4559e3c0a 100644 --- a/examples/streaming-rpc.js +++ b/examples/streaming-rpc.js @@ -10,9 +10,9 @@ var root = protobuf.Root.fromJSON({ Greeter: { methods: { "SayHello": { - requestType: 'Hello', + requestType: "Hello", requestStream: true, - responseType: 'World', + responseType: "World", responseStream: true } } diff --git a/light.js b/light.js index 0f6beb10b..92720f44f 100644 --- a/light.js +++ b/light.js @@ -1 +1,2 @@ +"use strict"; module.exports = require("./src/index-light"); \ No newline at end of file diff --git a/minimal.js b/minimal.js index 05661fa3b..ee7091b1e 100644 --- a/minimal.js +++ b/minimal.js @@ -1 +1,2 @@ +"use strict"; module.exports = require("./src/index-minimal"); \ No newline at end of file diff --git a/package.json b/package.json index 9d4f05120..0ef00df31 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js tests/node/*.js", "coverage-ci": "npm run coverage && cat coverage/lcov.info | coveralls", "docs": "jsdoc -c jsdoc.docs.json -R README.md --verbose --pedantic", - "lint": "eslint src", + "lint": "eslint **/*.js", "pages": "node scripts/pages", "prepublish": "node scripts/prepublish", "postinstall": "node scripts/postinstall", @@ -65,7 +65,7 @@ "bundle-collapser": "^1.2.1", "chalk": "^1.1.3", "escodegen": "^1.8.1", - "eslint": "^3.16.1", + "eslint": "^3.17.0", "espree": "^3.1.3", "estraverse": "^4.2.0", "gh-pages": "^0.12.0", @@ -87,7 +87,7 @@ "tape": "^4.6.3", "tmp": "0.0.31", "typescript": "^2.2.1", - "uglify-js": "^2.8.4", + "uglify-js": "^2.8.5", "vinyl-buffer": "^1.0.0", "vinyl-fs": "^2.4.4", "vinyl-source-stream": "^1.1.0" diff --git a/runtime.js b/runtime.js index 81fff6303..7e3739fd5 100644 --- a/runtime.js +++ b/runtime.js @@ -1,2 +1,3 @@ // deprecated - compatibility layer for v6.5 and earlier +"use strict"; module.exports = require("./minimal"); \ No newline at end of file diff --git a/tests/other_package.js b/tests/other_package.js index 85359fbde..36cfeb69b 100644 --- a/tests/other_package.js +++ b/tests/other_package.js @@ -1,3 +1,4 @@ +"use strict"; var tape = require("tape"); var protobuf = require(".."), @@ -8,8 +9,10 @@ tape.test("package.json (reflected)", function(test) { test.plan(2); protobuf.load("tests/data/package.proto", function(err, root) { - if (err) - return test.fail(err.message); + if (err) { + test.fail(err.message); + return; + } var Package = root.lookup("Package"), Repository = root.lookup("Package.Repository");