Skip to content

Commit 56e90e3

Browse files
committed
lint: add eslint rules that cover editorconfig
1 parent 713d2ae commit 56e90e3

File tree

18 files changed

+34
-20
lines changed

18 files changed

+34
-20
lines changed

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
coverage
2+
node_modules

.eslintrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"rules": {
3+
"eol-last": "error",
4+
"indent": ["error", 2, { "SwitchCase": 1 }],
5+
"no-trailing-spaces": "error"
6+
}
7+
}

.travis.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,7 @@ before_install:
2727
# Update Node.js modules
2828
- "test ! -d node_modules || npm prune"
2929
- "test ! -d node_modules || npm rebuild"
30-
script: "npm run-script test-ci"
30+
script:
31+
- "npm run test-ci"
32+
- "npm run lint"
3133
after_script: "npm install [email protected] && cat ./coverage/lcov.info | coveralls"

appveyor.yml

+1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ test_script:
2222
- node --version
2323
- npm --version
2424
- npm run test-ci
25+
- npm run lint
2526
version: "{build}"

examples/content-negotiation/db.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ users.push({ name: 'Tobi' });
44
users.push({ name: 'Loki' });
55
users.push({ name: 'Jane' });
66

7-
module.exports = users;
7+
module.exports = users;
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
exports.index = function(req, res){
22
res.redirect('/users');
3-
};
3+
};

examples/mvc/db.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ var users = exports.users = [];
1111

1212
users.push({ name: 'TJ', pets: [pets[0], pets[1], pets[2]], id: 0 });
1313
users.push({ name: 'Guillermo', pets: [pets[3]], id: 1 });
14-
users.push({ name: 'Nathan', pets: [], id: 2 });
14+
users.push({ name: 'Nathan', pets: [], id: 2 });

examples/resource/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ app.resource('/users', User);
7575

7676
app.get('/', function(req, res){
7777
res.send([
78-
'<h1>Examples:</h1> <ul>'
78+
'<h1>Examples:</h1> <ul>'
7979
, '<li>GET /users</li>'
8080
, '<li>GET /users/1</li>'
8181
, '<li>GET /users/3</li>'

examples/route-separation/site.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
exports.index = function(req, res){
22
res.render('index', { title: 'Route Separation Example' });
3-
};
3+
};

examples/search/public/client.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ search.addEventListener('keyup', function(){
1010
}
1111
};
1212
xhr.send();
13-
}, false);
13+
}, false);
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
foo
1+
foo

examples/web-service/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ var users = [
6161
];
6262

6363
var userRepos = {
64-
tobi: [repos[0], repos[1]]
64+
tobi: [repos[0], repos[1]]
6565
, loki: [repos[1]]
6666
, jane: [repos[2]]
6767
};

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"body-parser": "1.17.2",
6262
"cookie-parser": "~1.4.3",
6363
"ejs": "2.5.7",
64+
"eslint": "2.13.1",
6465
"express-session": "1.15.3",
6566
"hbs": "4.0.1",
6667
"istanbul": "0.4.5",
@@ -87,6 +88,7 @@
8788
"lib/"
8889
],
8990
"scripts": {
91+
"lint": "eslint .",
9092
"test": "mocha --require test/support/env --reporter spec --bail --check-leaks test/ test/acceptance/",
9193
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --require test/support/env --reporter spec --check-leaks test/ test/acceptance/",
9294
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --require test/support/env --reporter dot --check-leaks test/ test/acceptance/",

test/acceptance/error-pages.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,4 @@ describe('error-pages', function(){
9999
})
100100
})
101101
})
102-
})
102+
})

test/acceptance/error.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ describe('error', function(){
2626
.expect(404,done)
2727
})
2828
})
29-
})
29+
})

test/acceptance/route-map.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ describe('route-map', function(){
4242
.expect('delete 12\'s pet 2', done);
4343
})
4444
})
45-
})
45+
})

test/app.engine.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('app', function(){
4747
done();
4848
})
4949
})
50-
50+
5151
it('should work "view engine" setting', function(done){
5252
var app = express();
5353

@@ -62,7 +62,7 @@ describe('app', function(){
6262
done();
6363
})
6464
})
65-
65+
6666
it('should work "view engine" with leading "."', function(done){
6767
var app = express();
6868

test/config.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe('config', function () {
4949
var app = express();
5050
assert.strictEqual(app.get('foo'), undefined);
5151
})
52-
52+
5353
it('should otherwise return the value', function(){
5454
var app = express();
5555
app.set('foo', 'bar');
@@ -125,34 +125,34 @@ describe('config', function () {
125125
assert.strictEqual(app.get('tobi'), true);
126126
})
127127
})
128-
128+
129129
describe('.disable()', function(){
130130
it('should set the value to false', function(){
131131
var app = express();
132132
assert.equal(app.disable('tobi'), app);
133133
assert.strictEqual(app.get('tobi'), false);
134134
})
135135
})
136-
136+
137137
describe('.enabled()', function(){
138138
it('should default to false', function(){
139139
var app = express();
140140
assert.strictEqual(app.enabled('foo'), false);
141141
})
142-
142+
143143
it('should return true when set', function(){
144144
var app = express();
145145
app.set('foo', 'bar');
146146
assert.strictEqual(app.enabled('foo'), true);
147147
})
148148
})
149-
149+
150150
describe('.disabled()', function(){
151151
it('should default to true', function(){
152152
var app = express();
153153
assert.strictEqual(app.disabled('foo'), true);
154154
})
155-
155+
156156
it('should return false when set', function(){
157157
var app = express();
158158
app.set('foo', 'bar');

0 commit comments

Comments
 (0)