Skip to content

Commit 20337bc

Browse files
committed
Add basic eslint configuration
1 parent 75a06bf commit 20337bc

File tree

4 files changed

+81
-70
lines changed

4 files changed

+81
-70
lines changed

.eslintrc.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
"extends": "eslint:recommended",
3+
"env": {
4+
"node": true
5+
},
6+
"rules": {
7+
"indent": ["error", 4],
8+
"linebreak-style": ["error", "unix"],
9+
"semi": ["error", "always"],
10+
"no-cond-assign": ["error", "always"]
11+
}
12+
}

lib/sqlite3.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ function normalizeMethod (fn) {
1919
}
2020
var statement = new Statement(this, sql, errBack);
2121
return fn.call(this, statement, args);
22-
}
22+
};
2323
}
2424

2525
function inherits(target, source) {
26-
for (var k in source.prototype)
27-
target.prototype[k] = source.prototype[k];
26+
for (var k in source.prototype)
27+
target.prototype[k] = source.prototype[k];
2828
}
2929

3030
sqlite3.cached = {
@@ -34,17 +34,18 @@ sqlite3.cached = {
3434
return new Database(file, a, b);
3535
}
3636

37+
var db;
3738
file = path.resolve(file);
39+
function cb() { callback.call(db, null); }
3840

3941
if (!sqlite3.cached.objects[file]) {
40-
var db =sqlite3.cached.objects[file] = new Database(file, a, b);
42+
db = sqlite3.cached.objects[file] = new Database(file, a, b);
4143
}
4244
else {
4345
// Make sure the callback is called.
44-
var db = sqlite3.cached.objects[file];
46+
db = sqlite3.cached.objects[file];
4547
var callback = (typeof a === 'number') ? b : a;
4648
if (typeof callback === 'function') {
47-
function cb() { callback.call(db, null); }
4849
if (db.open) process.nextTick(cb);
4950
else db.once('open', cb);
5051
}
@@ -114,7 +115,7 @@ Statement.prototype.map = function() {
114115
} else {
115116
var value = keys[1];
116117
// Value is a plain value
117-
for (var i = 0; i < rows.length; i++) {
118+
for (i = 0; i < rows.length; i++) {
118119
result[rows[i][key]] = rows[i][value];
119120
}
120121
}

lib/trace.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// Inspired by https://github.com/tlrobinson/long-stack-traces
2-
var EventEmitter = require('events').EventEmitter;
32
var util = require('util');
43

54
function extendTrace(object, property, pos) {

package.json

+61-62
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,63 @@
11
{
2-
"name": "sqlite3",
3-
"description": "Asynchronous, non-blocking SQLite3 bindings",
4-
"version": "3.1.7",
5-
"homepage": "http://github.com/mapbox/node-sqlite3",
6-
"author": {
7-
"name": "MapBox",
8-
"url": "https://mapbox.com/"
9-
},
10-
"binary": {
11-
"module_name" : "node_sqlite3",
12-
"module_path" : "./lib/binding/{node_abi}-{platform}-{arch}",
13-
"host" : "https://mapbox-node-binary.s3.amazonaws.com",
14-
"remote_path" : "./{name}/v{version}/{toolset}/",
15-
"package_name": "{node_abi}-{platform}-{arch}.tar.gz"
16-
},
17-
"contributors": [
18-
"Konstantin Käfer <[email protected]>",
19-
"Dane Springmeyer <[email protected]>",
20-
"Will White <[email protected]>",
21-
"Orlando Vazquez <[email protected]>",
22-
"Artem Kustikov <[email protected]>",
23-
"Eric Fredricksen <[email protected]>",
24-
"John Wright <[email protected]>",
25-
"Ryan Dahl <[email protected]>",
26-
"Tom MacWright <[email protected]>",
27-
"Carter Thaxton <[email protected]>",
28-
"Audrius Kažukauskas <[email protected]>",
29-
"Johannes Schauer <[email protected]>",
30-
"Nathan Rajlich <[email protected]>",
31-
"AJ ONeal <[email protected]>",
32-
"Mithgol",
33-
"Ben Noordhuis <[email protected]>"
34-
],
35-
"repository": {
36-
"type": "git",
37-
"url": "git://github.com/mapbox/node-sqlite3.git"
38-
},
39-
"dependencies": {
40-
"nan": "~2.4.0",
41-
"node-pre-gyp": "~0.6.31"
42-
},
43-
"bundledDependencies": [
44-
"node-pre-gyp"
45-
],
46-
"devDependencies": {
47-
"mocha": "3.x",
48-
"aws-sdk": "2.x"
49-
},
50-
"scripts": {
51-
"prepublish":"npm ls",
52-
"install": "node-pre-gyp install --fallback-to-build",
53-
"pretest": "node test/support/createdb.js",
54-
"test": "mocha -R spec --timeout 480000"
55-
},
56-
"license": "BSD-3-Clause",
57-
"keywords": [
58-
"sql",
59-
"sqlite",
60-
"sqlite3",
61-
"database"
62-
],
63-
"main": "./lib/sqlite3"
2+
"name": "sqlite3",
3+
"description": "Asynchronous, non-blocking SQLite3 bindings",
4+
"version": "3.1.7",
5+
"homepage": "http://github.com/mapbox/node-sqlite3",
6+
"author": {
7+
"name": "MapBox",
8+
"url": "https://mapbox.com/"
9+
},
10+
"binary": {
11+
"module_name": "node_sqlite3",
12+
"module_path": "./lib/binding/{node_abi}-{platform}-{arch}",
13+
"host": "https://mapbox-node-binary.s3.amazonaws.com",
14+
"remote_path": "./{name}/v{version}/{toolset}/",
15+
"package_name": "{node_abi}-{platform}-{arch}.tar.gz"
16+
},
17+
"contributors": [
18+
"Konstantin Käfer <[email protected]>",
19+
"Dane Springmeyer <[email protected]>",
20+
"Will White <[email protected]>",
21+
"Orlando Vazquez <[email protected]>",
22+
"Artem Kustikov <[email protected]>",
23+
"Eric Fredricksen <[email protected]>",
24+
"John Wright <[email protected]>",
25+
"Ryan Dahl <[email protected]>",
26+
"Tom MacWright <[email protected]>",
27+
"Carter Thaxton <[email protected]>",
28+
"Audrius Kažukauskas <[email protected]>",
29+
"Johannes Schauer <[email protected]>",
30+
"Nathan Rajlich <[email protected]>",
31+
"AJ ONeal <[email protected]>",
32+
"Mithgol",
33+
"Ben Noordhuis <[email protected]>"
34+
],
35+
"repository": {
36+
"type": "git",
37+
"url": "git://github.com/mapbox/node-sqlite3.git"
38+
},
39+
"dependencies": {
40+
"nan": "~2.3.3",
41+
"node-pre-gyp": "~0.6.28"
42+
},
43+
"devDependencies": {
44+
"aws-sdk": "2.x",
45+
"eslint": "3.5.0",
46+
"mocha": "2.x"
47+
},
48+
"scripts": {
49+
"prepublish": "npm ls",
50+
"preinstall": "npm install node-pre-gyp",
51+
"install": "node-pre-gyp install --fallback-to-build",
52+
"pretest": "node test/support/createdb.js",
53+
"test": "eslint lib && mocha -R spec --timeout 480000"
54+
},
55+
"license": "BSD-3-Clause",
56+
"keywords": [
57+
"sql",
58+
"sqlite",
59+
"sqlite3",
60+
"database"
61+
],
62+
"main": "./lib/sqlite3"
6463
}

0 commit comments

Comments
 (0)