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

@@ -6,10 +6,10 @@ var Parse = require('parse/node').Parse;
const transformKey = (className, fieldName, schema) => {
// Check if the schema is known since it's a built-in field.
switch(fieldName) {
case 'objectId': return '_id';
case 'createdAt': return '_created_at';
case 'updatedAt': return '_updated_at';
case 'sessionToken': return '_session_token';
case 'objectId': return '_id';
case 'createdAt': return '_created_at';
case 'updatedAt': return '_updated_at';
case 'sessionToken': return '_session_token';
}
if (schema.fields[fieldName] && schema.fields[fieldName].__type == 'Pointer') {
@@ -197,7 +197,7 @@ function transformQueryKeyValue(className, key, value, schema) {
return {key: '$or', value: value.map(subQuery => transformWhere(className, subQuery, schema))};
case '$and':
return {key: '$and', value: value.map(subQuery => transformWhere(className, subQuery, schema))};
default:
default: {
// Other auth data
const authDataMatch = key.match(/^authData\.([a-zA-Z0-9_]+)\.id$/);
if (authDataMatch) {
@@ -206,6 +206,7 @@ function transformQueryKeyValue(className, key, value, schema) {
return {key: `_auth_data_${provider}.id`, value};
}
}
}
const expectedTypeIsArray =
schema &&
@@ -530,8 +531,8 @@ function transformConstraint(constraint, inArray) {
break;
case '$in':
case '$nin':
var arr = constraint[key];
case '$nin': {
let arr = constraint[key];
if (!(arr instanceof Array)) {
throw new Parse.Error(Parse.Error.INVALID_JSON, 'bad ' + key + ' value');
}
@@ -543,16 +544,16 @@ function transformConstraint(constraint, inArray) {
return result;
});
break;
case '$all':
var arr = constraint[key];
}
case '$all': {
let arr = constraint[key];
if (!(arr instanceof Array)) {
throw new Parse.Error(Parse.Error.INVALID_JSON,
'bad ' + key + ' value');
}
answer[key] = arr.map(transformInteriorAtom);
break;
}
case '$regex':
var s = constraint[key];
if (typeof s !== 'string') {
@@ -736,7 +737,7 @@ const mongoObjectToParseObject = (className, mongoObject, schema) => {
case 'symbol':
case 'function':
throw 'bad value in mongoObjectToParseObject';
case 'object':
case 'object': {
if (mongoObject === null) {
return null;
}
@@ -868,6 +869,7 @@ const mongoObjectToParseObject = (className, mongoObject, schema) => {
});
return { ...restObject, ...relationFields };
}
default:
throw 'unknown js type';
}