Update eslint rules
This commit is contained in:
parent
cee14ba99c
commit
1da22c1029
@ -1,12 +1,15 @@
|
||||
{
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2017
|
||||
"ecmaVersion": 2018
|
||||
},
|
||||
|
||||
"extends": "eslint:recommended",
|
||||
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true
|
||||
},
|
||||
|
||||
"rules": {
|
||||
"strict": ["error", "global"],
|
||||
/* possible errors */
|
||||
@ -14,6 +17,7 @@
|
||||
"no-empty": ["error", { "allowEmptyCatch": true }], // disallow empty block statements
|
||||
/* best practices */
|
||||
"curly": 2, // enforce consistent brace style for all control statements
|
||||
"no-return-await": 2, // disallows unnecessary return await
|
||||
"no-eval": 2, // disallow the use of eval()
|
||||
"no-extend-native": 2, // disallow extending native types
|
||||
"no-global-assign": 2, // disallow assignments to native objects or read-only global variables
|
||||
@ -21,10 +25,13 @@
|
||||
"no-implicit-globals": 2, // disallow var and named function declarations in the global scope
|
||||
"no-implied-eval": 2, // disallow the use of eval()-like methods
|
||||
"no-lone-blocks": 2, // disallow unnecessary nested blocks
|
||||
"no-unused-vars": ["error", {"ignoreRestSiblings": true}], // disallow unused variables
|
||||
"no-useless-escape": 0, // disallow unnecessary escape characters
|
||||
/* Stylistic Issues */
|
||||
"array-bracket-newline": ["warn", "consistent"], // enforce consisten line breaks after opening and before closing array brackets
|
||||
"array-bracket-spacing": 1, // enforce consistent spacing inside array brackets
|
||||
"block-spacing": 1, // enforce consistent spacing inside single-line blocks
|
||||
"brace-style": ["warn", "1tbs", { "allowSingleLine": true }], // enforce consistent brace style for blocks
|
||||
"comma-spacing": 1, // enforce consistent spacing before and after commas
|
||||
"computed-property-spacing": 1, // enforce consistent spacing inside computed property brackets
|
||||
"eol-last": 1, // enforce at least one newline at the end of files
|
||||
@ -33,19 +40,20 @@
|
||||
"key-spacing": ["warn", { "mode": "minimum" }], // enforce consistent spacing before and after keywords
|
||||
"keyword-spacing": 1, // enforce consistent spacing between keys and values in object literal properties
|
||||
"linebreak-style": 1, // enforce consistent linebreak style
|
||||
"lines-between-class-members": 1, // require or disallow an empty line between class members
|
||||
"no-multiple-empty-lines": ["warn", {"max": 1}], // disallow multiple empty lines
|
||||
"no-trailing-spaces": 1, // disallow trailing whitespace at the end of lines
|
||||
"no-var": 1, // require let or const instead of var
|
||||
"object-curly-newline": ["warn", {"consistent": true}], // enforce consistent line breaks inside braces
|
||||
"object-curly-spacing": ["warn", "never"], // enforce consistent spacing inside braces
|
||||
"one-var": ["warn", "never"], // enforce variables to be declared either together or separately in functions
|
||||
"padded-blocks": ["warn", "never"], // require or disallow padding within blocks
|
||||
"prefer-object-spread": 1, // disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead.
|
||||
"quotes": ["warn", "single", {"avoidEscape": true}], // enforce the consistent use of single quotes
|
||||
"semi": ["warn", "always"], // require or disallow semicolons instead of ASI
|
||||
"semi-spacing": 1, // enforce consistent spacing before and after semicolons
|
||||
"space-before-blocks": 1, // enforce consistent spacing before blocks
|
||||
"space-before-function-paren": ["warn", {
|
||||
"anonymous": "never",
|
||||
"named": "never",
|
||||
"asyncArrow": "always"
|
||||
}], // enforce consistent spacing before function definition opening parenthesis
|
||||
"space-before-function-paren": ["warn", { "anonymous": "never", "named": "never", "asyncArrow": "always" }], // enforce consistent spacing before function definition opening parenthesis
|
||||
"space-in-parens": ["warn", "never"], // enforce consistent spacing inside parentheses
|
||||
"space-infix-ops": 1, // require spacing around operators
|
||||
/* ES6 */
|
||||
@ -55,9 +63,10 @@
|
||||
"no-useless-constructor": 1, // disallow unnecessary constructors
|
||||
"object-shorthand": ["warn", "always", {"avoidQuotes": true}], // require or disallow method and property shorthand syntax for object literals
|
||||
"prefer-arrow-callback": ["warn", {"allowNamedFunctions": true}], // require arrow functions as callbacks
|
||||
"prefer-const": 1, // require const declarations for variables that are never reassigned after declared
|
||||
"prefer-const": ["warn", {"destructuring": "all"}], // require const declarations for variables that are never reassigned after declared
|
||||
"prefer-template": 1, // require template literals instead of string concatenation
|
||||
"template-curly-spacing": ["warn", "never"] // require or disallow spacing around embedded expressions of template strings
|
||||
},
|
||||
|
||||
"root": true
|
||||
}
|
@ -25,7 +25,6 @@ require('winston-papertrail');
|
||||
log.exitOnError = false;
|
||||
log.level = config.log.level;
|
||||
|
||||
|
||||
// Reformat logging text, due to deprecated logger usage
|
||||
const formatLogs = log.format(info => {
|
||||
info.message = `${info.message} -> ${info[SPLAT].join(', ')}`;
|
||||
|
@ -1,11 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
exports.verifyKey = ({name, baseUrl, keyId, nonce}) => ({
|
||||
subject: `Verify Your Key`,
|
||||
subject: 'Verify Your Key',
|
||||
text: `Hello ${name},\n\nplease click here to verify your email address:\n\n${baseUrl}/api/v1/key?op=verify&keyId=${keyId}&nonce=${nonce}`,
|
||||
});
|
||||
|
||||
exports.verifyRemove = ({name, baseUrl, keyId, nonce}) => ({
|
||||
subject: `Verify Key Removal`,
|
||||
subject: 'Verify Key Removal',
|
||||
text: `Hello ${name},\n\nplease click here to verify the removal of your email address:\n\n${baseUrl}/api/v1/key?op=verifyRemove&keyId=${keyId}&nonce=${nonce}`,
|
||||
});
|
||||
|
@ -33,6 +33,7 @@ class PGP {
|
||||
openpgp.config.show_version = false;
|
||||
openpgp.config.show_comment = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse an ascii armored pgp key block and get its parameters.
|
||||
* @param {String} publicKeyArmored ascii armored pgp key block
|
||||
|
@ -1,12 +1,15 @@
|
||||
{
|
||||
"extends": "../.eslintrc",
|
||||
"extends": "../.eslintrc.json",
|
||||
|
||||
"rules": {
|
||||
"no-shadow": 1
|
||||
},
|
||||
|
||||
"globals": {
|
||||
"expect": true,
|
||||
"sinon": true
|
||||
},
|
||||
|
||||
"env": {
|
||||
"mocha": true
|
||||
}
|
@ -35,7 +35,7 @@ describe('Email Integration Tests', function() {
|
||||
};
|
||||
});
|
||||
|
||||
describe("_sendHelper", () => {
|
||||
describe('_sendHelper', () => {
|
||||
it('should work', async () => {
|
||||
const mailOptions = {
|
||||
from: {name: email._sender.name, address: email._sender.email},
|
||||
@ -49,7 +49,7 @@ describe('Email Integration Tests', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("send verifyKey template", () => {
|
||||
describe('send verifyKey template', () => {
|
||||
it('should send plaintext email', async () => {
|
||||
delete userId.publicKeyArmored;
|
||||
await email.send({template: tpl.verifyKey, userId, keyId, origin});
|
||||
@ -60,7 +60,7 @@ describe('Email Integration Tests', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("send verifyRemove template", () => {
|
||||
describe('send verifyRemove template', () => {
|
||||
it('should send plaintext email', async () => {
|
||||
delete userId.publicKeyArmored;
|
||||
await email.send({template: tpl.verifyRemove, userId, keyId, origin});
|
||||
|
@ -28,7 +28,7 @@ describe('Mongo Integration Tests', function() {
|
||||
await mongo.disconnect();
|
||||
});
|
||||
|
||||
describe("create", () => {
|
||||
describe('create', () => {
|
||||
it('should insert a document', async () => {
|
||||
const r = await mongo.create({_id: '0'}, DB_TYPE);
|
||||
expect(r.insertedCount).to.equal(1);
|
||||
@ -45,7 +45,7 @@ describe('Mongo Integration Tests', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("batch", () => {
|
||||
describe('batch', () => {
|
||||
it('should insert a document', async () => {
|
||||
const r = await mongo.batch([{_id: '0'}, {_id: '1'}], DB_TYPE);
|
||||
expect(r.insertedCount).to.equal(2);
|
||||
@ -62,7 +62,7 @@ describe('Mongo Integration Tests', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("update", () => {
|
||||
describe('update', () => {
|
||||
it('should update a document', async () => {
|
||||
let r = await mongo.create({_id: '0'}, DB_TYPE);
|
||||
r = await mongo.update({_id: '0'}, {foo: 'bar'}, DB_TYPE);
|
||||
@ -72,7 +72,7 @@ describe('Mongo Integration Tests', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("get", () => {
|
||||
describe('get', () => {
|
||||
it('should get a document', async () => {
|
||||
let r = await mongo.create({_id: '0'}, DB_TYPE);
|
||||
r = await mongo.get({_id: '0'}, DB_TYPE);
|
||||
@ -80,7 +80,7 @@ describe('Mongo Integration Tests', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("list", () => {
|
||||
describe('list', () => {
|
||||
it('should list documents', async () => {
|
||||
let r = await mongo.batch([{_id: '0', foo: 'bar'}, {_id: '1', foo: 'bar'}], DB_TYPE);
|
||||
r = await mongo.list({foo: 'bar'}, DB_TYPE);
|
||||
@ -88,7 +88,7 @@ describe('Mongo Integration Tests', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("remove", () => {
|
||||
describe('remove', () => {
|
||||
it('should remove a document', async () => {
|
||||
let r = await mongo.create({_id: '0'}, DB_TYPE);
|
||||
r = await mongo.remove({_id: '0'}, DB_TYPE);
|
||||
|
@ -57,7 +57,7 @@ describe('Email Unit Tests', () => {
|
||||
sandbox.restore();
|
||||
});
|
||||
|
||||
describe("send", () => {
|
||||
describe('send', () => {
|
||||
beforeEach(() => {
|
||||
sandbox.stub(email, '_sendHelper').returns(Promise.resolve({response: '250'}));
|
||||
});
|
||||
@ -69,7 +69,7 @@ describe('Email Unit Tests', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("_sendHelper", () => {
|
||||
describe('_sendHelper', () => {
|
||||
it('should work', async () => {
|
||||
sendFnStub.returns(Promise.resolve({response: '250'}));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user