mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 00:19:48 +01:00
lint: add eslint rules that cover editorconfig
This commit is contained in:
parent
713d2aed93
commit
56e90e3c72
2
.eslintignore
Normal file
2
.eslintignore
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
coverage
|
||||||
|
node_modules
|
||||||
7
.eslintrc
Normal file
7
.eslintrc
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"rules": {
|
||||||
|
"eol-last": "error",
|
||||||
|
"indent": ["error", 2, { "SwitchCase": 1 }],
|
||||||
|
"no-trailing-spaces": "error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -27,5 +27,7 @@ before_install:
|
||||||
# Update Node.js modules
|
# Update Node.js modules
|
||||||
- "test ! -d node_modules || npm prune"
|
- "test ! -d node_modules || npm prune"
|
||||||
- "test ! -d node_modules || npm rebuild"
|
- "test ! -d node_modules || npm rebuild"
|
||||||
script: "npm run-script test-ci"
|
script:
|
||||||
|
- "npm run test-ci"
|
||||||
|
- "npm run lint"
|
||||||
after_script: "npm install coveralls@2.10.0 && cat ./coverage/lcov.info | coveralls"
|
after_script: "npm install coveralls@2.10.0 && cat ./coverage/lcov.info | coveralls"
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,5 @@ test_script:
|
||||||
- node --version
|
- node --version
|
||||||
- npm --version
|
- npm --version
|
||||||
- npm run test-ci
|
- npm run test-ci
|
||||||
|
- npm run lint
|
||||||
version: "{build}"
|
version: "{build}"
|
||||||
|
|
|
||||||
|
|
@ -4,4 +4,4 @@ users.push({ name: 'Tobi' });
|
||||||
users.push({ name: 'Loki' });
|
users.push({ name: 'Loki' });
|
||||||
users.push({ name: 'Jane' });
|
users.push({ name: 'Jane' });
|
||||||
|
|
||||||
module.exports = users;
|
module.exports = users;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
exports.index = function(req, res){
|
exports.index = function(req, res){
|
||||||
res.redirect('/users');
|
res.redirect('/users');
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -11,4 +11,4 @@ var users = exports.users = [];
|
||||||
|
|
||||||
users.push({ name: 'TJ', pets: [pets[0], pets[1], pets[2]], id: 0 });
|
users.push({ name: 'TJ', pets: [pets[0], pets[1], pets[2]], id: 0 });
|
||||||
users.push({ name: 'Guillermo', pets: [pets[3]], id: 1 });
|
users.push({ name: 'Guillermo', pets: [pets[3]], id: 1 });
|
||||||
users.push({ name: 'Nathan', pets: [], id: 2 });
|
users.push({ name: 'Nathan', pets: [], id: 2 });
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ app.resource('/users', User);
|
||||||
|
|
||||||
app.get('/', function(req, res){
|
app.get('/', function(req, res){
|
||||||
res.send([
|
res.send([
|
||||||
'<h1>Examples:</h1> <ul>'
|
'<h1>Examples:</h1> <ul>'
|
||||||
, '<li>GET /users</li>'
|
, '<li>GET /users</li>'
|
||||||
, '<li>GET /users/1</li>'
|
, '<li>GET /users/1</li>'
|
||||||
, '<li>GET /users/3</li>'
|
, '<li>GET /users/3</li>'
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
exports.index = function(req, res){
|
exports.index = function(req, res){
|
||||||
res.render('index', { title: 'Route Separation Example' });
|
res.render('index', { title: 'Route Separation Example' });
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,4 @@ search.addEventListener('keyup', function(){
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xhr.send();
|
xhr.send();
|
||||||
}, false);
|
}, false);
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
foo
|
foo
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ var users = [
|
||||||
];
|
];
|
||||||
|
|
||||||
var userRepos = {
|
var userRepos = {
|
||||||
tobi: [repos[0], repos[1]]
|
tobi: [repos[0], repos[1]]
|
||||||
, loki: [repos[1]]
|
, loki: [repos[1]]
|
||||||
, jane: [repos[2]]
|
, jane: [repos[2]]
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@
|
||||||
"body-parser": "1.17.2",
|
"body-parser": "1.17.2",
|
||||||
"cookie-parser": "~1.4.3",
|
"cookie-parser": "~1.4.3",
|
||||||
"ejs": "2.5.7",
|
"ejs": "2.5.7",
|
||||||
|
"eslint": "2.13.1",
|
||||||
"express-session": "1.15.3",
|
"express-session": "1.15.3",
|
||||||
"hbs": "4.0.1",
|
"hbs": "4.0.1",
|
||||||
"istanbul": "0.4.5",
|
"istanbul": "0.4.5",
|
||||||
|
|
@ -87,6 +88,7 @@
|
||||||
"lib/"
|
"lib/"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"lint": "eslint .",
|
||||||
"test": "mocha --require test/support/env --reporter spec --bail --check-leaks test/ test/acceptance/",
|
"test": "mocha --require test/support/env --reporter spec --bail --check-leaks test/ test/acceptance/",
|
||||||
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --require test/support/env --reporter spec --check-leaks test/ test/acceptance/",
|
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --require test/support/env --reporter spec --check-leaks test/ test/acceptance/",
|
||||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --require test/support/env --reporter dot --check-leaks test/ test/acceptance/",
|
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --require test/support/env --reporter dot --check-leaks test/ test/acceptance/",
|
||||||
|
|
|
||||||
|
|
@ -99,4 +99,4 @@ describe('error-pages', function(){
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -26,4 +26,4 @@ describe('error', function(){
|
||||||
.expect(404,done)
|
.expect(404,done)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -42,4 +42,4 @@ describe('route-map', function(){
|
||||||
.expect('delete 12\'s pet 2', done);
|
.expect('delete 12\'s pet 2', done);
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ describe('app', function(){
|
||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should work "view engine" setting', function(done){
|
it('should work "view engine" setting', function(done){
|
||||||
var app = express();
|
var app = express();
|
||||||
|
|
||||||
|
|
@ -62,7 +62,7 @@ describe('app', function(){
|
||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should work "view engine" with leading "."', function(done){
|
it('should work "view engine" with leading "."', function(done){
|
||||||
var app = express();
|
var app = express();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ describe('config', function () {
|
||||||
var app = express();
|
var app = express();
|
||||||
assert.strictEqual(app.get('foo'), undefined);
|
assert.strictEqual(app.get('foo'), undefined);
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should otherwise return the value', function(){
|
it('should otherwise return the value', function(){
|
||||||
var app = express();
|
var app = express();
|
||||||
app.set('foo', 'bar');
|
app.set('foo', 'bar');
|
||||||
|
|
@ -125,7 +125,7 @@ describe('config', function () {
|
||||||
assert.strictEqual(app.get('tobi'), true);
|
assert.strictEqual(app.get('tobi'), true);
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('.disable()', function(){
|
describe('.disable()', function(){
|
||||||
it('should set the value to false', function(){
|
it('should set the value to false', function(){
|
||||||
var app = express();
|
var app = express();
|
||||||
|
|
@ -133,26 +133,26 @@ describe('config', function () {
|
||||||
assert.strictEqual(app.get('tobi'), false);
|
assert.strictEqual(app.get('tobi'), false);
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('.enabled()', function(){
|
describe('.enabled()', function(){
|
||||||
it('should default to false', function(){
|
it('should default to false', function(){
|
||||||
var app = express();
|
var app = express();
|
||||||
assert.strictEqual(app.enabled('foo'), false);
|
assert.strictEqual(app.enabled('foo'), false);
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return true when set', function(){
|
it('should return true when set', function(){
|
||||||
var app = express();
|
var app = express();
|
||||||
app.set('foo', 'bar');
|
app.set('foo', 'bar');
|
||||||
assert.strictEqual(app.enabled('foo'), true);
|
assert.strictEqual(app.enabled('foo'), true);
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('.disabled()', function(){
|
describe('.disabled()', function(){
|
||||||
it('should default to true', function(){
|
it('should default to true', function(){
|
||||||
var app = express();
|
var app = express();
|
||||||
assert.strictEqual(app.disabled('foo'), true);
|
assert.strictEqual(app.disabled('foo'), true);
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return false when set', function(){
|
it('should return false when set', function(){
|
||||||
var app = express();
|
var app = express();
|
||||||
app.set('foo', 'bar');
|
app.set('foo', 'bar');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user