Commit a5f1575c by Tom MacWright Committed by GitHub

Merge pull request #715 from mapbox/eslint

Add basic eslint configuration
parents 75a06bf9 98c86d5f
module.exports = {
"extends": "eslint:recommended",
"env": {
"node": true
},
"rules": {
"indent": ["error", 4],
"linebreak-style": ["error", "unix"],
"semi": ["error", "always"],
"no-cond-assign": ["error", "always"]
}
}
...@@ -121,5 +121,6 @@ before_script: ...@@ -121,5 +121,6 @@ before_script:
script: script:
- if [[ "${NODE_VERSION}" ]]; then ./scripts/build_against_node.sh; fi; - if [[ "${NODE_VERSION}" ]]; then ./scripts/build_against_node.sh; fi;
- if [[ "${NODE_VERSION}" -eq "4" ]]; then ./node_modules/.bin/eslint lib; fi;
# disabled for now: need to port to sudo:false # disabled for now: need to port to sudo:false
#- if [[ "${NODE_WEBKIT}" ]]; then ./scripts/build_against_node_webkit.sh; fi; #- if [[ "${NODE_WEBKIT}" ]]; then ./scripts/build_against_node_webkit.sh; fi;
...@@ -19,12 +19,12 @@ function normalizeMethod (fn) { ...@@ -19,12 +19,12 @@ function normalizeMethod (fn) {
} }
var statement = new Statement(this, sql, errBack); var statement = new Statement(this, sql, errBack);
return fn.call(this, statement, args); return fn.call(this, statement, args);
} };
} }
function inherits(target, source) { function inherits(target, source) {
for (var k in source.prototype) for (var k in source.prototype)
target.prototype[k] = source.prototype[k]; target.prototype[k] = source.prototype[k];
} }
sqlite3.cached = { sqlite3.cached = {
...@@ -34,17 +34,18 @@ sqlite3.cached = { ...@@ -34,17 +34,18 @@ sqlite3.cached = {
return new Database(file, a, b); return new Database(file, a, b);
} }
var db;
file = path.resolve(file); file = path.resolve(file);
function cb() { callback.call(db, null); }
if (!sqlite3.cached.objects[file]) { if (!sqlite3.cached.objects[file]) {
var db =sqlite3.cached.objects[file] = new Database(file, a, b); db = sqlite3.cached.objects[file] = new Database(file, a, b);
} }
else { else {
// Make sure the callback is called. // Make sure the callback is called.
var db = sqlite3.cached.objects[file]; db = sqlite3.cached.objects[file];
var callback = (typeof a === 'number') ? b : a; var callback = (typeof a === 'number') ? b : a;
if (typeof callback === 'function') { if (typeof callback === 'function') {
function cb() { callback.call(db, null); }
if (db.open) process.nextTick(cb); if (db.open) process.nextTick(cb);
else db.once('open', cb); else db.once('open', cb);
} }
...@@ -114,7 +115,7 @@ Statement.prototype.map = function() { ...@@ -114,7 +115,7 @@ Statement.prototype.map = function() {
} else { } else {
var value = keys[1]; var value = keys[1];
// Value is a plain value // Value is a plain value
for (var i = 0; i < rows.length; i++) { for (i = 0; i < rows.length; i++) {
result[rows[i][key]] = rows[i][value]; result[rows[i][key]] = rows[i][value];
} }
} }
......
// Inspired by https://github.com/tlrobinson/long-stack-traces // Inspired by https://github.com/tlrobinson/long-stack-traces
var EventEmitter = require('events').EventEmitter;
var util = require('util'); var util = require('util');
function extendTrace(object, property, pos) { function extendTrace(object, property, pos) {
......
{ {
"name": "sqlite3", "name": "sqlite3",
"description": "Asynchronous, non-blocking SQLite3 bindings", "description": "Asynchronous, non-blocking SQLite3 bindings",
"version": "3.1.7", "version": "3.1.7",
"homepage": "http://github.com/mapbox/node-sqlite3", "homepage": "http://github.com/mapbox/node-sqlite3",
"author": { "author": {
"name": "MapBox", "name": "MapBox",
"url": "https://mapbox.com/" "url": "https://mapbox.com/"
}, },
"binary": { "binary": {
"module_name" : "node_sqlite3", "module_name": "node_sqlite3",
"module_path" : "./lib/binding/{node_abi}-{platform}-{arch}", "module_path": "./lib/binding/{node_abi}-{platform}-{arch}",
"host" : "https://mapbox-node-binary.s3.amazonaws.com", "host": "https://mapbox-node-binary.s3.amazonaws.com",
"remote_path" : "./{name}/v{version}/{toolset}/", "remote_path": "./{name}/v{version}/{toolset}/",
"package_name": "{node_abi}-{platform}-{arch}.tar.gz" "package_name": "{node_abi}-{platform}-{arch}.tar.gz"
}, },
"contributors": [ "contributors": [
"Konstantin Käfer <mail@kkaefer.com>", "Konstantin Käfer <mail@kkaefer.com>",
"Dane Springmeyer <dane@mapbox.com>", "Dane Springmeyer <dane@mapbox.com>",
"Will White <will@mapbox.com>", "Will White <will@mapbox.com>",
"Orlando Vazquez <ovazquez@gmail.com>", "Orlando Vazquez <ovazquez@gmail.com>",
"Artem Kustikov <kustikoff@gmail.com>", "Artem Kustikov <kustikoff@gmail.com>",
"Eric Fredricksen <efredricksen@gmail.com>", "Eric Fredricksen <efredricksen@gmail.com>",
"John Wright <mrjjwright@gmail.com>", "John Wright <mrjjwright@gmail.com>",
"Ryan Dahl <ry@tinyclouds.org>", "Ryan Dahl <ry@tinyclouds.org>",
"Tom MacWright <tom@mapbox.com>", "Tom MacWright <tom@mapbox.com>",
"Carter Thaxton <carter.thaxton@gmail.com>", "Carter Thaxton <carter.thaxton@gmail.com>",
"Audrius Kažukauskas <audrius@neutrino.lt>", "Audrius Kažukauskas <audrius@neutrino.lt>",
"Johannes Schauer <josch@pyneo.org>", "Johannes Schauer <josch@pyneo.org>",
"Nathan Rajlich <nathan@tootallnate.net>", "Nathan Rajlich <nathan@tootallnate.net>",
"AJ ONeal <coolaj86@gmail.com>", "AJ ONeal <coolaj86@gmail.com>",
"Mithgol", "Mithgol",
"Ben Noordhuis <ben@strongloop.com>" "Ben Noordhuis <ben@strongloop.com>"
], ],
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/mapbox/node-sqlite3.git" "url": "git://github.com/mapbox/node-sqlite3.git"
}, },
"dependencies": { "dependencies": {
"nan": "~2.4.0", "nan": "~2.4.0",
"node-pre-gyp": "~0.6.31" "node-pre-gyp": "~0.6.31"
}, },
"bundledDependencies": [ "bundledDependencies": [
"node-pre-gyp" "node-pre-gyp"
], ],
"devDependencies": { "devDependencies": {
"mocha": "3.x", "aws-sdk": "2.x",
"aws-sdk": "2.x" "eslint": "3.5.0",
}, "mocha": "3.x"
"scripts": { },
"prepublish":"npm ls", "scripts": {
"install": "node-pre-gyp install --fallback-to-build", "prepublish": "npm ls",
"pretest": "node test/support/createdb.js", "install": "node-pre-gyp install --fallback-to-build",
"test": "mocha -R spec --timeout 480000" "pretest": "node test/support/createdb.js",
}, "test": "mocha -R spec --timeout 480000"
"license": "BSD-3-Clause", },
"keywords": [ "license": "BSD-3-Clause",
"sql", "keywords": [
"sqlite", "sql",
"sqlite3", "sqlite",
"database" "sqlite3",
], "database"
"main": "./lib/sqlite3" ],
"main": "./lib/sqlite3"
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment