Adds liniting into the workflow (#3082)

* initial linting of src

* fix indent to 2 spaces

* Removes unnecessary rules

* ignore spec folder for now

* Spec linting

* Fix spec indent

* nits

* nits

* no no-empty rule
This commit is contained in:
Florent Vilmart
2016-11-24 15:47:41 -05:00
committed by GitHub
parent 6e2fba4ae4
commit 8c2c76dd26
149 changed files with 3478 additions and 3507 deletions

View File

@@ -1,11 +1,5 @@
import {
numberParser,
numberOrBoolParser,
objectParser,
arrayParser,
moduleOrObjectParser,
booleanParser,
nullParser
numberParser
} from '../utils/parsers';
@@ -40,9 +34,9 @@ export default {
help: "Optional. This string defines the log level of the LiveQuery server. We support VERBOSE, INFO, ERROR, NONE. Defaults to INFO.",
},
"port": {
env: "PORT",
help: "The port to run the ParseServer. defaults to 1337.",
default: 1337,
action: numberParser("port")
env: "PORT",
help: "The port to run the ParseServer. defaults to 1337.",
default: 1337,
action: numberParser("port")
},
};

View File

@@ -21,10 +21,10 @@ export default {
required: true
},
"port": {
env: "PORT",
help: "The port to run the ParseServer. defaults to 1337.",
default: 1337,
action: numberParser("port")
env: "PORT",
help: "The port to run the ParseServer. defaults to 1337.",
default: 1337,
action: numberParser("port")
},
"databaseURI": {
env: "PARSE_SERVER_DATABASE_URI",
@@ -150,11 +150,6 @@ export default {
help: "Adapter module for the logging sub-system",
action: moduleOrObjectParser
},
"liveQuery": {
env: "PARSE_SERVER_LIVE_QUERY_OPTIONS",
help: "liveQuery options",
action: objectParser
},
"customPages": {
env: "PARSE_SERVER_CUSTOM_PAGES",
help: "custom pages for password validation and reset",
@@ -210,7 +205,8 @@ export default {
help: "Run with cluster, optionally set the number of processes default to os.cpus().length",
action: numberOrBoolParser("cluster")
},
"liveQuery": {
"liveQuery": {
env: "PARSE_SERVER_LIVE_QUERY_OPTIONS",
help: "parse-server's LiveQuery configuration object",
action: objectParser
},

View File

@@ -1,4 +1,4 @@
import path from 'path';
/* eslint-disable no-console */
import express from 'express';
import { ParseServer } from '../index';
import definitions from './definitions/parse-server';
@@ -65,7 +65,7 @@ function startServer(options, callback) {
for (const socketId in sockets) {
try {
sockets[socketId].destroy();
} catch (e) { }
} catch (e) { /* */ }
}
}
@@ -115,12 +115,12 @@ runner({
for(var i = 0; i < numCPUs; i++) {
cluster.fork();
}
cluster.on('exit', (worker, code, signal) => {
console.log(`worker ${worker.process.pid} died... Restarting`);
cluster.on('exit', (worker, code) => {
console.log(`worker ${worker.process.pid} died (${code})... Restarting`);
cluster.fork();
});
} else {
startServer(options, () => {
startServer(options, () => {
console.log('['+process.pid+'] parse-server running on '+options.serverURL);
});
}
@@ -134,5 +134,4 @@ runner({
}
})
/* eslint-enable no-console */

View File

@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import { Command } from 'commander';
import path from 'path';
let _definitions;
@@ -27,18 +28,18 @@ Command.prototype.loadDefinitions = function(definitions) {
}, {});
_reverseDefinitions = Object.keys(definitions).reduce((object, key) => {
let value = definitions[key];
if (typeof value == "object") {
value = value.env;
}
if (value) {
object[value] = key;
}
return object;
}, {});
let value = definitions[key];
if (typeof value == "object") {
value = value.env;
}
if (value) {
object[value] = key;
}
return object;
}, {});
/* istanbul ignore next */
this.on('--help', function(){
this.on('--help', function(){
console.log(' Configure From Environment:');
console.log('');
Object.keys(_reverseDefinitions).forEach((key) => {
@@ -93,9 +94,9 @@ function parseConfigFile(program) {
Command.prototype.setValuesIfNeeded = function(options) {
Object.keys(options).forEach((key) => {
if (!this[key]) {
this[key] = options[key];
}
if (!this[key]) {
this[key] = options[key];
}
});
}
@@ -124,3 +125,4 @@ Command.prototype.getOptions = function() {
}
export default new Command();
/* eslint-enable no-console */

View File

@@ -46,7 +46,7 @@ export function moduleOrObjectParser(opt) {
}
try {
return JSON.parse(opt);
} catch(e) {}
} catch(e) { /* */ }
return opt;
}

View File

@@ -1,6 +1,5 @@
import program from './commander';
import { mergeWithOptions } from './commander';
function logStartupOptions(options) {
for (let key in options) {
@@ -11,7 +10,9 @@ function logStartupOptions(options) {
if (typeof value === 'object') {
value = JSON.stringify(value);
}
/* eslint-disable no-console */
console.log(`${key}: ${value}`);
/* eslint-enable no-console */
}
}