Resolve linter issues

This commit is contained in:
Chi Vinh Le
2018-06-05 04:28:54 +02:00
parent d9a1d739dc
commit ccff6ed63b
148 changed files with 1171 additions and 265 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ const processUpdates = async (model, updates) => {
const debugProcessStatistics = (count, totalCount) => {
if (totalCount > 0) {
debug(
`processed ${(count / totalCount * 100).toFixed(
`processed ${((count / totalCount) * 100).toFixed(
2
)}% (${count}/${totalCount}) updates`
);
+5 -1
View File
@@ -7,7 +7,11 @@ const debug = require('debug')('talk:services:migration');
const sc = require('snake-case');
const helpers = require('./helpers');
const { stripIndent } = require('common-tags');
const { talk: { migration: { minVersion } } } = require('../../package.json');
const {
talk: {
migration: { minVersion },
},
} = require('../../package.json');
const migrationTemplate = stripIndent`
module.exports = {
+3 -1
View File
@@ -82,7 +82,9 @@ const compose = phases => async (ctx, comment, options) => {
* @param {Object} comment comment object to use
*/
const fetchOptions = async (ctx, comment) => {
const { loaders: { Settings, Assets } } = ctx;
const {
loaders: { Settings, Assets },
} = ctx;
// Load the settings.
const settings = await Settings.load();
+5 -1
View File
@@ -4,7 +4,11 @@ const { ErrCommentTooShort } = require('../../../errors');
module.exports = (
ctx,
comment,
{ asset: { settings: { charCountEnable, charCount } } }
{
asset: {
settings: { charCountEnable, charCount },
},
}
) => {
// Check to see if the body is too short, if it is, then complain about it!
if (comment.body.length < 2) {
+5 -1
View File
@@ -3,7 +3,11 @@ const get = require('lodash/get');
// This phase checks to see if the user making the comment is allowed to do so
// considering their reliability (Trust) status.
module.exports = ctx => {
const { connectors: { services: { Karma } } } = ctx;
const {
connectors: {
services: { Karma },
},
} = ctx;
const trust = get(ctx, 'user.metadata.trust', null);
// If the user is not a reliable commenter (passed the unreliability
+5 -1
View File
@@ -5,7 +5,11 @@ const linkify = require('linkify-it')().tlds(require('tlds'));
module.exports = (
ctx,
comment,
{ asset: { settings: { premodLinksEnable } } }
{
asset: {
settings: { premodLinksEnable },
},
}
) => {
if (premodLinksEnable && linkify.test(comment.body)) {
// Add the flag related to Trust to the comment.
+9 -1
View File
@@ -1,6 +1,14 @@
// This phase checks to see if the settings have premod enabled, if they do,
// the comment is premod, otherwise, it's just none.
module.exports = (ctx, comment, { asset: { settings: { moderation } } }) => {
module.exports = (
ctx,
comment,
{
asset: {
settings: { moderation },
},
}
) => {
// If the settings say that we're in premod mode, then the comment is in
// premod status.
if (moderation === 'PRE') {
+5 -1
View File
@@ -2,7 +2,11 @@ const { DISABLE_AUTOFLAG_SUSPECT_WORDS } = require('../../../config');
// This phase checks the comment against the wordlist.
module.exports = async (ctx, comment, { settings }) => {
const { connectors: { services: { Wordlist } } } = ctx;
const {
connectors: {
services: { Wordlist },
},
} = ctx;
// Create a new instance of the Wordlist.
const wl = new Wordlist();
+8 -5
View File
@@ -44,11 +44,14 @@ if (WEBPACK) {
// Connect to the Mongo instance.
mongoose
.connect(MONGO_URL, {
config: {
autoIndex: CREATE_MONGO_INDEXES,
},
})
.connect(
MONGO_URL,
{
config: {
autoIndex: CREATE_MONGO_INDEXES,
},
}
)
.catch(err => {
console.error(err);
process.exit(1);
+7 -1
View File
@@ -66,7 +66,13 @@ module.exports = class SetupService {
/**
* This will perform the setup.
*/
static async setup(ctx, { settings, user: { email, password, username } }) {
static async setup(
ctx,
{
settings,
user: { email, password, username },
}
) {
// Validate the settings first.
await SetupService.validate({
settings,