Skip to content

Commit

Permalink
eslint fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
fahad19 committed Dec 4, 2015
1 parent 404512b commit cf4d19b
Show file tree
Hide file tree
Showing 12 changed files with 124 additions and 110 deletions.
139 changes: 82 additions & 57 deletions .eslintrc
Expand Up @@ -4,166 +4,191 @@
"env": {
"node": true
},
"ecmaFeatures": {},
"rules": {
"no-alert": 2,
"no-alert": 0,
"no-array-constructor": 2,
"no-bitwise": 0,
"no-bitwise": 2,
"no-caller": 2,
"no-catch-shadow": 2,
"no-comma-dangle": 0,
"no-class-assign": 2,
"no-cond-assign": 2,
"no-console": 2,
"no-const-assign": 2,
"no-constant-condition": 2,
"no-continue": 0,
"no-control-regex": 2,
"no-debugger": 2,
"no-delete-var": 2,
"no-div-regex": 0,
"no-div-regex": 2,
"no-dupe-class-members": 2,
"no-dupe-keys": 2,
"no-dupe-args": 2,
"no-duplicate-case": 2,
"no-else-return": 0,
"no-else-return": 2,
"no-empty": 2,
"no-empty-class": 2,
"no-empty-character-class": 2,
"no-empty-label": 2,
"no-eq-null": 0,
"no-eq-null": 2,
"no-eval": 2,
"no-ex-assign": 2,
"no-extend-native": 2,
"no-extra-bind": 2,
"no-extra-bind": 0,
"no-extra-boolean-cast": 2,
"no-extra-parens": 0,
"no-extra-semi": 2,
"no-extra-strict": 2,
"no-fallthrough": 2,
"no-floating-decimal": 0,
"no-floating-decimal": 2,
"no-func-assign": 2,
"no-implicit-coercion": 0,
"no-implied-eval": 2,
"no-inline-comments": 0,
"no-inner-declarations": [2, "functions"],
"no-invalid-regexp": 2,
"no-invalid-this": 2,
"no-irregular-whitespace": 2,
"no-iterator": 2,
"no-iterator": 0,
"no-label-var": 2,
"no-labels": 2,
"no-lone-blocks": 2,
"no-lonely-if": 0,
"no-lonely-if": 2,
"no-loop-func": 2,
"no-mixed-requires": [0, false],
"no-mixed-requires": [2, false],
"no-mixed-spaces-and-tabs": [2, false],
"linebreak-style": [0, "unix"],
"linebreak-style": [2, "unix"],
"no-multi-spaces": 2,
"no-multi-str": 2,
"no-multiple-empty-lines": [0, {"max": 2}],
"no-multiple-empty-lines": [2, {"max": 1}],
"no-native-reassign": 2,
"no-negated-in-lhs": 2,
"no-nested-ternary": 0,
"no-nested-ternary": 2,
"no-new": 2,
"no-new-func": 2,
"no-new-object": 2,
"no-new-require": 0,
"no-new-require": 2,
"no-new-wrappers": 2,
"no-obj-calls": 2,
"no-octal": 2,
"no-octal-escape": 2,
"no-param-reassign": 0,
"no-param-reassign": 2,
"no-path-concat": 0,
"no-plusplus": 0,
"no-process-env": 0,
"no-process-exit": 2,
"no-process-exit": 0,
"no-proto": 2,
"no-redeclare": 2,
"no-regex-spaces": 2,
"no-reserved-keys": 0,
"no-restricted-modules": 0,
"no-restricted-syntax": 0,
"no-return-assign": 2,
"no-script-url": 2,
"no-self-compare": 0,
"no-self-compare": 2,
"no-sequences": 2,
"no-shadow": 2,
"no-shadow-restricted-names": 2,
"no-space-before-semi": 0,
"no-spaced-func": 2,
"no-shadow": 0,
"no-shadow-restricted-names": 0,
"no-spaced-func": 0,
"no-sparse-arrays": 2,
"no-sync": 0,
"no-ternary": 0,
"no-trailing-spaces": 2,
"no-throw-literal": 0,
"no-this-before-super": 2,
"no-throw-literal": 2,
"no-undef": 2,
"no-undef-init": 2,
"no-undefined": 0,
"no-underscore-dangle": 2,
"no-unneeded-ternary": 0,
"no-undefined": 2,
"no-unexpected-multiline": 2,
"no-underscore-dangle": 0,
"no-unneeded-ternary": 2,
"no-unreachable": 2,
"no-unused-expressions": 2,
"no-unused-vars": [2, {"vars": "all", "args": "after-used"}],
"no-use-before-define": 2,
"no-void": 0,
"no-useless-call": 2,
"no-useless-concat": 2,
"no-void": 2,
"no-var": 0,
"no-warning-comments": [0, { "terms": ["todo", "fixme", "xxx"], "location": "start" }],
"no-with": 2,
"no-wrap-func": 2,

"array-bracket-spacing": [2, "never"],
"arrow-parens": 0,
"arrow-spacing": 0,
"accessor-pairs": 0,
"block-scoped-var": 0,
"block-spacing": 0,
"brace-style": [0, "1tbs"],
"camelcase": 2,
"callback-return": 0,
"camelcase": 0,
"comma-dangle": [2, "never"],
"comma-spacing": 2,
"comma-spacing": 0,
"comma-style": 0,
"complexity": [0, 11],
"consistent-return": 2,
"computed-property-spacing": [0, "never"],
"consistent-return": 0,
"consistent-this": [0, "that"],
"constructor-super": 0,
"curly": [2, "all"],
"default-case": 0,
"default-case": 2,
"dot-location": 0,
"dot-notation": [2, { "allowKeywords": true }],
"eol-last": 2,
"eqeqeq": 2,
"eol-last": 0,
"eqeqeq": 0,
"func-names": 0,
"func-style": [0, "declaration"],
"generator-star": 0,
"generator-star-spacing": 0,
"global-strict": [2, "never"],
"global-require": 0,
"guard-for-in": 0,
"handle-callback-err": 0,
"id-length": 0,
"indent": 0,
"key-spacing": [2, { "beforeColon": false, "afterColon": true }],
"init-declarations": 0,
"jsx-quotes": [2, "prefer-double"],
"key-spacing": [0, { "beforeColon": false, "afterColon": true }],
"lines-around-comment": 0,
"max-depth": [0, 4],
"max-len": [0, 80, 4],
"max-nested-callbacks": [0, 2],
"max-params": [0, 3],
"max-statements": [0, 10],
"new-cap": 2,
"new-parens": 2,
"new-cap": 0,
"new-parens": 0,
"newline-after-var": 0,
"object-curly-spacing": [0, "never"],
"object-shorthand": 0,
"one-var": 0,
"one-var": [0, "always"],
"operator-assignment": [0, "always"],
"operator-linebreak": 0,
"padded-blocks": 0,
"prefer-arrow-callback": 0,
"prefer-const": 0,
"prefer-spread": 0,
"prefer-reflect": 0,
"prefer-template": 0,
"quote-props": 0,
"quotes": [1, "single"],
"radix": 0,
"semi": 2,
"quotes": [2, "single"],
"radix": 2,
"id-match": 0,
"require-jsdoc": 0,
"require-yield": 0,
"semi": [2, "always"],
"semi-spacing": [2, {"before": false, "after": true}],
"sort-vars": 0,
"space-after-function-name": [0, "never"],
"space-after-keywords": [0, "always"],
"space-after-keywords": [2, "always"],
"space-before-keywords": [0, "always"],
"space-before-blocks": [0, "always"],
"space-before-function-paren": [0, "always"],
"space-before-function-parentheses": [0, "always"],
"space-in-brackets": [0, "never"],
"space-before-function-paren": [2, {"anonymous": "always", "named": "never"}],
"space-in-parens": [0, "never"],
"space-infix-ops": 2,
"space-return-throw-case": 2,
"space-unary-ops": [2, { "words": true, "nonwords": false }],
"spaced-line-comment": [0, "always"],
"strict": [2, "never"],
"space-infix-ops": 0,
"space-return-throw-case": 0,
"space-unary-ops": [0, { "words": true, "nonwords": false }],
"spaced-comment": 0,
"strict": 0,
"use-isnan": 2,
"valid-jsdoc": 0,
"valid-typeof": 2,
"vars-on-top": 0,
"wrap-iife": 0,
"wrap-regex": 0,
"yoda": [2, "never"]
"yoda": [0, "never"]
}
}
12 changes: 5 additions & 7 deletions src/Collection.js
Expand Up @@ -529,7 +529,7 @@ export default class Collection {
// * `callbacks`: Defaults to true, pass false to disable before/after callbacks.
//
validate(model, options = {}) {
let callbacks = (_.isUndefined(options.callbacks) || options.callbacks) ? true : false;
let callbacks = (_.isUndefined(options.callbacks) || options.callbacks);

return new P((resolve, reject) => {
return async.waterfall([
Expand Down Expand Up @@ -655,10 +655,8 @@ export default class Collection {
//
// Returns a promise with true if validated, otherwise error message
//
validateField(model, field, value = null) {
if (!value) {
value = model.get(field);
}
validateField(model, field, givenValue = null) {
const value = !givenValue ? model.get(field) : givenValue;

let fieldSchema = this.schema[field];
if (!_.isObject(fieldSchema) || !fieldSchema.validate) {
Expand Down Expand Up @@ -748,7 +746,7 @@ export default class Collection {
// * `callbacks`: Defaults to true, pass false to disable before/after callbacks.
//
save(model, options = {}) {
let callbacks = (_.isUndefined(options.callbacks) || options.callbacks) ? true : false;
let callbacks = (_.isUndefined(options.callbacks) || options.callbacks);

return new P((resolve, reject) => {
return async.waterfall([
Expand Down Expand Up @@ -868,7 +866,7 @@ export default class Collection {
// * `callbacks`: Defaults to true, pass false to disable before/after callbacks.
//
delete(model, options = {}) {
let callbacks = (_.isUndefined(options.callbacks) || options.callbacks) ? true : false;
let callbacks = (_.isUndefined(options.callbacks) || options.callbacks);

return new P((resolve, reject) => {
return async.waterfall([
Expand Down
2 changes: 1 addition & 1 deletion src/Model.js
Expand Up @@ -160,7 +160,7 @@ export default class Model {
// Is the current model new? As in saved in Database, or yet to be saved?
//
isNew() {
return this.getId() ? false : true;
return this.getId() ? false : true; // eslint-disable-line
}

// ### save(options = {})
Expand Down
10 changes: 5 additions & 5 deletions src/Query.js
Expand Up @@ -26,11 +26,11 @@ import Functions from './Functions';
// ```
//
export default class Query {
constructor(options = {}) {
options = {
constructor(givenOptions = {}) {
const options = {
expressionClass: Expression,
functionsClass: Functions,
...options
...givenOptions
};

this.adapter = null;
Expand Down Expand Up @@ -63,11 +63,11 @@ export default class Query {
return this;
}

select(fields) { return this; }
select() { return this; }

distinct() { return this; }

from(table, alias) { return this; }
from() { return this; }

where() { return this; }

Expand Down
4 changes: 2 additions & 2 deletions src/Schema.js
Expand Up @@ -9,11 +9,11 @@ export default class Schema {
return this.adapter.getConnection();
}

dropTable(collection) {
dropTable(collection) { // eslint-disable-line
return new P.resolve(true);
}

createTable(collection) {
createTable(collection) { // eslint-disable-line
return new P.resolve(true);
}

Expand Down
14 changes: 5 additions & 9 deletions src/adapters/Memory/Adapter.js
@@ -1,15 +1,11 @@
/* eslint-disable new-cap */

import _ from 'lodash';
import f from '../../';
import async from 'async';

import {Adapter} from '../../';

import Query from './Query';
import Schema from './Schema';

let P = f.Promise;
let Adapter = f.Adapter;

// ## Usage
//
// ### Node.js
Expand Down Expand Up @@ -61,11 +57,11 @@ let Adapter = f.Adapter;
// ```
//
export default class MemoryAdapter extends Adapter {
constructor(options) {
options = {
constructor(givenOptions = {}) {
const options = {
queryClass: Query,
schemaClass: Schema,
...options
...givenOptions
};

super(options);
Expand Down

0 comments on commit cf4d19b

Please sign in to comment.