thibremy/fortune-redis

View on GitHub
src/index.js

Summary

Maintainability
A
2 hrs
Test Coverage

Function update has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  update(type, updates) {
    if (!updates.length) {
      return super.update()
    }

Severity: Minor
Found in src/index.js - About 1 hr to fix

    Function create has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      create(type, records) {
        if (!records.length) {
          return super.create()
        }
        const {redis} = this
    Severity: Minor
    Found in src/index.js - About 1 hr to fix

      A space is required before '}'.
      Open

          const {ConflictError} = this.errors
      Severity: Minor
      Found in src/index.js by eslint

      enforce consistent spacing inside braces (object-curly-spacing)

      While formatting preferences are very personal, a number of style guides require or disallow spaces between curly braces in the following situations:

      // simple object literals
      var obj = { foo: "bar" };
      
      // nested object literals
      var obj = { foo: { zoo: "bar" } };
      
      // destructuring assignment (EcmaScript 6)
      var { x, y } = y;
      
      // import/export declarations (EcmaScript 6)
      import { foo } from "bar";
      export { foo };

      Rule Details

      This rule enforce consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.

      Options

      This rule has two options, a string option and an object option.

      String option:

      • "never" (default) disallows spacing inside of braces
      • "always" requires spacing inside of braces (except {})

      Object option:

      • "arraysInObjects": true requires spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to never)
      • "arraysInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to always)
      • "objectsInObjects": true requires spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to never)
      • "objectsInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to always)

      never

      Examples of incorrect code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = { 'foo': 'bar' };
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux'}, bar};
      var {x } = y;
      import { foo } from 'bar';

      Examples of correct code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': {'bar': 'baz'}, 'qux': 'quxx'};
      var obj = {
        'foo': 'bar'
      };
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var obj = {};
      var {x} = y;
      import {foo} from 'bar';

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux' }, bar};
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var {x} = y;
      import {foo } from 'bar';

      Examples of correct code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {};
      var obj = { 'foo': 'bar' };
      var obj = { 'foo': { 'bar': 'baz' }, 'qux': 'quxx' };
      var obj = {
        'foo': 'bar'
      };
      var { x } = y;
      import { foo } from 'bar';

      arraysInObjects

      Examples of additional correct code for this rule with the "never", { "arraysInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "arraysInObjects": true }]*/
      
      var obj = {"foo": [ 1, 2 ] };
      var obj = {"foo": [ "baz", "bar" ] };

      Examples of additional correct code for this rule with the "always", { "arraysInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "arraysInObjects": false }]*/
      
      var obj = { "foo": [ 1, 2 ]};
      var obj = { "foo": [ "baz", "bar" ]};

      objectsInObjects

      Examples of additional correct code for this rule with the "never", { "objectsInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "objectsInObjects": true }]*/
      
      var obj = {"foo": {"baz": 1, "bar": 2} };

      Examples of additional correct code for this rule with the "always", { "objectsInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "objectsInObjects": false }]*/
      
      var obj = { "foo": { "baz": 1, "bar": 2 }};

      When Not To Use It

      You can turn this rule off if you are not concerned with the consistency of spacing between curly braces.

      Related Rules

      Unexpected block statement surrounding arrow body.
      Open

          const concatIds = (replies) => {
      Severity: Minor
      Found in src/index.js by eslint

      Require braces in arrow function body (arrow-body-style)

      Arrow functions have two syntactic forms for their function bodies. They may be defined with a block body (denoted by curly braces) () => { ... } or with a single expression () => ..., whose value is implicitly returned.

      Rule Details

      This rule can enforce or disallow the use of braces around arrow function body.

      Options

      The rule takes one or two options. The first is a string, which can be:

      • "always" enforces braces around the function body
      • "as-needed" enforces no braces where they can be omitted (default)
      • "never" enforces no braces around the function body (constrains arrow functions to the role of returning an expression)

      The second one is an object for more fine-grained configuration when the first option is "as-needed". Currently, the only available option is requireReturnForObjectLiteral, a boolean property. It's false by default. If set to true, it requires braces and an explicit return for object literals.

      "arrow-body-style": ["error", "always"]

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint arrow-body-style: ["error", "always"]*/
      /*eslint-env es6*/
      let foo = () => 0;

      Examples of correct code for this rule with the "always" option:

      let foo = () => {
          return 0;
      };
      let foo = (retv, name) => {
          retv[name] = true;
          return retv;
      };

      as-needed

      Examples of incorrect code for this rule with the default "as-needed" option:

      /*eslint arrow-body-style: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      let foo = () => {
          return 0;
      };
      let foo = () => {
          return {
             bar: {
                  foo: 1,
                  bar: 2,
              }
          };
      };

      Examples of correct code for this rule with the default "as-needed" option:

      /*eslint arrow-body-style: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      let foo = () => 0;
      let foo = (retv, name) => {
          retv[name] = true;
          return retv;
      };
      let foo = () => ({
          bar: {
              foo: 1,
              bar: 2,
          }
      });
      let foo = () => { bar(); };
      let foo = () => {};
      let foo = () => { /* do nothing */ };
      let foo = () => {
          // do nothing.
      };
      let foo = () => ({ bar: 0 });

      requireReturnForObjectLiteral

      This option is only applicable when used in conjunction with the "as-needed" option.

      Examples of incorrect code for this rule with the { "requireReturnForObjectLiteral": true } option:

      /*eslint arrow-body-style: ["error", "as-needed", { "requireReturnForObjectLiteral": true }]*/
      /*eslint-env es6*/
      let foo = () => ({});
      let foo = () => ({ bar: 0 });

      Examples of correct code for this rule with the { "requireReturnForObjectLiteral": true } option:

      /*eslint arrow-body-style: ["error", "as-needed", { "requireReturnForObjectLiteral": true }]*/
      /*eslint-env es6*/
      
      let foo = () => {};
      let foo = () => { return { bar: 0 }; };

      never

      Examples of incorrect code for this rule with the "never" option:

      /*eslint arrow-body-style: ["error", "never"]*/
      /*eslint-env es6*/
      
      let foo = () => {
          return 0;
      };
      let foo = (retv, name) => {
          retv[name] = true;
          return retv;
      };

      Examples of correct code for this rule with the "never" option:

      /*eslint arrow-body-style: ["error", "never"]*/
      /*eslint-env es6*/
      
      let foo = () => 0;
      let foo = () => ({ foo: 0 });

      Source: http://eslint.org/docs/rules/

      Unexpected parentheses around single function argument having a body with no curly braces
      Open

              const ids = validUpdates.map((update) => update[primaryKey])
      Severity: Minor
      Found in src/index.js by eslint

      Require parens in arrow function arguments (arrow-parens)

      Arrow functions can omit parentheses when they have exactly one parameter. In all other cases the parameter(s) must be wrapped in parentheses. This rule enforces the consistent use of parentheses in arrow functions.

      Rule Details

      This rule enforces parentheses around arrow function parameters regardless of arity. For example:

      /*eslint-env es6*/
      
      // Bad
      a => {}
      
      // Good
      (a) => {}

      Following this style will help you find arrow functions (=>) which may be mistakenly included in a condition when a comparison such as >= was the intent.

      /*eslint-env es6*/
      
      // Bad
      if (a => 2) {
      }
      
      // Good
      if (a >= 2) {
      }

      The rule can also be configured to discourage the use of parens when they are not required:

      /*eslint-env es6*/
      
      // Bad
      (a) => {}
      
      // Good
      a => {}

      Options

      This rule has a string option and an object one.

      String options are:

      • "always" (default) requires parens around arguments in all cases.
      • "as-needed" allows omitting parens when there is only one argument.

      Object properties for variants of the "as-needed" option:

      • "requireForBlockBody": true modifies the as-needed rule in order to require parens if the function body is in an instructions block (surrounded by braces).

      always

      Examples of incorrect code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => a);
      a(foo => { if (true) {} });

      Examples of correct code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      () => {};
      (a) => {};
      (a) => a;
      (a) => {'\n'}
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });

      If Statements

      One of benefits of this option is that it prevents the incorrect use of arrow functions in conditionals:

      /*eslint-env es6*/
      
      var a = 1;
      var b = 2;
      // ...
      if (a => b) {
       console.log('bigger');
      } else {
       console.log('smaller');
      }
      // outputs 'bigger', not smaller as expected

      The contents of the if statement is an arrow function, not a comparison.

      If the arrow function is intentional, it should be wrapped in parens to remove ambiguity.

      /*eslint-env es6*/
      
      var a = 1;
      var b = 0;
      // ...
      if ((a) => b) {
       console.log('truthy value returned');
      } else {
       console.log('falsey value returned');
      }
      // outputs 'truthy value returned'

      The following is another example of this behavior:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = a => b ? c: d;
      // f = ?

      f is an arrow function which takes a as an argument and returns the result of b ? c: d.

      This should be rewritten like so:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = (a) => b ? c: d;

      as-needed

      Examples of incorrect code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => a;
      (a) => {'\n'};
      a.then((foo) => {});
      a.then((foo) => a);
      a((foo) => { if (true) {} });

      Examples of correct code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      () => {};
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      requireForBlockBody

      Examples of incorrect code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => a;
      a => {};
      a => {'\n'};
      a.map((x) => x * x);
      a.map(x => {
        return x * x;
      });
      a.then(foo => {});

      Examples of correct code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => {'\n'};
      a => ({});
      () => {};
      a => a;
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });
      a((foo) => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      Further Reading

      A space is required before '}'.
      Open

          const {redis, keys} = this
      Severity: Minor
      Found in src/index.js by eslint

      enforce consistent spacing inside braces (object-curly-spacing)

      While formatting preferences are very personal, a number of style guides require or disallow spaces between curly braces in the following situations:

      // simple object literals
      var obj = { foo: "bar" };
      
      // nested object literals
      var obj = { foo: { zoo: "bar" } };
      
      // destructuring assignment (EcmaScript 6)
      var { x, y } = y;
      
      // import/export declarations (EcmaScript 6)
      import { foo } from "bar";
      export { foo };

      Rule Details

      This rule enforce consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.

      Options

      This rule has two options, a string option and an object option.

      String option:

      • "never" (default) disallows spacing inside of braces
      • "always" requires spacing inside of braces (except {})

      Object option:

      • "arraysInObjects": true requires spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to never)
      • "arraysInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to always)
      • "objectsInObjects": true requires spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to never)
      • "objectsInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to always)

      never

      Examples of incorrect code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = { 'foo': 'bar' };
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux'}, bar};
      var {x } = y;
      import { foo } from 'bar';

      Examples of correct code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': {'bar': 'baz'}, 'qux': 'quxx'};
      var obj = {
        'foo': 'bar'
      };
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var obj = {};
      var {x} = y;
      import {foo} from 'bar';

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux' }, bar};
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var {x} = y;
      import {foo } from 'bar';

      Examples of correct code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {};
      var obj = { 'foo': 'bar' };
      var obj = { 'foo': { 'bar': 'baz' }, 'qux': 'quxx' };
      var obj = {
        'foo': 'bar'
      };
      var { x } = y;
      import { foo } from 'bar';

      arraysInObjects

      Examples of additional correct code for this rule with the "never", { "arraysInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "arraysInObjects": true }]*/
      
      var obj = {"foo": [ 1, 2 ] };
      var obj = {"foo": [ "baz", "bar" ] };

      Examples of additional correct code for this rule with the "always", { "arraysInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "arraysInObjects": false }]*/
      
      var obj = { "foo": [ 1, 2 ]};
      var obj = { "foo": [ "baz", "bar" ]};

      objectsInObjects

      Examples of additional correct code for this rule with the "never", { "objectsInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "objectsInObjects": true }]*/
      
      var obj = {"foo": {"baz": 1, "bar": 2} };

      Examples of additional correct code for this rule with the "always", { "objectsInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "objectsInObjects": false }]*/
      
      var obj = { "foo": { "baz": 1, "bar": 2 }};

      When Not To Use It

      You can turn this rule off if you are not concerned with the consistency of spacing between curly braces.

      Related Rules

      Unexpected parentheses around single function argument having a body with no curly braces
      Open

      export default (Adapter) => class RedisAdapter extends Adapter {
      Severity: Minor
      Found in src/index.js by eslint

      Require parens in arrow function arguments (arrow-parens)

      Arrow functions can omit parentheses when they have exactly one parameter. In all other cases the parameter(s) must be wrapped in parentheses. This rule enforces the consistent use of parentheses in arrow functions.

      Rule Details

      This rule enforces parentheses around arrow function parameters regardless of arity. For example:

      /*eslint-env es6*/
      
      // Bad
      a => {}
      
      // Good
      (a) => {}

      Following this style will help you find arrow functions (=>) which may be mistakenly included in a condition when a comparison such as >= was the intent.

      /*eslint-env es6*/
      
      // Bad
      if (a => 2) {
      }
      
      // Good
      if (a >= 2) {
      }

      The rule can also be configured to discourage the use of parens when they are not required:

      /*eslint-env es6*/
      
      // Bad
      (a) => {}
      
      // Good
      a => {}

      Options

      This rule has a string option and an object one.

      String options are:

      • "always" (default) requires parens around arguments in all cases.
      • "as-needed" allows omitting parens when there is only one argument.

      Object properties for variants of the "as-needed" option:

      • "requireForBlockBody": true modifies the as-needed rule in order to require parens if the function body is in an instructions block (surrounded by braces).

      always

      Examples of incorrect code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => a);
      a(foo => { if (true) {} });

      Examples of correct code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      () => {};
      (a) => {};
      (a) => a;
      (a) => {'\n'}
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });

      If Statements

      One of benefits of this option is that it prevents the incorrect use of arrow functions in conditionals:

      /*eslint-env es6*/
      
      var a = 1;
      var b = 2;
      // ...
      if (a => b) {
       console.log('bigger');
      } else {
       console.log('smaller');
      }
      // outputs 'bigger', not smaller as expected

      The contents of the if statement is an arrow function, not a comparison.

      If the arrow function is intentional, it should be wrapped in parens to remove ambiguity.

      /*eslint-env es6*/
      
      var a = 1;
      var b = 0;
      // ...
      if ((a) => b) {
       console.log('truthy value returned');
      } else {
       console.log('falsey value returned');
      }
      // outputs 'truthy value returned'

      The following is another example of this behavior:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = a => b ? c: d;
      // f = ?

      f is an arrow function which takes a as an argument and returns the result of b ? c: d.

      This should be rewritten like so:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = (a) => b ? c: d;

      as-needed

      Examples of incorrect code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => a;
      (a) => {'\n'};
      a.then((foo) => {});
      a.then((foo) => a);
      a((foo) => { if (true) {} });

      Examples of correct code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      () => {};
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      requireForBlockBody

      Examples of incorrect code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => a;
      a => {};
      a => {'\n'};
      a.map((x) => x * x);
      a.map(x => {
        return x * x;
      });
      a.then(foo => {});

      Examples of correct code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => {'\n'};
      a => ({});
      () => {};
      a => a;
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });
      a((foo) => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      Further Reading

      Unexpected parentheses around single function argument having a body with no curly braces
      Open

              if (!replies.every((repl) => repl === 0)) {
      Severity: Minor
      Found in src/index.js by eslint

      Require parens in arrow function arguments (arrow-parens)

      Arrow functions can omit parentheses when they have exactly one parameter. In all other cases the parameter(s) must be wrapped in parentheses. This rule enforces the consistent use of parentheses in arrow functions.

      Rule Details

      This rule enforces parentheses around arrow function parameters regardless of arity. For example:

      /*eslint-env es6*/
      
      // Bad
      a => {}
      
      // Good
      (a) => {}

      Following this style will help you find arrow functions (=>) which may be mistakenly included in a condition when a comparison such as >= was the intent.

      /*eslint-env es6*/
      
      // Bad
      if (a => 2) {
      }
      
      // Good
      if (a >= 2) {
      }

      The rule can also be configured to discourage the use of parens when they are not required:

      /*eslint-env es6*/
      
      // Bad
      (a) => {}
      
      // Good
      a => {}

      Options

      This rule has a string option and an object one.

      String options are:

      • "always" (default) requires parens around arguments in all cases.
      • "as-needed" allows omitting parens when there is only one argument.

      Object properties for variants of the "as-needed" option:

      • "requireForBlockBody": true modifies the as-needed rule in order to require parens if the function body is in an instructions block (surrounded by braces).

      always

      Examples of incorrect code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => a);
      a(foo => { if (true) {} });

      Examples of correct code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      () => {};
      (a) => {};
      (a) => a;
      (a) => {'\n'}
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });

      If Statements

      One of benefits of this option is that it prevents the incorrect use of arrow functions in conditionals:

      /*eslint-env es6*/
      
      var a = 1;
      var b = 2;
      // ...
      if (a => b) {
       console.log('bigger');
      } else {
       console.log('smaller');
      }
      // outputs 'bigger', not smaller as expected

      The contents of the if statement is an arrow function, not a comparison.

      If the arrow function is intentional, it should be wrapped in parens to remove ambiguity.

      /*eslint-env es6*/
      
      var a = 1;
      var b = 0;
      // ...
      if ((a) => b) {
       console.log('truthy value returned');
      } else {
       console.log('falsey value returned');
      }
      // outputs 'truthy value returned'

      The following is another example of this behavior:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = a => b ? c: d;
      // f = ?

      f is an arrow function which takes a as an argument and returns the result of b ? c: d.

      This should be rewritten like so:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = (a) => b ? c: d;

      as-needed

      Examples of incorrect code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => a;
      (a) => {'\n'};
      a.then((foo) => {});
      a.then((foo) => a);
      a((foo) => { if (true) {} });

      Examples of correct code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      () => {};
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      requireForBlockBody

      Examples of incorrect code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => a;
      a => {};
      a => {'\n'};
      a.map((x) => x * x);
      a.map(x => {
        return x * x;
      });
      a.then(foo => {});

      Examples of correct code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => {'\n'};
      a => ({});
      () => {};
      a => a;
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });
      a((foo) => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      Further Reading

      Unexpected block statement surrounding arrow body.
      Open

            .then((res) => {
      Severity: Minor
      Found in src/index.js by eslint

      Require braces in arrow function body (arrow-body-style)

      Arrow functions have two syntactic forms for their function bodies. They may be defined with a block body (denoted by curly braces) () => { ... } or with a single expression () => ..., whose value is implicitly returned.

      Rule Details

      This rule can enforce or disallow the use of braces around arrow function body.

      Options

      The rule takes one or two options. The first is a string, which can be:

      • "always" enforces braces around the function body
      • "as-needed" enforces no braces where they can be omitted (default)
      • "never" enforces no braces around the function body (constrains arrow functions to the role of returning an expression)

      The second one is an object for more fine-grained configuration when the first option is "as-needed". Currently, the only available option is requireReturnForObjectLiteral, a boolean property. It's false by default. If set to true, it requires braces and an explicit return for object literals.

      "arrow-body-style": ["error", "always"]

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint arrow-body-style: ["error", "always"]*/
      /*eslint-env es6*/
      let foo = () => 0;

      Examples of correct code for this rule with the "always" option:

      let foo = () => {
          return 0;
      };
      let foo = (retv, name) => {
          retv[name] = true;
          return retv;
      };

      as-needed

      Examples of incorrect code for this rule with the default "as-needed" option:

      /*eslint arrow-body-style: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      let foo = () => {
          return 0;
      };
      let foo = () => {
          return {
             bar: {
                  foo: 1,
                  bar: 2,
              }
          };
      };

      Examples of correct code for this rule with the default "as-needed" option:

      /*eslint arrow-body-style: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      let foo = () => 0;
      let foo = (retv, name) => {
          retv[name] = true;
          return retv;
      };
      let foo = () => ({
          bar: {
              foo: 1,
              bar: 2,
          }
      });
      let foo = () => { bar(); };
      let foo = () => {};
      let foo = () => { /* do nothing */ };
      let foo = () => {
          // do nothing.
      };
      let foo = () => ({ bar: 0 });

      requireReturnForObjectLiteral

      This option is only applicable when used in conjunction with the "as-needed" option.

      Examples of incorrect code for this rule with the { "requireReturnForObjectLiteral": true } option:

      /*eslint arrow-body-style: ["error", "as-needed", { "requireReturnForObjectLiteral": true }]*/
      /*eslint-env es6*/
      let foo = () => ({});
      let foo = () => ({ bar: 0 });

      Examples of correct code for this rule with the { "requireReturnForObjectLiteral": true } option:

      /*eslint arrow-body-style: ["error", "as-needed", { "requireReturnForObjectLiteral": true }]*/
      /*eslint-env es6*/
      
      let foo = () => {};
      let foo = () => { return { bar: 0 }; };

      never

      Examples of incorrect code for this rule with the "never" option:

      /*eslint arrow-body-style: ["error", "never"]*/
      /*eslint-env es6*/
      
      let foo = () => {
          return 0;
      };
      let foo = (retv, name) => {
          retv[name] = true;
          return retv;
      };

      Examples of correct code for this rule with the "never" option:

      /*eslint arrow-body-style: ["error", "never"]*/
      /*eslint-env es6*/
      
      let foo = () => 0;
      let foo = () => ({ foo: 0 });

      Source: http://eslint.org/docs/rules/

      A space is required before '}'.
      Open

          const {redis} = this
      Severity: Minor
      Found in src/index.js by eslint

      enforce consistent spacing inside braces (object-curly-spacing)

      While formatting preferences are very personal, a number of style guides require or disallow spaces between curly braces in the following situations:

      // simple object literals
      var obj = { foo: "bar" };
      
      // nested object literals
      var obj = { foo: { zoo: "bar" } };
      
      // destructuring assignment (EcmaScript 6)
      var { x, y } = y;
      
      // import/export declarations (EcmaScript 6)
      import { foo } from "bar";
      export { foo };

      Rule Details

      This rule enforce consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.

      Options

      This rule has two options, a string option and an object option.

      String option:

      • "never" (default) disallows spacing inside of braces
      • "always" requires spacing inside of braces (except {})

      Object option:

      • "arraysInObjects": true requires spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to never)
      • "arraysInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to always)
      • "objectsInObjects": true requires spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to never)
      • "objectsInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to always)

      never

      Examples of incorrect code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = { 'foo': 'bar' };
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux'}, bar};
      var {x } = y;
      import { foo } from 'bar';

      Examples of correct code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': {'bar': 'baz'}, 'qux': 'quxx'};
      var obj = {
        'foo': 'bar'
      };
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var obj = {};
      var {x} = y;
      import {foo} from 'bar';

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux' }, bar};
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var {x} = y;
      import {foo } from 'bar';

      Examples of correct code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {};
      var obj = { 'foo': 'bar' };
      var obj = { 'foo': { 'bar': 'baz' }, 'qux': 'quxx' };
      var obj = {
        'foo': 'bar'
      };
      var { x } = y;
      import { foo } from 'bar';

      arraysInObjects

      Examples of additional correct code for this rule with the "never", { "arraysInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "arraysInObjects": true }]*/
      
      var obj = {"foo": [ 1, 2 ] };
      var obj = {"foo": [ "baz", "bar" ] };

      Examples of additional correct code for this rule with the "always", { "arraysInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "arraysInObjects": false }]*/
      
      var obj = { "foo": [ 1, 2 ]};
      var obj = { "foo": [ "baz", "bar" ]};

      objectsInObjects

      Examples of additional correct code for this rule with the "never", { "objectsInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "objectsInObjects": true }]*/
      
      var obj = {"foo": {"baz": 1, "bar": 2} };

      Examples of additional correct code for this rule with the "always", { "objectsInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "objectsInObjects": false }]*/
      
      var obj = { "foo": { "baz": 1, "bar": 2 }};

      When Not To Use It

      You can turn this rule off if you are not concerned with the consistency of spacing between curly braces.

      Related Rules

      Unexpected parentheses around single function argument having a body with no curly braces
      Open

              .then((collectionId) => this.find(type, collectionId, options))
      Severity: Minor
      Found in src/index.js by eslint

      Require parens in arrow function arguments (arrow-parens)

      Arrow functions can omit parentheses when they have exactly one parameter. In all other cases the parameter(s) must be wrapped in parentheses. This rule enforces the consistent use of parentheses in arrow functions.

      Rule Details

      This rule enforces parentheses around arrow function parameters regardless of arity. For example:

      /*eslint-env es6*/
      
      // Bad
      a => {}
      
      // Good
      (a) => {}

      Following this style will help you find arrow functions (=>) which may be mistakenly included in a condition when a comparison such as >= was the intent.

      /*eslint-env es6*/
      
      // Bad
      if (a => 2) {
      }
      
      // Good
      if (a >= 2) {
      }

      The rule can also be configured to discourage the use of parens when they are not required:

      /*eslint-env es6*/
      
      // Bad
      (a) => {}
      
      // Good
      a => {}

      Options

      This rule has a string option and an object one.

      String options are:

      • "always" (default) requires parens around arguments in all cases.
      • "as-needed" allows omitting parens when there is only one argument.

      Object properties for variants of the "as-needed" option:

      • "requireForBlockBody": true modifies the as-needed rule in order to require parens if the function body is in an instructions block (surrounded by braces).

      always

      Examples of incorrect code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => a);
      a(foo => { if (true) {} });

      Examples of correct code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      () => {};
      (a) => {};
      (a) => a;
      (a) => {'\n'}
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });

      If Statements

      One of benefits of this option is that it prevents the incorrect use of arrow functions in conditionals:

      /*eslint-env es6*/
      
      var a = 1;
      var b = 2;
      // ...
      if (a => b) {
       console.log('bigger');
      } else {
       console.log('smaller');
      }
      // outputs 'bigger', not smaller as expected

      The contents of the if statement is an arrow function, not a comparison.

      If the arrow function is intentional, it should be wrapped in parens to remove ambiguity.

      /*eslint-env es6*/
      
      var a = 1;
      var b = 0;
      // ...
      if ((a) => b) {
       console.log('truthy value returned');
      } else {
       console.log('falsey value returned');
      }
      // outputs 'truthy value returned'

      The following is another example of this behavior:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = a => b ? c: d;
      // f = ?

      f is an arrow function which takes a as an argument and returns the result of b ? c: d.

      This should be rewritten like so:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = (a) => b ? c: d;

      as-needed

      Examples of incorrect code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => a;
      (a) => {'\n'};
      a.then((foo) => {});
      a.then((foo) => a);
      a((foo) => { if (true) {} });

      Examples of correct code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      () => {};
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      requireForBlockBody

      Examples of incorrect code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => a;
      a => {};
      a => {'\n'};
      a.map((x) => x * x);
      a.map(x => {
        return x * x;
      });
      a.then(foo => {});

      Examples of correct code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => {'\n'};
      a => ({});
      () => {};
      a => a;
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });
      a((foo) => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      Further Reading

      A space is required before '}'.
      Open

          const {Promise, redis, keys} = this
      Severity: Minor
      Found in src/index.js by eslint

      enforce consistent spacing inside braces (object-curly-spacing)

      While formatting preferences are very personal, a number of style guides require or disallow spaces between curly braces in the following situations:

      // simple object literals
      var obj = { foo: "bar" };
      
      // nested object literals
      var obj = { foo: { zoo: "bar" } };
      
      // destructuring assignment (EcmaScript 6)
      var { x, y } = y;
      
      // import/export declarations (EcmaScript 6)
      import { foo } from "bar";
      export { foo };

      Rule Details

      This rule enforce consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.

      Options

      This rule has two options, a string option and an object option.

      String option:

      • "never" (default) disallows spacing inside of braces
      • "always" requires spacing inside of braces (except {})

      Object option:

      • "arraysInObjects": true requires spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to never)
      • "arraysInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to always)
      • "objectsInObjects": true requires spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to never)
      • "objectsInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to always)

      never

      Examples of incorrect code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = { 'foo': 'bar' };
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux'}, bar};
      var {x } = y;
      import { foo } from 'bar';

      Examples of correct code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': {'bar': 'baz'}, 'qux': 'quxx'};
      var obj = {
        'foo': 'bar'
      };
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var obj = {};
      var {x} = y;
      import {foo} from 'bar';

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux' }, bar};
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var {x} = y;
      import {foo } from 'bar';

      Examples of correct code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {};
      var obj = { 'foo': 'bar' };
      var obj = { 'foo': { 'bar': 'baz' }, 'qux': 'quxx' };
      var obj = {
        'foo': 'bar'
      };
      var { x } = y;
      import { foo } from 'bar';

      arraysInObjects

      Examples of additional correct code for this rule with the "never", { "arraysInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "arraysInObjects": true }]*/
      
      var obj = {"foo": [ 1, 2 ] };
      var obj = {"foo": [ "baz", "bar" ] };

      Examples of additional correct code for this rule with the "always", { "arraysInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "arraysInObjects": false }]*/
      
      var obj = { "foo": [ 1, 2 ]};
      var obj = { "foo": [ "baz", "bar" ]};

      objectsInObjects

      Examples of additional correct code for this rule with the "never", { "objectsInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "objectsInObjects": true }]*/
      
      var obj = {"foo": {"baz": 1, "bar": 2} };

      Examples of additional correct code for this rule with the "always", { "objectsInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "objectsInObjects": false }]*/
      
      var obj = { "foo": { "baz": 1, "bar": 2 }};

      When Not To Use It

      You can turn this rule off if you are not concerned with the consistency of spacing between curly braces.

      Related Rules

      Unexpected parentheses around single function argument having a body with no curly braces
      Open

          return redis.mget(ids.map((id) => `${type}${separator}${id}`))
      Severity: Minor
      Found in src/index.js by eslint

      Require parens in arrow function arguments (arrow-parens)

      Arrow functions can omit parentheses when they have exactly one parameter. In all other cases the parameter(s) must be wrapped in parentheses. This rule enforces the consistent use of parentheses in arrow functions.

      Rule Details

      This rule enforces parentheses around arrow function parameters regardless of arity. For example:

      /*eslint-env es6*/
      
      // Bad
      a => {}
      
      // Good
      (a) => {}

      Following this style will help you find arrow functions (=>) which may be mistakenly included in a condition when a comparison such as >= was the intent.

      /*eslint-env es6*/
      
      // Bad
      if (a => 2) {
      }
      
      // Good
      if (a >= 2) {
      }

      The rule can also be configured to discourage the use of parens when they are not required:

      /*eslint-env es6*/
      
      // Bad
      (a) => {}
      
      // Good
      a => {}

      Options

      This rule has a string option and an object one.

      String options are:

      • "always" (default) requires parens around arguments in all cases.
      • "as-needed" allows omitting parens when there is only one argument.

      Object properties for variants of the "as-needed" option:

      • "requireForBlockBody": true modifies the as-needed rule in order to require parens if the function body is in an instructions block (surrounded by braces).

      always

      Examples of incorrect code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => a);
      a(foo => { if (true) {} });

      Examples of correct code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      () => {};
      (a) => {};
      (a) => a;
      (a) => {'\n'}
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });

      If Statements

      One of benefits of this option is that it prevents the incorrect use of arrow functions in conditionals:

      /*eslint-env es6*/
      
      var a = 1;
      var b = 2;
      // ...
      if (a => b) {
       console.log('bigger');
      } else {
       console.log('smaller');
      }
      // outputs 'bigger', not smaller as expected

      The contents of the if statement is an arrow function, not a comparison.

      If the arrow function is intentional, it should be wrapped in parens to remove ambiguity.

      /*eslint-env es6*/
      
      var a = 1;
      var b = 0;
      // ...
      if ((a) => b) {
       console.log('truthy value returned');
      } else {
       console.log('falsey value returned');
      }
      // outputs 'truthy value returned'

      The following is another example of this behavior:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = a => b ? c: d;
      // f = ?

      f is an arrow function which takes a as an argument and returns the result of b ? c: d.

      This should be rewritten like so:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = (a) => b ? c: d;

      as-needed

      Examples of incorrect code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => a;
      (a) => {'\n'};
      a.then((foo) => {});
      a.then((foo) => a);
      a((foo) => { if (true) {} });

      Examples of correct code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      () => {};
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      requireForBlockBody

      Examples of incorrect code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => a;
      a => {};
      a => {'\n'};
      a.map((x) => x * x);
      a.map(x => {
        return x * x;
      });
      a.then(foo => {});

      Examples of correct code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => {'\n'};
      a => ({});
      () => {};
      a => a;
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });
      a((foo) => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      Further Reading

      Unexpected parentheses around single function argument having a body with no curly braces
      Open

          const updateIds = updates.map((uIds) => uIds[primaryKey])
      Severity: Minor
      Found in src/index.js by eslint

      Require parens in arrow function arguments (arrow-parens)

      Arrow functions can omit parentheses when they have exactly one parameter. In all other cases the parameter(s) must be wrapped in parentheses. This rule enforces the consistent use of parentheses in arrow functions.

      Rule Details

      This rule enforces parentheses around arrow function parameters regardless of arity. For example:

      /*eslint-env es6*/
      
      // Bad
      a => {}
      
      // Good
      (a) => {}

      Following this style will help you find arrow functions (=>) which may be mistakenly included in a condition when a comparison such as >= was the intent.

      /*eslint-env es6*/
      
      // Bad
      if (a => 2) {
      }
      
      // Good
      if (a >= 2) {
      }

      The rule can also be configured to discourage the use of parens when they are not required:

      /*eslint-env es6*/
      
      // Bad
      (a) => {}
      
      // Good
      a => {}

      Options

      This rule has a string option and an object one.

      String options are:

      • "always" (default) requires parens around arguments in all cases.
      • "as-needed" allows omitting parens when there is only one argument.

      Object properties for variants of the "as-needed" option:

      • "requireForBlockBody": true modifies the as-needed rule in order to require parens if the function body is in an instructions block (surrounded by braces).

      always

      Examples of incorrect code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => a);
      a(foo => { if (true) {} });

      Examples of correct code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      () => {};
      (a) => {};
      (a) => a;
      (a) => {'\n'}
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });

      If Statements

      One of benefits of this option is that it prevents the incorrect use of arrow functions in conditionals:

      /*eslint-env es6*/
      
      var a = 1;
      var b = 2;
      // ...
      if (a => b) {
       console.log('bigger');
      } else {
       console.log('smaller');
      }
      // outputs 'bigger', not smaller as expected

      The contents of the if statement is an arrow function, not a comparison.

      If the arrow function is intentional, it should be wrapped in parens to remove ambiguity.

      /*eslint-env es6*/
      
      var a = 1;
      var b = 0;
      // ...
      if ((a) => b) {
       console.log('truthy value returned');
      } else {
       console.log('falsey value returned');
      }
      // outputs 'truthy value returned'

      The following is another example of this behavior:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = a => b ? c: d;
      // f = ?

      f is an arrow function which takes a as an argument and returns the result of b ? c: d.

      This should be rewritten like so:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = (a) => b ? c: d;

      as-needed

      Examples of incorrect code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => a;
      (a) => {'\n'};
      a.then((foo) => {});
      a.then((foo) => a);
      a((foo) => { if (true) {} });

      Examples of correct code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      () => {};
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      requireForBlockBody

      Examples of incorrect code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => a;
      a => {};
      a => {'\n'};
      a.map((x) => x * x);
      a.map(x => {
        return x * x;
      });
      a.then(foo => {});

      Examples of correct code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => {'\n'};
      a => ({});
      () => {};
      a => a;
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });
      a((foo) => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      Further Reading

      Unexpected parentheses around single function argument having a body with no curly braces
      Open

            .then((replies) => replies.length)
      Severity: Minor
      Found in src/index.js by eslint

      Require parens in arrow function arguments (arrow-parens)

      Arrow functions can omit parentheses when they have exactly one parameter. In all other cases the parameter(s) must be wrapped in parentheses. This rule enforces the consistent use of parentheses in arrow functions.

      Rule Details

      This rule enforces parentheses around arrow function parameters regardless of arity. For example:

      /*eslint-env es6*/
      
      // Bad
      a => {}
      
      // Good
      (a) => {}

      Following this style will help you find arrow functions (=>) which may be mistakenly included in a condition when a comparison such as >= was the intent.

      /*eslint-env es6*/
      
      // Bad
      if (a => 2) {
      }
      
      // Good
      if (a >= 2) {
      }

      The rule can also be configured to discourage the use of parens when they are not required:

      /*eslint-env es6*/
      
      // Bad
      (a) => {}
      
      // Good
      a => {}

      Options

      This rule has a string option and an object one.

      String options are:

      • "always" (default) requires parens around arguments in all cases.
      • "as-needed" allows omitting parens when there is only one argument.

      Object properties for variants of the "as-needed" option:

      • "requireForBlockBody": true modifies the as-needed rule in order to require parens if the function body is in an instructions block (surrounded by braces).

      always

      Examples of incorrect code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => a);
      a(foo => { if (true) {} });

      Examples of correct code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      () => {};
      (a) => {};
      (a) => a;
      (a) => {'\n'}
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });

      If Statements

      One of benefits of this option is that it prevents the incorrect use of arrow functions in conditionals:

      /*eslint-env es6*/
      
      var a = 1;
      var b = 2;
      // ...
      if (a => b) {
       console.log('bigger');
      } else {
       console.log('smaller');
      }
      // outputs 'bigger', not smaller as expected

      The contents of the if statement is an arrow function, not a comparison.

      If the arrow function is intentional, it should be wrapped in parens to remove ambiguity.

      /*eslint-env es6*/
      
      var a = 1;
      var b = 0;
      // ...
      if ((a) => b) {
       console.log('truthy value returned');
      } else {
       console.log('falsey value returned');
      }
      // outputs 'truthy value returned'

      The following is another example of this behavior:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = a => b ? c: d;
      // f = ?

      f is an arrow function which takes a as an argument and returns the result of b ? c: d.

      This should be rewritten like so:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = (a) => b ? c: d;

      as-needed

      Examples of incorrect code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => a;
      (a) => {'\n'};
      a.then((foo) => {});
      a.then((foo) => a);
      a((foo) => { if (true) {} });

      Examples of correct code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      () => {};
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      requireForBlockBody

      Examples of incorrect code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => a;
      a => {};
      a => {'\n'};
      a.map((x) => x * x);
      a.map(x => {
        return x * x;
      });
      a.then(foo => {});

      Examples of correct code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => {'\n'};
      a => ({});
      () => {};
      a => a;
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });
      a((foo) => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      Further Reading

      Unexpected parentheses around single function argument having a body with no curly braces
      Open

      const concatRedisResult = (i) => (results) => [].concat(...results.map((r) => r[i]))
      Severity: Minor
      Found in src/index.js by eslint

      Require parens in arrow function arguments (arrow-parens)

      Arrow functions can omit parentheses when they have exactly one parameter. In all other cases the parameter(s) must be wrapped in parentheses. This rule enforces the consistent use of parentheses in arrow functions.

      Rule Details

      This rule enforces parentheses around arrow function parameters regardless of arity. For example:

      /*eslint-env es6*/
      
      // Bad
      a => {}
      
      // Good
      (a) => {}

      Following this style will help you find arrow functions (=>) which may be mistakenly included in a condition when a comparison such as >= was the intent.

      /*eslint-env es6*/
      
      // Bad
      if (a => 2) {
      }
      
      // Good
      if (a >= 2) {
      }

      The rule can also be configured to discourage the use of parens when they are not required:

      /*eslint-env es6*/
      
      // Bad
      (a) => {}
      
      // Good
      a => {}

      Options

      This rule has a string option and an object one.

      String options are:

      • "always" (default) requires parens around arguments in all cases.
      • "as-needed" allows omitting parens when there is only one argument.

      Object properties for variants of the "as-needed" option:

      • "requireForBlockBody": true modifies the as-needed rule in order to require parens if the function body is in an instructions block (surrounded by braces).

      always

      Examples of incorrect code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => a);
      a(foo => { if (true) {} });

      Examples of correct code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      () => {};
      (a) => {};
      (a) => a;
      (a) => {'\n'}
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });

      If Statements

      One of benefits of this option is that it prevents the incorrect use of arrow functions in conditionals:

      /*eslint-env es6*/
      
      var a = 1;
      var b = 2;
      // ...
      if (a => b) {
       console.log('bigger');
      } else {
       console.log('smaller');
      }
      // outputs 'bigger', not smaller as expected

      The contents of the if statement is an arrow function, not a comparison.

      If the arrow function is intentional, it should be wrapped in parens to remove ambiguity.

      /*eslint-env es6*/
      
      var a = 1;
      var b = 0;
      // ...
      if ((a) => b) {
       console.log('truthy value returned');
      } else {
       console.log('falsey value returned');
      }
      // outputs 'truthy value returned'

      The following is another example of this behavior:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = a => b ? c: d;
      // f = ?

      f is an arrow function which takes a as an argument and returns the result of b ? c: d.

      This should be rewritten like so:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = (a) => b ? c: d;

      as-needed

      Examples of incorrect code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => a;
      (a) => {'\n'};
      a.then((foo) => {});
      a.then((foo) => a);
      a((foo) => { if (true) {} });

      Examples of correct code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      () => {};
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      requireForBlockBody

      Examples of incorrect code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => a;
      a => {};
      a => {'\n'};
      a.map((x) => x * x);
      a.map(x => {
        return x * x;
      });
      a.then(foo => {});

      Examples of correct code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => {'\n'};
      a => ({});
      () => {};
      a => a;
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });
      a((foo) => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      Further Reading

      Unexpected parentheses around single function argument having a body with no curly braces
      Open

              return entries.map((entry) => fn(JSON.parse(entry)))
      Severity: Minor
      Found in src/index.js by eslint

      Require parens in arrow function arguments (arrow-parens)

      Arrow functions can omit parentheses when they have exactly one parameter. In all other cases the parameter(s) must be wrapped in parentheses. This rule enforces the consistent use of parentheses in arrow functions.

      Rule Details

      This rule enforces parentheses around arrow function parameters regardless of arity. For example:

      /*eslint-env es6*/
      
      // Bad
      a => {}
      
      // Good
      (a) => {}

      Following this style will help you find arrow functions (=>) which may be mistakenly included in a condition when a comparison such as >= was the intent.

      /*eslint-env es6*/
      
      // Bad
      if (a => 2) {
      }
      
      // Good
      if (a >= 2) {
      }

      The rule can also be configured to discourage the use of parens when they are not required:

      /*eslint-env es6*/
      
      // Bad
      (a) => {}
      
      // Good
      a => {}

      Options

      This rule has a string option and an object one.

      String options are:

      • "always" (default) requires parens around arguments in all cases.
      • "as-needed" allows omitting parens when there is only one argument.

      Object properties for variants of the "as-needed" option:

      • "requireForBlockBody": true modifies the as-needed rule in order to require parens if the function body is in an instructions block (surrounded by braces).

      always

      Examples of incorrect code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => a);
      a(foo => { if (true) {} });

      Examples of correct code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      () => {};
      (a) => {};
      (a) => a;
      (a) => {'\n'}
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });

      If Statements

      One of benefits of this option is that it prevents the incorrect use of arrow functions in conditionals:

      /*eslint-env es6*/
      
      var a = 1;
      var b = 2;
      // ...
      if (a => b) {
       console.log('bigger');
      } else {
       console.log('smaller');
      }
      // outputs 'bigger', not smaller as expected

      The contents of the if statement is an arrow function, not a comparison.

      If the arrow function is intentional, it should be wrapped in parens to remove ambiguity.

      /*eslint-env es6*/
      
      var a = 1;
      var b = 0;
      // ...
      if ((a) => b) {
       console.log('truthy value returned');
      } else {
       console.log('falsey value returned');
      }
      // outputs 'truthy value returned'

      The following is another example of this behavior:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = a => b ? c: d;
      // f = ?

      f is an arrow function which takes a as an argument and returns the result of b ? c: d.

      This should be rewritten like so:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = (a) => b ? c: d;

      as-needed

      Examples of incorrect code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => a;
      (a) => {'\n'};
      a.then((foo) => {});
      a.then((foo) => a);
      a((foo) => { if (true) {} });

      Examples of correct code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      () => {};
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      requireForBlockBody

      Examples of incorrect code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => a;
      a => {};
      a => {'\n'};
      a.map((x) => x * x);
      a.map(x => {
        return x * x;
      });
      a.then(foo => {});

      Examples of correct code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => {'\n'};
      a => ({});
      () => {};
      a => a;
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });
      a((foo) => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      Further Reading

      Unexpected parentheses around single function argument having a body with no curly braces
      Open

          recordsInput.forEach((rec) => pipeline.sismember(type, rec[primaryKey]))
      Severity: Minor
      Found in src/index.js by eslint

      Require parens in arrow function arguments (arrow-parens)

      Arrow functions can omit parentheses when they have exactly one parameter. In all other cases the parameter(s) must be wrapped in parentheses. This rule enforces the consistent use of parentheses in arrow functions.

      Rule Details

      This rule enforces parentheses around arrow function parameters regardless of arity. For example:

      /*eslint-env es6*/
      
      // Bad
      a => {}
      
      // Good
      (a) => {}

      Following this style will help you find arrow functions (=>) which may be mistakenly included in a condition when a comparison such as >= was the intent.

      /*eslint-env es6*/
      
      // Bad
      if (a => 2) {
      }
      
      // Good
      if (a >= 2) {
      }

      The rule can also be configured to discourage the use of parens when they are not required:

      /*eslint-env es6*/
      
      // Bad
      (a) => {}
      
      // Good
      a => {}

      Options

      This rule has a string option and an object one.

      String options are:

      • "always" (default) requires parens around arguments in all cases.
      • "as-needed" allows omitting parens when there is only one argument.

      Object properties for variants of the "as-needed" option:

      • "requireForBlockBody": true modifies the as-needed rule in order to require parens if the function body is in an instructions block (surrounded by braces).

      always

      Examples of incorrect code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => a);
      a(foo => { if (true) {} });

      Examples of correct code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      () => {};
      (a) => {};
      (a) => a;
      (a) => {'\n'}
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });

      If Statements

      One of benefits of this option is that it prevents the incorrect use of arrow functions in conditionals:

      /*eslint-env es6*/
      
      var a = 1;
      var b = 2;
      // ...
      if (a => b) {
       console.log('bigger');
      } else {
       console.log('smaller');
      }
      // outputs 'bigger', not smaller as expected

      The contents of the if statement is an arrow function, not a comparison.

      If the arrow function is intentional, it should be wrapped in parens to remove ambiguity.

      /*eslint-env es6*/
      
      var a = 1;
      var b = 0;
      // ...
      if ((a) => b) {
       console.log('truthy value returned');
      } else {
       console.log('falsey value returned');
      }
      // outputs 'truthy value returned'

      The following is another example of this behavior:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = a => b ? c: d;
      // f = ?

      f is an arrow function which takes a as an argument and returns the result of b ? c: d.

      This should be rewritten like so:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = (a) => b ? c: d;

      as-needed

      Examples of incorrect code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => a;
      (a) => {'\n'};
      a.then((foo) => {});
      a.then((foo) => a);
      a((foo) => { if (true) {} });

      Examples of correct code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      () => {};
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      requireForBlockBody

      Examples of incorrect code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => a;
      a => {};
      a => {'\n'};
      a.map((x) => x * x);
      a.map(x => {
        return x * x;
      });
      a.then(foo => {});

      Examples of correct code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => {'\n'};
      a => ({});
      () => {};
      a => a;
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });
      a((foo) => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      Further Reading

      A space is required after '{'.
      Open

          const {redis, recordTypes, keys} = this
      Severity: Minor
      Found in src/index.js by eslint

      enforce consistent spacing inside braces (object-curly-spacing)

      While formatting preferences are very personal, a number of style guides require or disallow spaces between curly braces in the following situations:

      // simple object literals
      var obj = { foo: "bar" };
      
      // nested object literals
      var obj = { foo: { zoo: "bar" } };
      
      // destructuring assignment (EcmaScript 6)
      var { x, y } = y;
      
      // import/export declarations (EcmaScript 6)
      import { foo } from "bar";
      export { foo };

      Rule Details

      This rule enforce consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.

      Options

      This rule has two options, a string option and an object option.

      String option:

      • "never" (default) disallows spacing inside of braces
      • "always" requires spacing inside of braces (except {})

      Object option:

      • "arraysInObjects": true requires spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to never)
      • "arraysInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to always)
      • "objectsInObjects": true requires spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to never)
      • "objectsInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to always)

      never

      Examples of incorrect code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = { 'foo': 'bar' };
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux'}, bar};
      var {x } = y;
      import { foo } from 'bar';

      Examples of correct code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': {'bar': 'baz'}, 'qux': 'quxx'};
      var obj = {
        'foo': 'bar'
      };
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var obj = {};
      var {x} = y;
      import {foo} from 'bar';

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux' }, bar};
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var {x} = y;
      import {foo } from 'bar';

      Examples of correct code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {};
      var obj = { 'foo': 'bar' };
      var obj = { 'foo': { 'bar': 'baz' }, 'qux': 'quxx' };
      var obj = {
        'foo': 'bar'
      };
      var { x } = y;
      import { foo } from 'bar';

      arraysInObjects

      Examples of additional correct code for this rule with the "never", { "arraysInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "arraysInObjects": true }]*/
      
      var obj = {"foo": [ 1, 2 ] };
      var obj = {"foo": [ "baz", "bar" ] };

      Examples of additional correct code for this rule with the "always", { "arraysInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "arraysInObjects": false }]*/
      
      var obj = { "foo": [ 1, 2 ]};
      var obj = { "foo": [ "baz", "bar" ]};

      objectsInObjects

      Examples of additional correct code for this rule with the "never", { "objectsInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "objectsInObjects": true }]*/
      
      var obj = {"foo": {"baz": 1, "bar": 2} };

      Examples of additional correct code for this rule with the "always", { "objectsInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "objectsInObjects": false }]*/
      
      var obj = { "foo": { "baz": 1, "bar": 2 }};

      When Not To Use It

      You can turn this rule off if you are not concerned with the consistency of spacing between curly braces.

      Related Rules

      A space is required after '{'.
      Open

          const {Promise, redis, keys} = this
      Severity: Minor
      Found in src/index.js by eslint

      enforce consistent spacing inside braces (object-curly-spacing)

      While formatting preferences are very personal, a number of style guides require or disallow spaces between curly braces in the following situations:

      // simple object literals
      var obj = { foo: "bar" };
      
      // nested object literals
      var obj = { foo: { zoo: "bar" } };
      
      // destructuring assignment (EcmaScript 6)
      var { x, y } = y;
      
      // import/export declarations (EcmaScript 6)
      import { foo } from "bar";
      export { foo };

      Rule Details

      This rule enforce consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.

      Options

      This rule has two options, a string option and an object option.

      String option:

      • "never" (default) disallows spacing inside of braces
      • "always" requires spacing inside of braces (except {})

      Object option:

      • "arraysInObjects": true requires spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to never)
      • "arraysInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to always)
      • "objectsInObjects": true requires spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to never)
      • "objectsInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to always)

      never

      Examples of incorrect code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = { 'foo': 'bar' };
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux'}, bar};
      var {x } = y;
      import { foo } from 'bar';

      Examples of correct code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': {'bar': 'baz'}, 'qux': 'quxx'};
      var obj = {
        'foo': 'bar'
      };
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var obj = {};
      var {x} = y;
      import {foo} from 'bar';

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux' }, bar};
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var {x} = y;
      import {foo } from 'bar';

      Examples of correct code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {};
      var obj = { 'foo': 'bar' };
      var obj = { 'foo': { 'bar': 'baz' }, 'qux': 'quxx' };
      var obj = {
        'foo': 'bar'
      };
      var { x } = y;
      import { foo } from 'bar';

      arraysInObjects

      Examples of additional correct code for this rule with the "never", { "arraysInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "arraysInObjects": true }]*/
      
      var obj = {"foo": [ 1, 2 ] };
      var obj = {"foo": [ "baz", "bar" ] };

      Examples of additional correct code for this rule with the "always", { "arraysInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "arraysInObjects": false }]*/
      
      var obj = { "foo": [ 1, 2 ]};
      var obj = { "foo": [ "baz", "bar" ]};

      objectsInObjects

      Examples of additional correct code for this rule with the "never", { "objectsInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "objectsInObjects": true }]*/
      
      var obj = {"foo": {"baz": 1, "bar": 2} };

      Examples of additional correct code for this rule with the "always", { "objectsInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "objectsInObjects": false }]*/
      
      var obj = { "foo": { "baz": 1, "bar": 2 }};

      When Not To Use It

      You can turn this rule off if you are not concerned with the consistency of spacing between curly braces.

      Related Rules

      A space is required after '{'.
      Open

          const {redis, keys} = this
      Severity: Minor
      Found in src/index.js by eslint

      enforce consistent spacing inside braces (object-curly-spacing)

      While formatting preferences are very personal, a number of style guides require or disallow spaces between curly braces in the following situations:

      // simple object literals
      var obj = { foo: "bar" };
      
      // nested object literals
      var obj = { foo: { zoo: "bar" } };
      
      // destructuring assignment (EcmaScript 6)
      var { x, y } = y;
      
      // import/export declarations (EcmaScript 6)
      import { foo } from "bar";
      export { foo };

      Rule Details

      This rule enforce consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.

      Options

      This rule has two options, a string option and an object option.

      String option:

      • "never" (default) disallows spacing inside of braces
      • "always" requires spacing inside of braces (except {})

      Object option:

      • "arraysInObjects": true requires spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to never)
      • "arraysInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to always)
      • "objectsInObjects": true requires spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to never)
      • "objectsInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to always)

      never

      Examples of incorrect code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = { 'foo': 'bar' };
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux'}, bar};
      var {x } = y;
      import { foo } from 'bar';

      Examples of correct code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': {'bar': 'baz'}, 'qux': 'quxx'};
      var obj = {
        'foo': 'bar'
      };
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var obj = {};
      var {x} = y;
      import {foo} from 'bar';

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux' }, bar};
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var {x} = y;
      import {foo } from 'bar';

      Examples of correct code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {};
      var obj = { 'foo': 'bar' };
      var obj = { 'foo': { 'bar': 'baz' }, 'qux': 'quxx' };
      var obj = {
        'foo': 'bar'
      };
      var { x } = y;
      import { foo } from 'bar';

      arraysInObjects

      Examples of additional correct code for this rule with the "never", { "arraysInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "arraysInObjects": true }]*/
      
      var obj = {"foo": [ 1, 2 ] };
      var obj = {"foo": [ "baz", "bar" ] };

      Examples of additional correct code for this rule with the "always", { "arraysInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "arraysInObjects": false }]*/
      
      var obj = { "foo": [ 1, 2 ]};
      var obj = { "foo": [ "baz", "bar" ]};

      objectsInObjects

      Examples of additional correct code for this rule with the "never", { "objectsInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "objectsInObjects": true }]*/
      
      var obj = {"foo": {"baz": 1, "bar": 2} };

      Examples of additional correct code for this rule with the "always", { "objectsInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "objectsInObjects": false }]*/
      
      var obj = { "foo": { "baz": 1, "bar": 2 }};

      When Not To Use It

      You can turn this rule off if you are not concerned with the consistency of spacing between curly braces.

      Related Rules

      A space is required after '{'.
      Open

          let {options} = this
      Severity: Minor
      Found in src/index.js by eslint

      enforce consistent spacing inside braces (object-curly-spacing)

      While formatting preferences are very personal, a number of style guides require or disallow spaces between curly braces in the following situations:

      // simple object literals
      var obj = { foo: "bar" };
      
      // nested object literals
      var obj = { foo: { zoo: "bar" } };
      
      // destructuring assignment (EcmaScript 6)
      var { x, y } = y;
      
      // import/export declarations (EcmaScript 6)
      import { foo } from "bar";
      export { foo };

      Rule Details

      This rule enforce consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.

      Options

      This rule has two options, a string option and an object option.

      String option:

      • "never" (default) disallows spacing inside of braces
      • "always" requires spacing inside of braces (except {})

      Object option:

      • "arraysInObjects": true requires spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to never)
      • "arraysInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to always)
      • "objectsInObjects": true requires spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to never)
      • "objectsInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to always)

      never

      Examples of incorrect code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = { 'foo': 'bar' };
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux'}, bar};
      var {x } = y;
      import { foo } from 'bar';

      Examples of correct code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': {'bar': 'baz'}, 'qux': 'quxx'};
      var obj = {
        'foo': 'bar'
      };
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var obj = {};
      var {x} = y;
      import {foo} from 'bar';

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux' }, bar};
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var {x} = y;
      import {foo } from 'bar';

      Examples of correct code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {};
      var obj = { 'foo': 'bar' };
      var obj = { 'foo': { 'bar': 'baz' }, 'qux': 'quxx' };
      var obj = {
        'foo': 'bar'
      };
      var { x } = y;
      import { foo } from 'bar';

      arraysInObjects

      Examples of additional correct code for this rule with the "never", { "arraysInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "arraysInObjects": true }]*/
      
      var obj = {"foo": [ 1, 2 ] };
      var obj = {"foo": [ "baz", "bar" ] };

      Examples of additional correct code for this rule with the "always", { "arraysInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "arraysInObjects": false }]*/
      
      var obj = { "foo": [ 1, 2 ]};
      var obj = { "foo": [ "baz", "bar" ]};

      objectsInObjects

      Examples of additional correct code for this rule with the "never", { "objectsInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "objectsInObjects": true }]*/
      
      var obj = {"foo": {"baz": 1, "bar": 2} };

      Examples of additional correct code for this rule with the "always", { "objectsInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "objectsInObjects": false }]*/
      
      var obj = { "foo": { "baz": 1, "bar": 2 }};

      When Not To Use It

      You can turn this rule off if you are not concerned with the consistency of spacing between curly braces.

      Related Rules

      Unexpected block statement surrounding arrow body.
      Open

            .then((entries) => {
      Severity: Minor
      Found in src/index.js by eslint

      Require braces in arrow function body (arrow-body-style)

      Arrow functions have two syntactic forms for their function bodies. They may be defined with a block body (denoted by curly braces) () => { ... } or with a single expression () => ..., whose value is implicitly returned.

      Rule Details

      This rule can enforce or disallow the use of braces around arrow function body.

      Options

      The rule takes one or two options. The first is a string, which can be:

      • "always" enforces braces around the function body
      • "as-needed" enforces no braces where they can be omitted (default)
      • "never" enforces no braces around the function body (constrains arrow functions to the role of returning an expression)

      The second one is an object for more fine-grained configuration when the first option is "as-needed". Currently, the only available option is requireReturnForObjectLiteral, a boolean property. It's false by default. If set to true, it requires braces and an explicit return for object literals.

      "arrow-body-style": ["error", "always"]

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint arrow-body-style: ["error", "always"]*/
      /*eslint-env es6*/
      let foo = () => 0;

      Examples of correct code for this rule with the "always" option:

      let foo = () => {
          return 0;
      };
      let foo = (retv, name) => {
          retv[name] = true;
          return retv;
      };

      as-needed

      Examples of incorrect code for this rule with the default "as-needed" option:

      /*eslint arrow-body-style: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      let foo = () => {
          return 0;
      };
      let foo = () => {
          return {
             bar: {
                  foo: 1,
                  bar: 2,
              }
          };
      };

      Examples of correct code for this rule with the default "as-needed" option:

      /*eslint arrow-body-style: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      let foo = () => 0;
      let foo = (retv, name) => {
          retv[name] = true;
          return retv;
      };
      let foo = () => ({
          bar: {
              foo: 1,
              bar: 2,
          }
      });
      let foo = () => { bar(); };
      let foo = () => {};
      let foo = () => { /* do nothing */ };
      let foo = () => {
          // do nothing.
      };
      let foo = () => ({ bar: 0 });

      requireReturnForObjectLiteral

      This option is only applicable when used in conjunction with the "as-needed" option.

      Examples of incorrect code for this rule with the { "requireReturnForObjectLiteral": true } option:

      /*eslint arrow-body-style: ["error", "as-needed", { "requireReturnForObjectLiteral": true }]*/
      /*eslint-env es6*/
      let foo = () => ({});
      let foo = () => ({ bar: 0 });

      Examples of correct code for this rule with the { "requireReturnForObjectLiteral": true } option:

      /*eslint arrow-body-style: ["error", "as-needed", { "requireReturnForObjectLiteral": true }]*/
      /*eslint-env es6*/
      
      let foo = () => {};
      let foo = () => { return { bar: 0 }; };

      never

      Examples of incorrect code for this rule with the "never" option:

      /*eslint arrow-body-style: ["error", "never"]*/
      /*eslint-env es6*/
      
      let foo = () => {
          return 0;
      };
      let foo = (retv, name) => {
          retv[name] = true;
          return retv;
      };

      Examples of correct code for this rule with the "never" option:

      /*eslint arrow-body-style: ["error", "never"]*/
      /*eslint-env es6*/
      
      let foo = () => 0;
      let foo = () => ({ foo: 0 });

      Source: http://eslint.org/docs/rules/

      A space is required before '}'.
      Open

          let {options} = this
      Severity: Minor
      Found in src/index.js by eslint

      enforce consistent spacing inside braces (object-curly-spacing)

      While formatting preferences are very personal, a number of style guides require or disallow spaces between curly braces in the following situations:

      // simple object literals
      var obj = { foo: "bar" };
      
      // nested object literals
      var obj = { foo: { zoo: "bar" } };
      
      // destructuring assignment (EcmaScript 6)
      var { x, y } = y;
      
      // import/export declarations (EcmaScript 6)
      import { foo } from "bar";
      export { foo };

      Rule Details

      This rule enforce consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.

      Options

      This rule has two options, a string option and an object option.

      String option:

      • "never" (default) disallows spacing inside of braces
      • "always" requires spacing inside of braces (except {})

      Object option:

      • "arraysInObjects": true requires spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to never)
      • "arraysInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to always)
      • "objectsInObjects": true requires spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to never)
      • "objectsInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to always)

      never

      Examples of incorrect code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = { 'foo': 'bar' };
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux'}, bar};
      var {x } = y;
      import { foo } from 'bar';

      Examples of correct code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': {'bar': 'baz'}, 'qux': 'quxx'};
      var obj = {
        'foo': 'bar'
      };
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var obj = {};
      var {x} = y;
      import {foo} from 'bar';

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux' }, bar};
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var {x} = y;
      import {foo } from 'bar';

      Examples of correct code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {};
      var obj = { 'foo': 'bar' };
      var obj = { 'foo': { 'bar': 'baz' }, 'qux': 'quxx' };
      var obj = {
        'foo': 'bar'
      };
      var { x } = y;
      import { foo } from 'bar';

      arraysInObjects

      Examples of additional correct code for this rule with the "never", { "arraysInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "arraysInObjects": true }]*/
      
      var obj = {"foo": [ 1, 2 ] };
      var obj = {"foo": [ "baz", "bar" ] };

      Examples of additional correct code for this rule with the "always", { "arraysInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "arraysInObjects": false }]*/
      
      var obj = { "foo": [ 1, 2 ]};
      var obj = { "foo": [ "baz", "bar" ]};

      objectsInObjects

      Examples of additional correct code for this rule with the "never", { "objectsInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "objectsInObjects": true }]*/
      
      var obj = {"foo": {"baz": 1, "bar": 2} };

      Examples of additional correct code for this rule with the "always", { "objectsInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "objectsInObjects": false }]*/
      
      var obj = { "foo": { "baz": 1, "bar": 2 }};

      When Not To Use It

      You can turn this rule off if you are not concerned with the consistency of spacing between curly braces.

      Related Rules

      Unexpected parentheses around single function argument having a body with no curly braces
      Open

            .then((replies) => replies.filter((repl) => repl !== null))
      Severity: Minor
      Found in src/index.js by eslint

      Require parens in arrow function arguments (arrow-parens)

      Arrow functions can omit parentheses when they have exactly one parameter. In all other cases the parameter(s) must be wrapped in parentheses. This rule enforces the consistent use of parentheses in arrow functions.

      Rule Details

      This rule enforces parentheses around arrow function parameters regardless of arity. For example:

      /*eslint-env es6*/
      
      // Bad
      a => {}
      
      // Good
      (a) => {}

      Following this style will help you find arrow functions (=>) which may be mistakenly included in a condition when a comparison such as >= was the intent.

      /*eslint-env es6*/
      
      // Bad
      if (a => 2) {
      }
      
      // Good
      if (a >= 2) {
      }

      The rule can also be configured to discourage the use of parens when they are not required:

      /*eslint-env es6*/
      
      // Bad
      (a) => {}
      
      // Good
      a => {}

      Options

      This rule has a string option and an object one.

      String options are:

      • "always" (default) requires parens around arguments in all cases.
      • "as-needed" allows omitting parens when there is only one argument.

      Object properties for variants of the "as-needed" option:

      • "requireForBlockBody": true modifies the as-needed rule in order to require parens if the function body is in an instructions block (surrounded by braces).

      always

      Examples of incorrect code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => a);
      a(foo => { if (true) {} });

      Examples of correct code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      () => {};
      (a) => {};
      (a) => a;
      (a) => {'\n'}
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });

      If Statements

      One of benefits of this option is that it prevents the incorrect use of arrow functions in conditionals:

      /*eslint-env es6*/
      
      var a = 1;
      var b = 2;
      // ...
      if (a => b) {
       console.log('bigger');
      } else {
       console.log('smaller');
      }
      // outputs 'bigger', not smaller as expected

      The contents of the if statement is an arrow function, not a comparison.

      If the arrow function is intentional, it should be wrapped in parens to remove ambiguity.

      /*eslint-env es6*/
      
      var a = 1;
      var b = 0;
      // ...
      if ((a) => b) {
       console.log('truthy value returned');
      } else {
       console.log('falsey value returned');
      }
      // outputs 'truthy value returned'

      The following is another example of this behavior:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = a => b ? c: d;
      // f = ?

      f is an arrow function which takes a as an argument and returns the result of b ? c: d.

      This should be rewritten like so:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = (a) => b ? c: d;

      as-needed

      Examples of incorrect code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => a;
      (a) => {'\n'};
      a.then((foo) => {});
      a.then((foo) => a);
      a((foo) => { if (true) {} });

      Examples of correct code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      () => {};
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      requireForBlockBody

      Examples of incorrect code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => a;
      a => {};
      a => {'\n'};
      a.map((x) => x * x);
      a.map(x => {
        return x * x;
      });
      a.then(foo => {});

      Examples of correct code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => {'\n'};
      a => ({});
      () => {};
      a => a;
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });
      a((foo) => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      Further Reading

      Unexpected block statement surrounding arrow body.
      Open

          const getIdsToDelete = () => {
      Severity: Minor
      Found in src/index.js by eslint

      Require braces in arrow function body (arrow-body-style)

      Arrow functions have two syntactic forms for their function bodies. They may be defined with a block body (denoted by curly braces) () => { ... } or with a single expression () => ..., whose value is implicitly returned.

      Rule Details

      This rule can enforce or disallow the use of braces around arrow function body.

      Options

      The rule takes one or two options. The first is a string, which can be:

      • "always" enforces braces around the function body
      • "as-needed" enforces no braces where they can be omitted (default)
      • "never" enforces no braces around the function body (constrains arrow functions to the role of returning an expression)

      The second one is an object for more fine-grained configuration when the first option is "as-needed". Currently, the only available option is requireReturnForObjectLiteral, a boolean property. It's false by default. If set to true, it requires braces and an explicit return for object literals.

      "arrow-body-style": ["error", "always"]

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint arrow-body-style: ["error", "always"]*/
      /*eslint-env es6*/
      let foo = () => 0;

      Examples of correct code for this rule with the "always" option:

      let foo = () => {
          return 0;
      };
      let foo = (retv, name) => {
          retv[name] = true;
          return retv;
      };

      as-needed

      Examples of incorrect code for this rule with the default "as-needed" option:

      /*eslint arrow-body-style: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      let foo = () => {
          return 0;
      };
      let foo = () => {
          return {
             bar: {
                  foo: 1,
                  bar: 2,
              }
          };
      };

      Examples of correct code for this rule with the default "as-needed" option:

      /*eslint arrow-body-style: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      let foo = () => 0;
      let foo = (retv, name) => {
          retv[name] = true;
          return retv;
      };
      let foo = () => ({
          bar: {
              foo: 1,
              bar: 2,
          }
      });
      let foo = () => { bar(); };
      let foo = () => {};
      let foo = () => { /* do nothing */ };
      let foo = () => {
          // do nothing.
      };
      let foo = () => ({ bar: 0 });

      requireReturnForObjectLiteral

      This option is only applicable when used in conjunction with the "as-needed" option.

      Examples of incorrect code for this rule with the { "requireReturnForObjectLiteral": true } option:

      /*eslint arrow-body-style: ["error", "as-needed", { "requireReturnForObjectLiteral": true }]*/
      /*eslint-env es6*/
      let foo = () => ({});
      let foo = () => ({ bar: 0 });

      Examples of correct code for this rule with the { "requireReturnForObjectLiteral": true } option:

      /*eslint arrow-body-style: ["error", "as-needed", { "requireReturnForObjectLiteral": true }]*/
      /*eslint-env es6*/
      
      let foo = () => {};
      let foo = () => { return { bar: 0 }; };

      never

      Examples of incorrect code for this rule with the "never" option:

      /*eslint arrow-body-style: ["error", "never"]*/
      /*eslint-env es6*/
      
      let foo = () => {
          return 0;
      };
      let foo = (retv, name) => {
          retv[name] = true;
          return retv;
      };

      Examples of correct code for this rule with the "never" option:

      /*eslint arrow-body-style: ["error", "never"]*/
      /*eslint-env es6*/
      
      let foo = () => 0;
      let foo = () => ({ foo: 0 });

      Source: http://eslint.org/docs/rules/

      Unexpected parentheses around single function argument having a body with no curly braces
      Open

      const concatRedisResult = (i) => (results) => [].concat(...results.map((r) => r[i]))
      Severity: Minor
      Found in src/index.js by eslint

      Require parens in arrow function arguments (arrow-parens)

      Arrow functions can omit parentheses when they have exactly one parameter. In all other cases the parameter(s) must be wrapped in parentheses. This rule enforces the consistent use of parentheses in arrow functions.

      Rule Details

      This rule enforces parentheses around arrow function parameters regardless of arity. For example:

      /*eslint-env es6*/
      
      // Bad
      a => {}
      
      // Good
      (a) => {}

      Following this style will help you find arrow functions (=>) which may be mistakenly included in a condition when a comparison such as >= was the intent.

      /*eslint-env es6*/
      
      // Bad
      if (a => 2) {
      }
      
      // Good
      if (a >= 2) {
      }

      The rule can also be configured to discourage the use of parens when they are not required:

      /*eslint-env es6*/
      
      // Bad
      (a) => {}
      
      // Good
      a => {}

      Options

      This rule has a string option and an object one.

      String options are:

      • "always" (default) requires parens around arguments in all cases.
      • "as-needed" allows omitting parens when there is only one argument.

      Object properties for variants of the "as-needed" option:

      • "requireForBlockBody": true modifies the as-needed rule in order to require parens if the function body is in an instructions block (surrounded by braces).

      always

      Examples of incorrect code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => a);
      a(foo => { if (true) {} });

      Examples of correct code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      () => {};
      (a) => {};
      (a) => a;
      (a) => {'\n'}
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });

      If Statements

      One of benefits of this option is that it prevents the incorrect use of arrow functions in conditionals:

      /*eslint-env es6*/
      
      var a = 1;
      var b = 2;
      // ...
      if (a => b) {
       console.log('bigger');
      } else {
       console.log('smaller');
      }
      // outputs 'bigger', not smaller as expected

      The contents of the if statement is an arrow function, not a comparison.

      If the arrow function is intentional, it should be wrapped in parens to remove ambiguity.

      /*eslint-env es6*/
      
      var a = 1;
      var b = 0;
      // ...
      if ((a) => b) {
       console.log('truthy value returned');
      } else {
       console.log('falsey value returned');
      }
      // outputs 'truthy value returned'

      The following is another example of this behavior:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = a => b ? c: d;
      // f = ?

      f is an arrow function which takes a as an argument and returns the result of b ? c: d.

      This should be rewritten like so:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = (a) => b ? c: d;

      as-needed

      Examples of incorrect code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => a;
      (a) => {'\n'};
      a.then((foo) => {});
      a.then((foo) => a);
      a((foo) => { if (true) {} });

      Examples of correct code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      () => {};
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      requireForBlockBody

      Examples of incorrect code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => a;
      a => {};
      a => {'\n'};
      a.map((x) => x * x);
      a.map(x => {
        return x * x;
      });
      a.then(foo => {});

      Examples of correct code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => {'\n'};
      a => ({});
      () => {};
      a => a;
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });
      a((foo) => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      Further Reading

      A space is required after '{'.
      Open

          const {ConflictError} = this.errors
      Severity: Minor
      Found in src/index.js by eslint

      enforce consistent spacing inside braces (object-curly-spacing)

      While formatting preferences are very personal, a number of style guides require or disallow spaces between curly braces in the following situations:

      // simple object literals
      var obj = { foo: "bar" };
      
      // nested object literals
      var obj = { foo: { zoo: "bar" } };
      
      // destructuring assignment (EcmaScript 6)
      var { x, y } = y;
      
      // import/export declarations (EcmaScript 6)
      import { foo } from "bar";
      export { foo };

      Rule Details

      This rule enforce consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.

      Options

      This rule has two options, a string option and an object option.

      String option:

      • "never" (default) disallows spacing inside of braces
      • "always" requires spacing inside of braces (except {})

      Object option:

      • "arraysInObjects": true requires spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to never)
      • "arraysInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to always)
      • "objectsInObjects": true requires spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to never)
      • "objectsInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to always)

      never

      Examples of incorrect code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = { 'foo': 'bar' };
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux'}, bar};
      var {x } = y;
      import { foo } from 'bar';

      Examples of correct code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': {'bar': 'baz'}, 'qux': 'quxx'};
      var obj = {
        'foo': 'bar'
      };
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var obj = {};
      var {x} = y;
      import {foo} from 'bar';

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux' }, bar};
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var {x} = y;
      import {foo } from 'bar';

      Examples of correct code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {};
      var obj = { 'foo': 'bar' };
      var obj = { 'foo': { 'bar': 'baz' }, 'qux': 'quxx' };
      var obj = {
        'foo': 'bar'
      };
      var { x } = y;
      import { foo } from 'bar';

      arraysInObjects

      Examples of additional correct code for this rule with the "never", { "arraysInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "arraysInObjects": true }]*/
      
      var obj = {"foo": [ 1, 2 ] };
      var obj = {"foo": [ "baz", "bar" ] };

      Examples of additional correct code for this rule with the "always", { "arraysInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "arraysInObjects": false }]*/
      
      var obj = { "foo": [ 1, 2 ]};
      var obj = { "foo": [ "baz", "bar" ]};

      objectsInObjects

      Examples of additional correct code for this rule with the "never", { "objectsInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "objectsInObjects": true }]*/
      
      var obj = {"foo": {"baz": 1, "bar": 2} };

      Examples of additional correct code for this rule with the "always", { "objectsInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "objectsInObjects": false }]*/
      
      var obj = { "foo": { "baz": 1, "bar": 2 }};

      When Not To Use It

      You can turn this rule off if you are not concerned with the consistency of spacing between curly braces.

      Related Rules

      Unexpected parentheses around single function argument having a body with no curly braces
      Open

            .then((replies) => replies.filter((repl) => repl !== null))
      Severity: Minor
      Found in src/index.js by eslint

      Require parens in arrow function arguments (arrow-parens)

      Arrow functions can omit parentheses when they have exactly one parameter. In all other cases the parameter(s) must be wrapped in parentheses. This rule enforces the consistent use of parentheses in arrow functions.

      Rule Details

      This rule enforces parentheses around arrow function parameters regardless of arity. For example:

      /*eslint-env es6*/
      
      // Bad
      a => {}
      
      // Good
      (a) => {}

      Following this style will help you find arrow functions (=>) which may be mistakenly included in a condition when a comparison such as >= was the intent.

      /*eslint-env es6*/
      
      // Bad
      if (a => 2) {
      }
      
      // Good
      if (a >= 2) {
      }

      The rule can also be configured to discourage the use of parens when they are not required:

      /*eslint-env es6*/
      
      // Bad
      (a) => {}
      
      // Good
      a => {}

      Options

      This rule has a string option and an object one.

      String options are:

      • "always" (default) requires parens around arguments in all cases.
      • "as-needed" allows omitting parens when there is only one argument.

      Object properties for variants of the "as-needed" option:

      • "requireForBlockBody": true modifies the as-needed rule in order to require parens if the function body is in an instructions block (surrounded by braces).

      always

      Examples of incorrect code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => a);
      a(foo => { if (true) {} });

      Examples of correct code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      () => {};
      (a) => {};
      (a) => a;
      (a) => {'\n'}
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });

      If Statements

      One of benefits of this option is that it prevents the incorrect use of arrow functions in conditionals:

      /*eslint-env es6*/
      
      var a = 1;
      var b = 2;
      // ...
      if (a => b) {
       console.log('bigger');
      } else {
       console.log('smaller');
      }
      // outputs 'bigger', not smaller as expected

      The contents of the if statement is an arrow function, not a comparison.

      If the arrow function is intentional, it should be wrapped in parens to remove ambiguity.

      /*eslint-env es6*/
      
      var a = 1;
      var b = 0;
      // ...
      if ((a) => b) {
       console.log('truthy value returned');
      } else {
       console.log('falsey value returned');
      }
      // outputs 'truthy value returned'

      The following is another example of this behavior:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = a => b ? c: d;
      // f = ?

      f is an arrow function which takes a as an argument and returns the result of b ? c: d.

      This should be rewritten like so:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = (a) => b ? c: d;

      as-needed

      Examples of incorrect code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => a;
      (a) => {'\n'};
      a.then((foo) => {});
      a.then((foo) => a);
      a((foo) => { if (true) {} });

      Examples of correct code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      () => {};
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      requireForBlockBody

      Examples of incorrect code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => a;
      a => {};
      a => {'\n'};
      a.map((x) => x * x);
      a.map(x => {
        return x * x;
      });
      a.then(foo => {});

      Examples of correct code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => {'\n'};
      a => ({});
      () => {};
      a => a;
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });
      a((foo) => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      Further Reading

      Unexpected parentheses around single function argument having a body with no curly braces
      Open

      const concatRedisResult = (i) => (results) => [].concat(...results.map((r) => r[i]))
      Severity: Minor
      Found in src/index.js by eslint

      Require parens in arrow function arguments (arrow-parens)

      Arrow functions can omit parentheses when they have exactly one parameter. In all other cases the parameter(s) must be wrapped in parentheses. This rule enforces the consistent use of parentheses in arrow functions.

      Rule Details

      This rule enforces parentheses around arrow function parameters regardless of arity. For example:

      /*eslint-env es6*/
      
      // Bad
      a => {}
      
      // Good
      (a) => {}

      Following this style will help you find arrow functions (=>) which may be mistakenly included in a condition when a comparison such as >= was the intent.

      /*eslint-env es6*/
      
      // Bad
      if (a => 2) {
      }
      
      // Good
      if (a >= 2) {
      }

      The rule can also be configured to discourage the use of parens when they are not required:

      /*eslint-env es6*/
      
      // Bad
      (a) => {}
      
      // Good
      a => {}

      Options

      This rule has a string option and an object one.

      String options are:

      • "always" (default) requires parens around arguments in all cases.
      • "as-needed" allows omitting parens when there is only one argument.

      Object properties for variants of the "as-needed" option:

      • "requireForBlockBody": true modifies the as-needed rule in order to require parens if the function body is in an instructions block (surrounded by braces).

      always

      Examples of incorrect code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => a);
      a(foo => { if (true) {} });

      Examples of correct code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      () => {};
      (a) => {};
      (a) => a;
      (a) => {'\n'}
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });

      If Statements

      One of benefits of this option is that it prevents the incorrect use of arrow functions in conditionals:

      /*eslint-env es6*/
      
      var a = 1;
      var b = 2;
      // ...
      if (a => b) {
       console.log('bigger');
      } else {
       console.log('smaller');
      }
      // outputs 'bigger', not smaller as expected

      The contents of the if statement is an arrow function, not a comparison.

      If the arrow function is intentional, it should be wrapped in parens to remove ambiguity.

      /*eslint-env es6*/
      
      var a = 1;
      var b = 0;
      // ...
      if ((a) => b) {
       console.log('truthy value returned');
      } else {
       console.log('falsey value returned');
      }
      // outputs 'truthy value returned'

      The following is another example of this behavior:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = a => b ? c: d;
      // f = ?

      f is an arrow function which takes a as an argument and returns the result of b ? c: d.

      This should be rewritten like so:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = (a) => b ? c: d;

      as-needed

      Examples of incorrect code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => a;
      (a) => {'\n'};
      a.then((foo) => {});
      a.then((foo) => a);
      a((foo) => { if (true) {} });

      Examples of correct code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      () => {};
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      requireForBlockBody

      Examples of incorrect code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => a;
      a => {};
      a => {'\n'};
      a.map((x) => x * x);
      a.map(x => {
        return x * x;
      });
      a.then(foo => {});

      Examples of correct code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => {'\n'};
      a => ({});
      () => {};
      a => a;
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });
      a((foo) => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      Further Reading

      A space is required after '{'.
      Open

          const {redis} = this
      Severity: Minor
      Found in src/index.js by eslint

      enforce consistent spacing inside braces (object-curly-spacing)

      While formatting preferences are very personal, a number of style guides require or disallow spaces between curly braces in the following situations:

      // simple object literals
      var obj = { foo: "bar" };
      
      // nested object literals
      var obj = { foo: { zoo: "bar" } };
      
      // destructuring assignment (EcmaScript 6)
      var { x, y } = y;
      
      // import/export declarations (EcmaScript 6)
      import { foo } from "bar";
      export { foo };

      Rule Details

      This rule enforce consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.

      Options

      This rule has two options, a string option and an object option.

      String option:

      • "never" (default) disallows spacing inside of braces
      • "always" requires spacing inside of braces (except {})

      Object option:

      • "arraysInObjects": true requires spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to never)
      • "arraysInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to always)
      • "objectsInObjects": true requires spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to never)
      • "objectsInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to always)

      never

      Examples of incorrect code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = { 'foo': 'bar' };
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux'}, bar};
      var {x } = y;
      import { foo } from 'bar';

      Examples of correct code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': {'bar': 'baz'}, 'qux': 'quxx'};
      var obj = {
        'foo': 'bar'
      };
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var obj = {};
      var {x} = y;
      import {foo} from 'bar';

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux' }, bar};
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var {x} = y;
      import {foo } from 'bar';

      Examples of correct code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {};
      var obj = { 'foo': 'bar' };
      var obj = { 'foo': { 'bar': 'baz' }, 'qux': 'quxx' };
      var obj = {
        'foo': 'bar'
      };
      var { x } = y;
      import { foo } from 'bar';

      arraysInObjects

      Examples of additional correct code for this rule with the "never", { "arraysInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "arraysInObjects": true }]*/
      
      var obj = {"foo": [ 1, 2 ] };
      var obj = {"foo": [ "baz", "bar" ] };

      Examples of additional correct code for this rule with the "always", { "arraysInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "arraysInObjects": false }]*/
      
      var obj = { "foo": [ 1, 2 ]};
      var obj = { "foo": [ "baz", "bar" ]};

      objectsInObjects

      Examples of additional correct code for this rule with the "never", { "objectsInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "objectsInObjects": true }]*/
      
      var obj = {"foo": {"baz": 1, "bar": 2} };

      Examples of additional correct code for this rule with the "always", { "objectsInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "objectsInObjects": false }]*/
      
      var obj = { "foo": { "baz": 1, "bar": 2 }};

      When Not To Use It

      You can turn this rule off if you are not concerned with the consistency of spacing between curly braces.

      Related Rules

      A space is required before '}'.
      Open

          const {redis, recordTypes, keys} = this
      Severity: Minor
      Found in src/index.js by eslint

      enforce consistent spacing inside braces (object-curly-spacing)

      While formatting preferences are very personal, a number of style guides require or disallow spaces between curly braces in the following situations:

      // simple object literals
      var obj = { foo: "bar" };
      
      // nested object literals
      var obj = { foo: { zoo: "bar" } };
      
      // destructuring assignment (EcmaScript 6)
      var { x, y } = y;
      
      // import/export declarations (EcmaScript 6)
      import { foo } from "bar";
      export { foo };

      Rule Details

      This rule enforce consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.

      Options

      This rule has two options, a string option and an object option.

      String option:

      • "never" (default) disallows spacing inside of braces
      • "always" requires spacing inside of braces (except {})

      Object option:

      • "arraysInObjects": true requires spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to never)
      • "arraysInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to always)
      • "objectsInObjects": true requires spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to never)
      • "objectsInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to always)

      never

      Examples of incorrect code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = { 'foo': 'bar' };
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux'}, bar};
      var {x } = y;
      import { foo } from 'bar';

      Examples of correct code for this rule with the default "never" option:

      /*eslint object-curly-spacing: ["error", "never"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': {'bar': 'baz'}, 'qux': 'quxx'};
      var obj = {
        'foo': 'bar'
      };
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var obj = {};
      var {x} = y;
      import {foo} from 'bar';

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {'foo': 'bar'};
      var obj = {'foo': 'bar' };
      var obj = { baz: {'foo': 'qux'}, bar};
      var obj = {baz: { 'foo': 'qux' }, bar};
      var obj = {'foo': 'bar'
      };
      var obj = {
        'foo':'bar'};
      var {x} = y;
      import {foo } from 'bar';

      Examples of correct code for this rule with the "always" option:

      /*eslint object-curly-spacing: ["error", "always"]*/
      
      var obj = {};
      var obj = { 'foo': 'bar' };
      var obj = { 'foo': { 'bar': 'baz' }, 'qux': 'quxx' };
      var obj = {
        'foo': 'bar'
      };
      var { x } = y;
      import { foo } from 'bar';

      arraysInObjects

      Examples of additional correct code for this rule with the "never", { "arraysInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "arraysInObjects": true }]*/
      
      var obj = {"foo": [ 1, 2 ] };
      var obj = {"foo": [ "baz", "bar" ] };

      Examples of additional correct code for this rule with the "always", { "arraysInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "arraysInObjects": false }]*/
      
      var obj = { "foo": [ 1, 2 ]};
      var obj = { "foo": [ "baz", "bar" ]};

      objectsInObjects

      Examples of additional correct code for this rule with the "never", { "objectsInObjects": true } options:

      /*eslint object-curly-spacing: ["error", "never", { "objectsInObjects": true }]*/
      
      var obj = {"foo": {"baz": 1, "bar": 2} };

      Examples of additional correct code for this rule with the "always", { "objectsInObjects": false } options:

      /*eslint object-curly-spacing: ["error", "always", { "objectsInObjects": false }]*/
      
      var obj = { "foo": { "baz": 1, "bar": 2 }};

      When Not To Use It

      You can turn this rule off if you are not concerned with the consistency of spacing between curly braces.

      Related Rules

      Unexpected parentheses around single function argument having a body with no curly braces
      Open

              ids.forEach((id) => pipeline.sismember(type, id))
      Severity: Minor
      Found in src/index.js by eslint

      Require parens in arrow function arguments (arrow-parens)

      Arrow functions can omit parentheses when they have exactly one parameter. In all other cases the parameter(s) must be wrapped in parentheses. This rule enforces the consistent use of parentheses in arrow functions.

      Rule Details

      This rule enforces parentheses around arrow function parameters regardless of arity. For example:

      /*eslint-env es6*/
      
      // Bad
      a => {}
      
      // Good
      (a) => {}

      Following this style will help you find arrow functions (=>) which may be mistakenly included in a condition when a comparison such as >= was the intent.

      /*eslint-env es6*/
      
      // Bad
      if (a => 2) {
      }
      
      // Good
      if (a >= 2) {
      }

      The rule can also be configured to discourage the use of parens when they are not required:

      /*eslint-env es6*/
      
      // Bad
      (a) => {}
      
      // Good
      a => {}

      Options

      This rule has a string option and an object one.

      String options are:

      • "always" (default) requires parens around arguments in all cases.
      • "as-needed" allows omitting parens when there is only one argument.

      Object properties for variants of the "as-needed" option:

      • "requireForBlockBody": true modifies the as-needed rule in order to require parens if the function body is in an instructions block (surrounded by braces).

      always

      Examples of incorrect code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => a);
      a(foo => { if (true) {} });

      Examples of correct code for this rule with the default "always" option:

      /*eslint arrow-parens: ["error", "always"]*/
      /*eslint-env es6*/
      
      () => {};
      (a) => {};
      (a) => a;
      (a) => {'\n'}
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });

      If Statements

      One of benefits of this option is that it prevents the incorrect use of arrow functions in conditionals:

      /*eslint-env es6*/
      
      var a = 1;
      var b = 2;
      // ...
      if (a => b) {
       console.log('bigger');
      } else {
       console.log('smaller');
      }
      // outputs 'bigger', not smaller as expected

      The contents of the if statement is an arrow function, not a comparison.

      If the arrow function is intentional, it should be wrapped in parens to remove ambiguity.

      /*eslint-env es6*/
      
      var a = 1;
      var b = 0;
      // ...
      if ((a) => b) {
       console.log('truthy value returned');
      } else {
       console.log('falsey value returned');
      }
      // outputs 'truthy value returned'

      The following is another example of this behavior:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = a => b ? c: d;
      // f = ?

      f is an arrow function which takes a as an argument and returns the result of b ? c: d.

      This should be rewritten like so:

      /*eslint-env es6*/
      
      var a = 1, b = 2, c = 3, d = 4;
      var f = (a) => b ? c: d;

      as-needed

      Examples of incorrect code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => a;
      (a) => {'\n'};
      a.then((foo) => {});
      a.then((foo) => a);
      a((foo) => { if (true) {} });

      Examples of correct code for this rule with the "as-needed" option:

      /*eslint arrow-parens: ["error", "as-needed"]*/
      /*eslint-env es6*/
      
      () => {};
      a => {};
      a => a;
      a => {'\n'};
      a.then(foo => {});
      a.then(foo => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      requireForBlockBody

      Examples of incorrect code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => a;
      a => {};
      a => {'\n'};
      a.map((x) => x * x);
      a.map(x => {
        return x * x;
      });
      a.then(foo => {});

      Examples of correct code for the { "requireForBlockBody": true } option:

      /*eslint arrow-parens: [2, "as-needed", { "requireForBlockBody": true }]*/
      /*eslint-env es6*/
      
      (a) => {};
      (a) => {'\n'};
      a => ({});
      () => {};
      a => a;
      a.then((foo) => {});
      a.then((foo) => { if (true) {} });
      a((foo) => { if (true) {} });
      (a, b, c) => a;
      (a = 10) => a;
      ([a, b]) => a;
      ({a, b}) => a;

      Further Reading

      for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.
      Open

          for (const key in options) {
      Severity: Minor
      Found in src/index.js by eslint

      disallow specified syntax (no-restricted-syntax)

      JavaScript has a lot of language features, and not everyone likes all of them. As a result, some projects choose to disallow the use of certain language features altogether. For instance, you might decide to disallow the use of try-catch or class, or you might decide to disallow the use of the in operator.

      Rather than creating separate rules for every language feature you want to turn off, this rule allows you to configure the syntax elements you want to restrict use of. These elements are represented by their ESTree node types. For example, a function declaration is represented by FunctionDeclaration and the with statement is represented by WithStatement. You may find the full list of AST node names you can use on GitHub and use the online parser to see what type of nodes your code consists of.

      You can also specify [AST selectors](../developer-guide/selectors) to restrict, allowing much more precise control over syntax patterns.

      Rule Details

      This rule disallows specified (that is, user-defined) syntax.

      Options

      This rule takes a list of strings, where each string is an AST selector:

      {
          "rules": {
              "no-restricted-syntax": ["error", "FunctionExpression", "WithStatement", "BinaryExpression[operator='in']"]
          }
      }

      Alternatively, the rule also accepts objects, where the selector and an optional custom message are specified:

      {
          "rules": {
              "no-restricted-syntax": [
                  "error",
                  {
                      "selector": "FunctionExpression",
                      "message": "Function expressions are not allowed."
                  },
                  {
                      "selector": "CallExpression[callee.name='setTimeout'][arguments.length!=2]",
                      "message": "setTimeout must always be invoked with two arguments."
                  }
              ]
          }
      }

      If a custom message is specified with the message property, ESLint will use that message when reporting occurrences of the syntax specified in the selector property.

      The string and object formats can be freely mixed in the configuration as needed.

      Examples of incorrect code for this rule with the "FunctionExpression", "WithStatement", BinaryExpression[operator='in'] options:

      /* eslint no-restricted-syntax: ["error", "FunctionExpression", "WithStatement", "BinaryExpression[operator='in']"] */
      
      with (me) {
          dontMess();
      }
      
      var doSomething = function () {};
      
      foo in bar;

      Examples of correct code for this rule with the "FunctionExpression", "WithStatement", BinaryExpression[operator='in'] options:

      /* eslint no-restricted-syntax: ["error", "FunctionExpression", "WithStatement", "BinaryExpression[operator='in']"] */
      
      me.dontMess();
      
      function doSomething() {};
      
      foo instanceof bar;

      When Not To Use It

      If you don't want to restrict your code from using any JavaScript features or syntax, you should not use this rule.

      Related Rules

      • [no-alert](no-alert.md)
      • [no-console](no-console.md)
      • [no-debugger](no-debugger.md)
      • [no-restricted-properties](no-restricted-properties.md) Source: http://eslint.org/docs/rules/

      Expected to return a value at the end of arrow function.
      Open

            .then((replies) => {
      Severity: Minor
      Found in src/index.js by eslint

      require return statements to either always or never specify values (consistent-return)

      Unlike statically-typed languages which enforce that a function returns a specified type of value, JavaScript allows different code paths in a function to return different types of values.

      A confusing aspect of JavaScript is that a function returns undefined if any of the following are true:

      • it does not execute a return statement before it exits
      • it executes return which does not specify a value explicitly
      • it executes return undefined
      • it executes return void followed by an expression (for example, a function call)
      • it executes return followed by any other expression which evaluates to undefined

      If any code paths in a function return a value explicitly but some code path do not return a value explicitly, it might be a typing mistake, especially in a large function. In the following example:

      • a code path through the function returns a Boolean value true
      • another code path does not return a value explicitly, therefore returns undefined implicitly
      function doSomething(condition) {
          if (condition) {
              return true;
          } else {
              return;
          }
      }

      Rule Details

      This rule requires return statements to either always or never specify values. This rule ignores function definitions where the name begins with an uppercase letter, because constructors (when invoked with the new operator) return the instantiated object implicitly if they do not return another object explicitly.

      Examples of incorrect code for this rule:

      /*eslint consistent-return: "error"*/
      
      function doSomething(condition) {
          if (condition) {
              return true;
          } else {
              return;
          }
      }
      
      function doSomething(condition) {
          if (condition) {
              return true;
          }
      }

      Examples of correct code for this rule:

      /*eslint consistent-return: "error"*/
      
      function doSomething(condition) {
          if (condition) {
              return true;
          } else {
              return false;
          }
      }
      
      function Foo() {
          if (!(this instanceof Foo)) {
              return new Foo();
          }
      
          this.a = 0;
      }

      Options

      This rule has an object option:

      • "treatUndefinedAsUnspecified": false (default) always either specify values or return undefined implicitly only.
      • "treatUndefinedAsUnspecified": true always either specify values or return undefined explicitly or implicitly.

      treatUndefinedAsUnspecified

      Examples of incorrect code for this rule with the default { "treatUndefinedAsUnspecified": false } option:

      /*eslint consistent-return: ["error", { "treatUndefinedAsUnspecified": false }]*/
      
      function foo(callback) {
          if (callback) {
              return void callback();
          }
          // no return statement
      }
      
      function bar(condition) {
          if (condition) {
              return undefined;
          }
          // no return statement
      }

      Examples of incorrect code for this rule with the { "treatUndefinedAsUnspecified": true } option:

      /*eslint consistent-return: ["error", { "treatUndefinedAsUnspecified": true }]*/
      
      function foo(callback) {
          if (callback) {
              return void callback();
          }
          return true;
      }
      
      function bar(condition) {
          if (condition) {
              return undefined;
          }
          return true;
      }

      Examples of correct code for this rule with the { "treatUndefinedAsUnspecified": true } option:

      /*eslint consistent-return: ["error", { "treatUndefinedAsUnspecified": true }]*/
      
      function foo(callback) {
          if (callback) {
              return void callback();
          }
          // no return statement
      }
      
      function bar(condition) {
          if (condition) {
              return undefined;
          }
          // no return statement
      }

      When Not To Use It

      If you want to allow functions to have different return behavior depending on code branching, then it is safe to disable this rule. Source: http://eslint.org/docs/rules/

      Absolute imports should come before relative imports.
      Open

      import { applyOptions } from 'fortune/lib/adapter/adapters/common.js'
      Severity: Minor
      Found in src/index.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Absolute imports should come before relative imports.
      Open

      import applyUpdate from 'fortune/lib/common/apply_update'
      Severity: Minor
      Found in src/index.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      There are no issues that match your filters.

      Category
      Status