Skip to content
Myr

lint: remove usages of "=="

Before adoption: this commit came in with the history the project adopted, so no landing records it.

closes #3540

authored by Alejandro Estrada · committed by Douglas Christopher Wilson · parent 972ada9 · Browse files · 16 files+24 added−23 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

16 files+24 added−23 removed

  • tests:+13 added−13 removed
  • other:+11 added−10 removed

16 files+24 added−23 removed

modified:examples/auth/index.js+1 added-1 removed
modified:examples/cookies/index.js+1 added-1 removed
modified:examples/error/index.js+1 added-1 removed
3 unmodified lines
45var express = require('../../');6var logger = require('morgan');7var app = module.exports = express();8var test = app.get('env') == 'test';8var test = app.get('env') === 'test'910if (!test) app.use(logger('dev'));1112// error handling middleware have an arity of 4
39 unmodified lines
modified:examples/error-pages/index.js+2 added-2 removed
4 unmodified lines
5var express = require('../../');6var path = require('path');7var app = module.exports = express();8var logger = require('morgan');9var silent = 'test' == process.env.NODE_ENV;9var silent = process.env.NODE_ENV === 'test'1011// general config12app.set('views', path.join(__dirname, 'views'));13app.set('view engine', 'ejs');
4 unmodified lines
18app.enable('verbose errors');1920// disable them in production21// use $ NODE_ENV=production node examples/error-pages22if ('production' == app.settings.env) app.disable('verbose errors');22if (app.settings.env === 'production') app.disable('verbose errors')2324silent || app.use(logger('dev'));2526// Routes
75 unmodified lines
modified:examples/route-map/index.js+1 added-1 removed
2 unmodified lines
3 */45var express = require('../../lib/express');67var verbose = process.env.NODE_ENV != 'test';7var verbose = process.env.NODE_ENV !== 'test'89var app = module.exports = express();1011app.map = function(a, route){
61 unmodified lines
modified:examples/route-middleware/index.js+2 added-2 removed
32 unmodified lines
3334function andRestrictToSelf(req, res, next) {35 // If our authenticated user is the user we are viewing36 // then everything is fine :)37 if (req.authenticatedUser.id == req.user.id) {37 if (req.authenticatedUser.id === req.user.id) {38 next();39 } else {40 // You may want to implement specific exceptions41 // such as UnauthorizedError or similar so that you
4 unmodified lines
46}4748function andRestrictTo(role) {49 return function(req, res, next) {50 if (req.authenticatedUser.role == role) {50 if (req.authenticatedUser.role === role) {51 next();52 } else {53 next(new Error('Unauthorized'));54 }
34 unmodified lines
modified:examples/search/public/client.js+1 added-1 removed
modified:examples/view-locals/index.js+1 added-1 removed
11 unmodified lines
1213// filter ferrets only1415function ferrets(user) {16 return user.species == 'ferret';16 return user.species === 'ferret'17}1819// naive nesting approach,20// delegating errors to next(err)
133 unmodified lines
modified:test/app.param.js+1 added-1 removed
6 unmodified lines
7 it('should map app.param(name, ...) logic', function(done){8 var app = express();910 app.param(function(name, regexp){11 if (Object.prototype.toString.call(regexp) == '[object RegExp]') { // See #155711 if (Object.prototype.toString.call(regexp) === '[object RegExp]') { // See #155712 return function(req, res, next, val){13 var captures;14 if (captures = regexp.exec(String(val))) {15 req.params[name] = captures[1];
351 unmodified lines
modified:test/app.router.js+2 added-2 removed
39 unmodified lines
40 it('should include ' + method.toUpperCase(), function(done){41 var app = express();4243 app[method]('/foo', function(req, res){44 if ('head' == method) {44 if (method === 'head') {45 res.end();46 } else {47 res.end(method);48 }49 });5051 request(app)52 [method]('/foo')53 .expect('head' == method ? '' : method, done);53 .expect(method === 'head' ? '' : method, done)54 })5556 it('should reject numbers for app.' + method, function(){57 var app = express();
1031 unmodified lines
modified:test/req.signedCookies.js+1 added-1 removed
9 unmodified lines
1011 app.use(cookieParser('secret'));1213 app.use(function(req, res){14 if ('/set' == req.path) {14 if (req.path === '/set') {15 res.cookie('obj', { foo: 'bar' }, { signed: true });16 res.end();17 } else {18 res.send(req.signedCookies);
18 unmodified lines
modified:test/res.format.js+3 added-3 removed
15 unmodified lines
16 res.send('<p>hey</p>');17 },1819 'application/json': function(a, b, c){20 assert(req == a);21 assert(res == b);22 assert(next == c);20 assert(req === a)21 assert(res === b)22 assert(next === c)23 res.send({ message: 'hey' });24 }25 });26});
189 unmodified lines
modified:test/res.json.js+1 added-1 removed
127 unmodified lines
128 it('should be passed to JSON.stringify()', function(done){129 var app = express();130131 app.set('json replacer', function(key, val){132 return '_' == key[0]132 return key[0] === '_'133 ? undefined134 : val;135 });136
77 unmodified lines
modified:test/res.jsonp.js+1 added-1 removed
267 unmodified lines
268 it('should be passed to JSON.stringify()', function(done){269 var app = express();270271 app.set('json replacer', function(key, val){272 return '_' == key[0]272 return key[0] === '_'273 ? undefined274 : val;275 });276
91 unmodified lines
modified:test/Router.js+4 added-4 removed
6 unmodified lines
78describe('Router', function(){9 it('should return a function with router methods', function() {10 var router = new Router();11 assert(typeof router == 'function');11 assert(typeof router === 'function')1213 assert(typeof router.get == 'function');14 assert(typeof router.handle == 'function');15 assert(typeof router.use == 'function');13 assert(typeof router.get === 'function')14 assert(typeof router.handle === 'function')15 assert(typeof router.use === 'function')16 });1718 it('should support .use of other routers', function(done){19 var router = new Router();
541 unmodified lines
modified:.eslintrc.yml+1 added
1root: true23rules:4 eol-last: error5 eqeqeq: [error, allow-null]6 indent: [error, 2, { SwitchCase: 1 }]7 no-trailing-spaces: error8 no-unused-vars: [error, { vars: all, args: none, ignoreRestSiblings: true }]