Permalink
Browse files

lint: remove usages of "=="

closes #3540
  • Loading branch information...
estrada9166 authored and dougwilson committed Jan 22, 2018
1 parent 972ada9 commit 40e04ec7a6d365a7e083b0fdf7f9d2c7afc036a0
@@ -2,6 +2,7 @@ root: true
rules:
eol-last: error
eqeqeq: [error, allow-null]
indent: [error, 2, { SwitchCase: 1 }]
no-trailing-spaces: error
no-unused-vars: [error, { vars: all, args: none, ignoreRestSiblings: true }]
@@ -65,7 +65,7 @@ function authenticate(name, pass, fn) {
// found the user
hash({ password: pass, salt: user.salt }, function (err, pass, salt, hash) {
if (err) return fn(err);
if (hash == user.hash) return fn(null, user);
if (hash === user.hash) return fn(null, user)
fn(new Error('invalid password'));
});
}
@@ -8,7 +8,7 @@ var logger = require('morgan');
var cookieParser = require('cookie-parser');
// custom log format
if ('test' != process.env.NODE_ENV) app.use(logger(':method :url'));
if (process.env.NODE_ENV !== 'test') app.use(logger(':method :url'))
// parses request cookies, populating
// req.cookies and req.signedCookies
@@ -6,7 +6,7 @@ var express = require('../../');
var path = require('path');
var app = module.exports = express();
var logger = require('morgan');
var silent = 'test' == process.env.NODE_ENV;
var silent = process.env.NODE_ENV === 'test'
// general config
app.set('views', path.join(__dirname, 'views'));
@@ -19,7 +19,7 @@ app.enable('verbose errors');
// disable them in production
// use $ NODE_ENV=production node examples/error-pages
if ('production' == app.settings.env) app.disable('verbose errors');
if (app.settings.env === 'production') app.disable('verbose errors')
silent || app.use(logger('dev'));
@@ -5,7 +5,7 @@
var express = require('../../');
var logger = require('morgan');
var app = module.exports = express();
var test = app.get('env') == 'test';
var test = app.get('env') === 'test'
if (!test) app.use(logger('dev'));
@@ -4,7 +4,7 @@
var express = require('../../lib/express');
var verbose = process.env.NODE_ENV != 'test';
var verbose = process.env.NODE_ENV !== 'test'
var app = module.exports = express();
@@ -34,7 +34,7 @@ function loadUser(req, res, next) {
function andRestrictToSelf(req, res, next) {
// If our authenticated user is the user we are viewing
// then everything is fine :)
if (req.authenticatedUser.id == req.user.id) {
if (req.authenticatedUser.id === req.user.id) {
next();
} else {
// You may want to implement specific exceptions
@@ -47,7 +47,7 @@ function andRestrictToSelf(req, res, next) {
function andRestrictTo(role) {
return function(req, res, next) {
if (req.authenticatedUser.role == role) {
if (req.authenticatedUser.role === role) {
next();
} else {
next(new Error('Unauthorized'));
@@ -5,7 +5,7 @@ search.addEventListener('keyup', function(){
var xhr = new XMLHttpRequest;
xhr.open('GET', '/search/' + search.value, true);
xhr.onreadystatechange = function(){
if (4 == xhr.readyState) {
if (xhr.readyState === 4) {
code.textContent = xhr.responseText;
}
};
@@ -13,7 +13,7 @@ app.set('view engine', 'ejs');
// filter ferrets only
function ferrets(user) {
return user.species == 'ferret';
return user.species === 'ferret'
}
// naive nesting approach,
@@ -8,11 +8,11 @@ var express = require('../')
describe('Router', function(){
it('should return a function with router methods', function() {
var router = new Router();
assert(typeof router == 'function');
assert(typeof router === 'function')
assert(typeof router.get == 'function');
assert(typeof router.handle == 'function');
assert(typeof router.use == 'function');
assert(typeof router.get === 'function')
assert(typeof router.handle === 'function')
assert(typeof router.use === 'function')
});
it('should support .use of other routers', function(done){
@@ -8,7 +8,7 @@ describe('app', function(){
var app = express();
app.param(function(name, regexp){
if (Object.prototype.toString.call(regexp) == '[object RegExp]') { // See #1557
if (Object.prototype.toString.call(regexp) === '[object RegExp]') { // See #1557
return function(req, res, next, val){
var captures;
if (captures = regexp.exec(String(val))) {
@@ -41,7 +41,7 @@ describe('app.router', function(){
var app = express();
app[method]('/foo', function(req, res){
if ('head' == method) {
if (method === 'head') {
res.end();
} else {
res.end(method);
@@ -50,7 +50,7 @@ describe('app.router', function(){
request(app)
[method]('/foo')
.expect('head' == method ? '' : method, done);
.expect(method === 'head' ? '' : method, done)
})
it('should reject numbers for app.' + method, function(){
@@ -11,7 +11,7 @@ describe('req', function(){
app.use(cookieParser('secret'));
app.use(function(req, res){
if ('/set' == req.path) {
if (req.path === '/set') {
res.cookie('obj', { foo: 'bar' }, { signed: true });
res.end();
} else {
@@ -17,9 +17,9 @@ app1.use(function(req, res, next){
},
'application/json': function(a, b, c){
assert(req == a);
assert(res == b);
assert(next == c);
assert(req === a)
assert(res === b)
assert(next === c)
res.send({ message: 'hey' });
}
});
@@ -129,7 +129,7 @@ describe('res', function(){
var app = express();
app.set('json replacer', function(key, val){
return '_' == key[0]
return key[0] === '_'
? undefined
: val;
});
@@ -269,7 +269,7 @@ describe('res', function(){
var app = express();
app.set('json replacer', function(key, val){
return '_' == key[0]
return key[0] === '_'
? undefined
: val;
});

0 comments on commit 40e04ec

Please sign in to comment.