Skip to content

Commit a5f1575

Browse files
authored
Merge pull request TryGhost#715 from mapbox/eslint
Add basic eslint configuration
2 parents 75a06bf + 98c86d5 commit a5f1575

5 files changed

Lines changed: 84 additions & 70 deletions

File tree

.eslintrc.js

Lines changed: 12 additions & 0 deletions
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+
}

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,6 @@ before_script:
121121

122122
script:
123123
- if [[ "${NODE_VERSION}" ]]; then ./scripts/build_against_node.sh; fi;
124+
- if [[ "${NODE_VERSION}" -eq "4" ]]; then ./node_modules/.bin/eslint lib; fi;
124125
# disabled for now: need to port to sudo:false
125126
#- if [[ "${NODE_WEBKIT}" ]]; then ./scripts/build_against_node_webkit.sh; fi;

lib/sqlite3.js

Lines changed: 8 additions & 7 deletions
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 63 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,65 @@
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 <mail@kkaefer.com>",
19-
"Dane Springmeyer <dane@mapbox.com>",
20-
"Will White <will@mapbox.com>",
21-
"Orlando Vazquez <ovazquez@gmail.com>",
22-
"Artem Kustikov <kustikoff@gmail.com>",
23-
"Eric Fredricksen <efredricksen@gmail.com>",
24-
"John Wright <mrjjwright@gmail.com>",
25-
"Ryan Dahl <ry@tinyclouds.org>",
26-
"Tom MacWright <tom@mapbox.com>",
27-
"Carter Thaxton <carter.thaxton@gmail.com>",
28-
"Audrius Kažukauskas <audrius@neutrino.lt>",
29-
"Johannes Schauer <josch@pyneo.org>",
30-
"Nathan Rajlich <nathan@tootallnate.net>",
31-
"AJ ONeal <coolaj86@gmail.com>",
32-
"Mithgol",
33-
"Ben Noordhuis <ben@strongloop.com>"
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 <mail@kkaefer.com>",
19+
"Dane Springmeyer <dane@mapbox.com>",
20+
"Will White <will@mapbox.com>",
21+
"Orlando Vazquez <ovazquez@gmail.com>",
22+
"Artem Kustikov <kustikoff@gmail.com>",
23+
"Eric Fredricksen <efredricksen@gmail.com>",
24+
"John Wright <mrjjwright@gmail.com>",
25+
"Ryan Dahl <ry@tinyclouds.org>",
26+
"Tom MacWright <tom@mapbox.com>",
27+
"Carter Thaxton <carter.thaxton@gmail.com>",
28+
"Audrius Kažukauskas <audrius@neutrino.lt>",
29+
"Johannes Schauer <josch@pyneo.org>",
30+
"Nathan Rajlich <nathan@tootallnate.net>",
31+
"AJ ONeal <coolaj86@gmail.com>",
32+
"Mithgol",
33+
"Ben Noordhuis <ben@strongloop.com>"
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+
"aws-sdk": "2.x",
48+
"eslint": "3.5.0",
49+
"mocha": "3.x"
50+
},
51+
"scripts": {
52+
"prepublish": "npm ls",
53+
"install": "node-pre-gyp install --fallback-to-build",
54+
"pretest": "node test/support/createdb.js",
55+
"test": "mocha -R spec --timeout 480000"
56+
},
57+
"license": "BSD-3-Clause",
58+
"keywords": [
59+
"sql",
60+
"sqlite",
61+
"sqlite3",
62+
"database"
63+
],
64+
"main": "./lib/sqlite3"
6465
}

0 commit comments

Comments
 (0)