thibremy/fortune-redis

View on GitHub

Showing 55 of 55 total issues

Line 3 exceeds the maximum line length of 100.
Open

export const isBuffer = (fieldType) => (fieldType && (fieldType === Buffer || fieldType.prototype.constructor === Buffer))
Severity: Minor
Found in src/helpers.js by eslint

enforce a maximum line length (max-len)

Very long lines of code in any language can be difficult to read. In order to aid in readability and maintainability many coders have developed a convention to limit lines of code to X number of characters (traditionally 80 characters).

var foo = { "bar": "This is a bar.", "baz": { "qux": "This is a qux" }, "difficult": "to read" }; // very long

Rule Details

This rule enforces a maximum line length to increase code readability and maintainability. The length of a line is defined as the number of Unicode characters in the line.

Options

This rule has a number or object option:

  • "code" (default 80) enforces a maximum line length
  • "tabWidth" (default 4) specifies the character width for tab characters
  • "comments" enforces a maximum line length for comments; defaults to value of code
  • "ignorePattern" ignores lines matching a regular expression; can only match a single line and need to be double escaped when written in YAML or JSON
  • "ignoreComments": true ignores all trailing comments and comments on their own line
  • "ignoreTrailingComments": true ignores only trailing comments
  • "ignoreUrls": true ignores lines that contain a URL
  • "ignoreStrings": true ignores lines that contain a double-quoted or single-quoted string
  • "ignoreTemplateLiterals": true ignores lines that contain a template literal
  • "ignoreRegExpLiterals": true ignores lines that contain a RegExp literal

code

Examples of incorrect code for this rule with the default { "code": 80 } option:

/*eslint max-len: ["error", 80]*/

var foo = { "bar": "This is a bar.", "baz": { "qux": "This is a qux" }, "difficult": "to read" };

Examples of correct code for this rule with the default { "code": 80 } option:

/*eslint max-len: ["error", 80]*/

var foo = {
  "bar": "This is a bar.",
  "baz": { "qux": "This is a qux" },
  "easier": "to read"
};

tabWidth

Examples of incorrect code for this rule with the default { "tabWidth": 4 } option:

/*eslint max-len: ["error", 80, 4]*/

\t  \t  var foo = { "bar": "This is a bar.", "baz": { "qux": "This is a qux" } };

Examples of correct code for this rule with the default { "tabWidth": 4 } option:

/*eslint max-len: ["error", 80, 4]*/

\t  \t  var foo = {
\t  \t  \t  \t  "bar": "This is a bar.",
\t  \t  \t  \t  "baz": { "qux": "This is a qux" }
\t  \t  };

comments

Examples of incorrect code for this rule with the { "comments": 65 } option:

/*eslint max-len: ["error", { "comments": 65 }]*/

/**
 * This is a comment that violates the maximum line length we have specified
**/

ignoreComments

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

/*eslint max-len: ["error", { "ignoreComments": true }]*/

/**
 * This is a really really really really really really really really really long comment
**/

ignoreTrailingComments

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

/*eslint max-len: ["error", { "ignoreTrailingComments": true }]*/

var foo = 'bar'; // This is a really really really really really really really long comment

ignoreUrls

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

/*eslint max-len: ["error", { "ignoreUrls": true }]*/

var url = 'https://www.example.com/really/really/really/really/really/really/really/long';

ignoreStrings

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

/*eslint max-len: ["error", { "ignoreStrings": true }]*/

var longString = 'this is a really really really really really long string!';

ignoreTemplateLiterals

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

/*eslint max-len: ["error", { "ignoreTemplateLiterals": true }]*/

var longTemplateLiteral = `this is a really really really really really long template literal!`;

ignoreRegExpLiterals

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

/*eslint max-len: ["error", { "ignoreRegExpLiterals": true }]*/

var longRegExpLiteral = /this is a really really really really really long regular expression!/;

ignorePattern

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

/*eslint max-len: ["error", { "ignorePattern": "^\\s*var\\s.+=\\s*require\\s*\\(/" }]*/

var dep = require('really/really/really/really/really/really/really/really/long/module');

Related Rules

  • [complexity](complexity.md)
  • [max-depth](max-depth.md)
  • [max-nested-callbacks](max-nested-callbacks.md)
  • [max-params](max-params.md)
  • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

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

export function outputRecord(type, record) {
  const { recordTypes, keys } = this
  const primaryKey = keys.primary
  const isArrayKey = keys.isArray
  const typeKey = this.keys.type
Severity: Minor
Found in src/helpers.js - About 1 hr to fix

    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

        Avoid too many return statements within this function.
        Open

            return rec
        Severity: Major
        Found in src/helpers.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return rec
          Severity: Major
          Found in src/helpers.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return rec
            Severity: Major
            Found in src/helpers.js - About 30 mins to fix

              Assignment to property of function parameter 'rec'.
              Open

                    rec[field] = toBuffer(record[field]) || null
              Severity: Minor
              Found in src/helpers.js by eslint

              Disallow Reassignment of Function Parameters (no-param-reassign)

              Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate the arguments object. Often, assignment to function parameters is unintended and indicative of a mistake or programmer error.

              This rule can be also configured to fail when function parameters are modified. Side effects on parameters can cause counter-intuitive execution flow and make errors difficult to track down.

              Rule Details

              This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.

              Examples of incorrect code for this rule:

              /*eslint no-param-reassign: "error"*/
              
              function foo(bar) {
                  bar = 13;
              }
              
              function foo(bar) {
                  bar++;
              }

              Examples of correct code for this rule:

              /*eslint no-param-reassign: "error"*/
              
              function foo(bar) {
                  var baz = bar;
              }

              Options

              This rule takes one option, an object, with a boolean property "props" and an array "ignorePropertyModificationsFor". "props" is false by default. If "props" is set to true, this rule warns against the modification of parameter properties unless they're included in "ignorePropertyModificationsFor", which is an empty array by default.

              props

              Examples of correct code for the default { "props": false } option:

              /*eslint no-param-reassign: ["error", { "props": false }]*/
              
              function foo(bar) {
                  bar.prop = "value";
              }
              
              function foo(bar) {
                  delete bar.aaa;
              }
              
              function foo(bar) {
                  bar.aaa++;
              }

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

              /*eslint no-param-reassign: ["error", { "props": true }]*/
              
              function foo(bar) {
                  bar.prop = "value";
              }
              
              function foo(bar) {
                  delete bar.aaa;
              }
              
              function foo(bar) {
                  bar.aaa++;
              }

              Examples of correct code for the { "props": true } option with "ignorePropertyModificationsFor" set:

              /*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsFor": ["bar"] }]*/
              
              function foo(bar) {
                  bar.prop = "value";
              }
              
              function foo(bar) {
                  delete bar.aaa;
              }
              
              function foo(bar) {
                  bar.aaa++;
              }

              When Not To Use It

              If you want to allow assignment to function parameters, then you can safely disable this rule.

              Further Reading

              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/

              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

              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/

              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

              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 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 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

              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

              Assignment to property of function parameter 'rec'.
              Open

                      rec[field] = record[field].map(toBuffer)
              Severity: Minor
              Found in src/helpers.js by eslint

              Disallow Reassignment of Function Parameters (no-param-reassign)

              Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate the arguments object. Often, assignment to function parameters is unintended and indicative of a mistake or programmer error.

              This rule can be also configured to fail when function parameters are modified. Side effects on parameters can cause counter-intuitive execution flow and make errors difficult to track down.

              Rule Details

              This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.

              Examples of incorrect code for this rule:

              /*eslint no-param-reassign: "error"*/
              
              function foo(bar) {
                  bar = 13;
              }
              
              function foo(bar) {
                  bar++;
              }

              Examples of correct code for this rule:

              /*eslint no-param-reassign: "error"*/
              
              function foo(bar) {
                  var baz = bar;
              }

              Options

              This rule takes one option, an object, with a boolean property "props" and an array "ignorePropertyModificationsFor". "props" is false by default. If "props" is set to true, this rule warns against the modification of parameter properties unless they're included in "ignorePropertyModificationsFor", which is an empty array by default.

              props

              Examples of correct code for the default { "props": false } option:

              /*eslint no-param-reassign: ["error", { "props": false }]*/
              
              function foo(bar) {
                  bar.prop = "value";
              }
              
              function foo(bar) {
                  delete bar.aaa;
              }
              
              function foo(bar) {
                  bar.aaa++;
              }

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

              /*eslint no-param-reassign: ["error", { "props": true }]*/
              
              function foo(bar) {
                  bar.prop = "value";
              }
              
              function foo(bar) {
                  delete bar.aaa;
              }
              
              function foo(bar) {
                  bar.aaa++;
              }

              Examples of correct code for the { "props": true } option with "ignorePropertyModificationsFor" set:

              /*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsFor": ["bar"] }]*/
              
              function foo(bar) {
                  bar.prop = "value";
              }
              
              function foo(bar) {
                  delete bar.aaa;
              }
              
              function foo(bar) {
                  bar.aaa++;
              }

              When Not To Use It

              If you want to allow assignment to function parameters, then you can safely disable this rule.

              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

              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

                    .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

              Severity
              Category
              Status
              Source
              Language