CircuitVerse/CircuitVerse

View on GitHub
simulator/src/modules/Demultiplexer.js

Summary

Maintainability
F
4 days
Test Coverage

File Demultiplexer.js has 261 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import CircuitElement from "../circuitElement";
import Node, { findNode } from "../node";
import simulationArea from "../simulationArea";
import { correctWidth, lineTo, moveTo, fillText } from "../canvasApi";
/**
Severity: Minor
Found in simulator/src/modules/Demultiplexer.js - About 2 hrs to fix

    Function constructor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        constructor(
            x,
            y,
            scope = globalScope,
            dir = "LEFT",
    Severity: Minor
    Found in simulator/src/modules/Demultiplexer.js - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function customDraw has 105 lines of code (exceeds 100 allowed). Consider refactoring.
    Open

        customDraw() {
            var ctx = simulationArea.context;
    
            const xx = this.x;
            const yy = this.y;
    Severity: Major
    Found in simulator/src/modules/Demultiplexer.js - About 1 hr to fix

      Function moduleVerilog has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          static moduleVerilog() {
              var output = "";
      
              for (var size of Demultiplexer.selSizes) {
                  var numOutput = 1 << size;
      Severity: Minor
      Found in simulator/src/modules/Demultiplexer.js - About 55 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function customDraw has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          customDraw() {
              var ctx = simulationArea.context;
      
              const xx = this.x;
              const yy = this.y;
      Severity: Minor
      Found in simulator/src/modules/Demultiplexer.js - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Expected { after 'if' condition.
      Open

                  else if (this.direction === "RIGHT")

      Require Following Curly Brace Conventions (curly)

      JavaScript allows the omission of curly braces when a block contains only one statement. However, it is considered by many to be best practice to never omit curly braces around blocks, even when they are optional, because it can lead to bugs and reduces code clarity. So the following:

      if (foo) foo++;

      Can be rewritten as:

      if (foo) {
          foo++;
      }

      There are, however, some who prefer to only use braces when there is more than one statement to be executed.

      Rule Details

      This rule is aimed at preventing bugs and increasing code clarity by ensuring that block statements are wrapped in curly braces. It will warn when it encounters blocks that omit curly braces.

      Options

      all

      Examples of incorrect code for the default "all" option:

      /*eslint curly: "error"*/
      
      if (foo) foo++;
      
      while (bar)
          baz();
      
      if (foo) {
          baz();
      } else qux();

      Examples of correct code for the default "all" option:

      /*eslint curly: "error"*/
      
      if (foo) {
          foo++;
      }
      
      while (bar) {
          baz();
      }
      
      if (foo) {
          baz();
      } else {
          qux();
      }

      multi

      By default, this rule warns whenever if, else, for, while, or do are used without block statements as their body. However, you can specify that block statements should be used only when there are multiple statements in the block and warn when there is only one statement in the block.

      Examples of incorrect code for the "multi" option:

      /*eslint curly: ["error", "multi"]*/
      
      if (foo) {
          foo++;
      }
      
      if (foo) bar();
      else {
          foo++;
      }
      
      while (true) {
          doSomething();
      }
      
      for (var i=0; i < items.length; i++) {
          doSomething();
      }

      Examples of correct code for the "multi" option:

      /*eslint curly: ["error", "multi"]*/
      
      if (foo) foo++;
      
      else foo();
      
      while (true) {
          doSomething();
          doSomethingElse();
      }

      multi-line

      Alternatively, you can relax the rule to allow brace-less single-line if, else if, else, for, while, or do, while still enforcing the use of curly braces for other instances.

      Examples of incorrect code for the "multi-line" option:

      /*eslint curly: ["error", "multi-line"]*/
      
      if (foo)
        doSomething();
      else
        doSomethingElse();
      
      if (foo) foo(
        bar,
        baz);

      Examples of correct code for the "multi-line" option:

      /*eslint curly: ["error", "multi-line"]*/
      
      if (foo) foo++; else doSomething();
      
      if (foo) foo++;
      else if (bar) baz()
      else doSomething();
      
      do something();
      while (foo);
      
      while (foo
        && bar) baz();
      
      if (foo) {
          foo++;
      }
      
      if (foo) { foo++; }
      
      while (true) {
          doSomething();
          doSomethingElse();
      }

      multi-or-nest

      You can use another configuration that forces brace-less if, else if, else, for, while, or do if their body contains only one single-line statement. And forces braces in all other cases.

      Examples of incorrect code for the "multi-or-nest" option:

      /*eslint curly: ["error", "multi-or-nest"]*/
      
      if (!foo)
          foo = {
              bar: baz,
              qux: foo
          };
      
      while (true)
        if(foo)
            doSomething();
        else
            doSomethingElse();
      
      if (foo) {
          foo++;
      }
      
      while (true) {
          doSomething();
      }
      
      for (var i = 0; foo; i++) {
          doSomething();
      }

      Examples of correct code for the "multi-or-nest" option:

      /*eslint curly: ["error", "multi-or-nest"]*/
      
      if (!foo) {
          foo = {
              bar: baz,
              qux: foo
          };
      }
      
      while (true) {
        if(foo)
            doSomething();
        else
            doSomethingElse();
      }
      
      if (foo)
          foo++;
      
      while (true)
          doSomething();
      
      for (var i = 0; foo; i++)
          doSomething();

      For single-line statements preceded by a comment, braces are allowed but not required.

      Examples of additional correct code for the "multi-or-nest" option:

      /*eslint curly: ["error", "multi-or-nest"]*/
      
      if (foo)
          // some comment
          bar();
      
      if (foo) {
          // some comment
          bar();
      }

      consistent

      When using any of the multi* options, you can add an option to enforce all bodies of a if, else if and else chain to be with or without braces.

      Examples of incorrect code for the "multi", "consistent" options:

      /*eslint curly: ["error", "multi", "consistent"]*/
      
      if (foo) {
          bar();
          baz();
      } else
          buz();
      
      if (foo)
          bar();
      else if (faa)
          bor();
      else {
          other();
          things();
      }
      
      if (true)
          foo();
      else {
          baz();
      }
      
      if (foo) {
          foo++;
      }

      Examples of correct code for the "multi", "consistent" options:

      /*eslint curly: ["error", "multi", "consistent"]*/
      
      if (foo) {
          bar();
          baz();
      } else {
          buz();
      }
      
      if (foo) {
          bar();
      } else if (faa) {
          bor();
      } else {
          other();
          things();
      }
      
      if (true)
          foo();
      else
          baz();
      
      if (foo)
          foo++;

      When Not To Use It

      If you have no strict conventions about when to use block statements and when not to, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Operator '+' must be spaced.
      Open

                  output += "  input [" + (size-1) +":0] sel;\n";

      require spacing around infix operators (space-infix-ops)

      While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

      var sum = 1 + 2;

      The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

      var sum = i+++2;

      While this is valid JavaScript syntax, it is hard to determine what the author intended.

      Rule Details

      This rule is aimed at ensuring there are spaces around infix operators.

      Options

      This rule accepts a single options argument with the following defaults:

      "space-infix-ops": ["error", { "int32Hint": false }]

      int32Hint

      Set the int32Hint option to true (default is false) to allow write a|0 without space.

      var foo = bar|0; // `foo` is forced to be signed 32 bit integer

      Examples of incorrect code for this rule:

      /*eslint space-infix-ops: "error"*/
      /*eslint-env es6*/
      
      a+b
      
      a+ b
      
      a +b
      
      a?b:c
      
      const a={b:1};
      
      var {a=0}=bar;
      
      function foo(a=0) { }

      Examples of correct code for this rule:

      /*eslint space-infix-ops: "error"*/
      /*eslint-env es6*/
      
      a + b
      
      a       + b
      
      a ? b : c
      
      const a = {b:1};
      
      var {a = 0} = bar;
      
      function foo(a = 0) { }

      When Not To Use It

      You can turn this rule off if you are not concerned with the consistency of spacing around infix operators. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                      output += "    out" + j + " = 0;\n";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      There should be no line break before or after '='.
      Open

              this.controlSignalSize =

      enforce consistent linebreak style for operators (operator-linebreak)

      When a statement is too long to fit on a single line, line breaks are generally inserted next to the operators separating expressions. The first style coming to mind would be to place the operator at the end of the line, following the English punctuation rules.

      var fullHeight = borderTop +
                       innerHeight +
                       borderBottom;

      Some developers find that placing operators at the beginning of the line makes the code more readable.

      var fullHeight = borderTop
                     + innerHeight
                     + borderBottom;

      Rule Details

      This rule enforces a consistent linebreak style for operators.

      Options

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

      String option:

      • "after" requires linebreaks to be placed after the operator
      • "before" requires linebreaks to be placed before the operator
      • "none" disallows linebreaks on either side of the operator

      Object option:

      • "overrides" overrides the global setting for specified operators

      The default configuration is "after", { "overrides": { "?": "before", ":": "before" } }

      after

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

      /*eslint operator-linebreak: ["error", "after"]*/
      
      foo = 1
      +
      2;
      
      foo = 1
          + 2;
      
      foo
          = 5;
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;

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

      /*eslint operator-linebreak: ["error", "after"]*/
      
      foo = 1 + 2;
      
      foo = 1 +
            2;
      
      foo =
          5;
      
      if (someCondition ||
          otherCondition) {
      }
      
      answer = everything ?
        42 :
        foo;

      before

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

      /*eslint operator-linebreak: ["error", "before"]*/
      
      foo = 1 +
            2;
      
      foo =
          5;
      
      if (someCondition ||
          otherCondition) {
      }
      
      answer = everything ?
        42 :
        foo;

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

      /*eslint operator-linebreak: ["error", "before"]*/
      
      foo = 1 + 2;
      
      foo = 1
          + 2;
      
      foo
          = 5;
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;

      none

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

      /*eslint operator-linebreak: ["error", "none"]*/
      
      foo = 1 +
            2;
      
      foo = 1
          + 2;
      
      if (someCondition ||
          otherCondition) {
      }
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;
      
      answer = everything ?
        42 :
        foo;

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

      /*eslint operator-linebreak: ["error", "none"]*/
      
      foo = 1 + 2;
      
      foo = 5;
      
      if (someCondition || otherCondition) {
      }
      
      answer = everything ? 42 : foo;

      overrides

      Examples of additional incorrect code for this rule with the { "overrides": { "+=": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "+=": "before" } }]*/
      
      var thing = 'thing';
      thing +=
        's';

      Examples of additional correct code for this rule with the { "overrides": { "+=": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "+=": "before" } }]*/
      
      var thing = 'thing';
      thing
        += 's';

      Examples of additional correct code for this rule with the { "overrides": { "?": "ignore", ":": "ignore" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "?": "ignore", ":": "ignore" } }]*/
      
      answer = everything ?
        42
        : foo;
      
      answer = everything
        ?
        42
        :
        foo;

      Examples of incorrect code for this rule with the default "after", { "overrides": { "?": "before", ":": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "?": "before", ":": "before" } }]*/
      
      foo = 1
      +
      2;
      
      foo = 1
          + 2;
      
      foo
          = 5;
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything ?
        42 :
        foo;

      Examples of correct code for this rule with the default "after", { "overrides": { "?": "before", ":": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "?": "before", ":": "before" } }]*/
      
      foo = 1 + 2;
      
      foo = 1 +
            2;
      
      foo =
          5;
      
      if (someCondition ||
          otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;

      When Not To Use It

      If your project will not be using a common operator line break style, turn this rule off.

      Related Rules

      Strings must use singlequote.
      Open

                      max: "10",

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      ["fill"] is better written in dot notation.
      Open

              ctx.fillStyle = colors["fill"];

      Require Dot Notation (dot-notation)

      In JavaScript, one can access properties using the dot notation (foo.bar) or square-bracket notation (foo["bar"]). However, the dot notation is often preferred because it is easier to read, less verbose, and works better with aggressive JavaScript minimizers.

      foo["bar"];

      Rule Details

      This rule is aimed at maintaining code consistency and improving code readability by encouraging use of the dot notation style whenever possible. As such, it will warn when it encounters an unnecessary use of square-bracket notation.

      Examples of incorrect code for this rule:

      /*eslint dot-notation: "error"*/
      
      var x = foo["bar"];

      Examples of correct code for this rule:

      /*eslint dot-notation: "error"*/
      
      var x = foo.bar;
      
      var x = foo[bar];    // Property name is a variable, square-bracket notation required

      Options

      This rule accepts a single options argument:

      • Set the allowKeywords option to false (default is true) to follow ECMAScript version 3 compatible style, avoiding dot notation for reserved word properties.
      • Set the allowPattern option to a regular expression string to allow bracket notation for property names that match a pattern (by default, no pattern is tested).

      allowKeywords

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

      /*eslint dot-notation: ["error", { "allowKeywords": false }]*/
      
      var foo = { "class": "CS 101" }
      var x = foo["class"]; // Property name is a reserved word, square-bracket notation required

      allowPattern

      For example, when preparing data to be sent to an external API, it is often required to use property names that include underscores. If the camelcase rule is in effect, these snake case properties would not be allowed. By providing an allowPattern to the dot-notation rule, these snake case properties can be accessed with bracket notation.

      Examples of correct code for the sample { "allowPattern": "^[a-z]+(_[a-z]+)+$" } option:

      /*eslint camelcase: "error"*/
      /*eslint dot-notation: ["error", { "allowPattern": "^[a-z]+(_[a-z]+)+$" }]*/
      
      var data = {};
      data.foo_bar = 42;
      
      var data = {};
      data["fooBar"] = 42;
      
      var data = {};
      data["foo_bar"] = 42; // no warning

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

      Strings must use singlequote.
      Open

                  if (this.direction === "LEFT")

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Expected no linebreak before this statement.
      Open

                      fillText(

      enforce the location of single-line statements (nonblock-statement-body-position)

      When writing if, else, while, do-while, and for statements, the body can be a single statement instead of a block. It can be useful to enforce a consistent location for these single statements.

      For example, some developers avoid writing code like this:

      if (foo)
        bar();

      If another developer attempts to add baz(); to the if statement, they might mistakenly change the code to

      if (foo)
        bar();
        baz(); // this line is not in the `if` statement!

      To avoid this issue, one might require all single-line if statements to appear directly after the conditional, without a linebreak:

      if (foo) bar();

      Rule Details

      This rule aims to enforce a consistent location for single-line statements.

      Note that this rule does not enforce the usage of single-line statements in general. If you would like to disallow single-line statements, use the curly rule instead.

      Options

      This rule accepts a string option:

      • "beside" (default) disallows a newline before a single-line statement.
      • "below" requires a newline before a single-line statement.
      • "any" does not enforce the position of a single-line statement.

      Additionally, the rule accepts an optional object option with an "overrides" key. This can be used to specify a location for particular statements that override the default. For example:

      • "beside", { "overrides": { "while": "below" } } requires all single-line statements to appear on the same line as their parent, unless the parent is a while statement, in which case the single-line statement must not be on the same line.
      • "below", { "overrides": { "do": "any" } } disallows all single-line statements from appearing on the same line as their parent, unless the parent is a do-while statement, in which case the position of the single-line statement is not enforced.

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

      /* eslint nonblock-statement-body-position: ["error", "beside"] */
      
      if (foo)
        bar();
      else
        baz();
      
      while (foo)
        bar();
      
      for (let i = 1; i < foo; i++)
        bar();
      
      do
        bar();
      while (foo)

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

      /* eslint nonblock-statement-body-position: ["error", "beside"] */
      
      if (foo) bar();
      else baz();
      
      while (foo) bar();
      
      for (let i = 1; i < foo; i++) bar();
      
      do bar(); while (foo)
      
      if (foo) { // block statements are always allowed with this rule
        bar();
      } else {
        baz();
      }

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

      /* eslint nonblock-statement-body-position: ["error", "below"] */
      
      if (foo) bar();
      else baz();
      
      while (foo) bar();
      
      for (let i = 1; i < foo; i++) bar();
      
      do bar(); while (foo)

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

      /* eslint nonblock-statement-body-position: ["error", "below"] */
      
      if (foo)
        bar();
      else
        baz();
      
      while (foo)
        bar();
      
      for (let i = 1; i < foo; i++)
        bar();
      
      do
        bar();
      while (foo)
      
      if (foo) {
        // Although the second `if` statement is on the same line as the `else`, this is a very common
        // pattern, so it's not checked by this rule.
      } else if (bar) {
      }

      Examples of incorrect code for this rule with the "beside", { "overrides": { "while": "below" } } rule:

      /* eslint nonblock-statement-body-position: ["error", "beside", { "overrides": { "while": "below" } }] */
      
      if (foo)
        bar();
      
      while (foo) bar();

      Examples of correct code for this rule with the "beside", { "overrides": { "while": "below" } } rule:

      /* eslint nonblock-statement-body-position: ["error", "beside", { "overrides": { "while": "below" } }] */
      
      if (foo) bar();
      
      while (foo)
        bar();

      When Not To Use It

      If you're not concerned about consistent locations of single-line statements, you should not turn on this rule. You can also disable this rule if you're using the "all" option for the curly rule, because this will disallow single-line statements entirely.

      Further Reading

      Expected { after 'else'.
      Open

                  else

      Require Following Curly Brace Conventions (curly)

      JavaScript allows the omission of curly braces when a block contains only one statement. However, it is considered by many to be best practice to never omit curly braces around blocks, even when they are optional, because it can lead to bugs and reduces code clarity. So the following:

      if (foo) foo++;

      Can be rewritten as:

      if (foo) {
          foo++;
      }

      There are, however, some who prefer to only use braces when there is more than one statement to be executed.

      Rule Details

      This rule is aimed at preventing bugs and increasing code clarity by ensuring that block statements are wrapped in curly braces. It will warn when it encounters blocks that omit curly braces.

      Options

      all

      Examples of incorrect code for the default "all" option:

      /*eslint curly: "error"*/
      
      if (foo) foo++;
      
      while (bar)
          baz();
      
      if (foo) {
          baz();
      } else qux();

      Examples of correct code for the default "all" option:

      /*eslint curly: "error"*/
      
      if (foo) {
          foo++;
      }
      
      while (bar) {
          baz();
      }
      
      if (foo) {
          baz();
      } else {
          qux();
      }

      multi

      By default, this rule warns whenever if, else, for, while, or do are used without block statements as their body. However, you can specify that block statements should be used only when there are multiple statements in the block and warn when there is only one statement in the block.

      Examples of incorrect code for the "multi" option:

      /*eslint curly: ["error", "multi"]*/
      
      if (foo) {
          foo++;
      }
      
      if (foo) bar();
      else {
          foo++;
      }
      
      while (true) {
          doSomething();
      }
      
      for (var i=0; i < items.length; i++) {
          doSomething();
      }

      Examples of correct code for the "multi" option:

      /*eslint curly: ["error", "multi"]*/
      
      if (foo) foo++;
      
      else foo();
      
      while (true) {
          doSomething();
          doSomethingElse();
      }

      multi-line

      Alternatively, you can relax the rule to allow brace-less single-line if, else if, else, for, while, or do, while still enforcing the use of curly braces for other instances.

      Examples of incorrect code for the "multi-line" option:

      /*eslint curly: ["error", "multi-line"]*/
      
      if (foo)
        doSomething();
      else
        doSomethingElse();
      
      if (foo) foo(
        bar,
        baz);

      Examples of correct code for the "multi-line" option:

      /*eslint curly: ["error", "multi-line"]*/
      
      if (foo) foo++; else doSomething();
      
      if (foo) foo++;
      else if (bar) baz()
      else doSomething();
      
      do something();
      while (foo);
      
      while (foo
        && bar) baz();
      
      if (foo) {
          foo++;
      }
      
      if (foo) { foo++; }
      
      while (true) {
          doSomething();
          doSomethingElse();
      }

      multi-or-nest

      You can use another configuration that forces brace-less if, else if, else, for, while, or do if their body contains only one single-line statement. And forces braces in all other cases.

      Examples of incorrect code for the "multi-or-nest" option:

      /*eslint curly: ["error", "multi-or-nest"]*/
      
      if (!foo)
          foo = {
              bar: baz,
              qux: foo
          };
      
      while (true)
        if(foo)
            doSomething();
        else
            doSomethingElse();
      
      if (foo) {
          foo++;
      }
      
      while (true) {
          doSomething();
      }
      
      for (var i = 0; foo; i++) {
          doSomething();
      }

      Examples of correct code for the "multi-or-nest" option:

      /*eslint curly: ["error", "multi-or-nest"]*/
      
      if (!foo) {
          foo = {
              bar: baz,
              qux: foo
          };
      }
      
      while (true) {
        if(foo)
            doSomething();
        else
            doSomethingElse();
      }
      
      if (foo)
          foo++;
      
      while (true)
          doSomething();
      
      for (var i = 0; foo; i++)
          doSomething();

      For single-line statements preceded by a comment, braces are allowed but not required.

      Examples of additional correct code for the "multi-or-nest" option:

      /*eslint curly: ["error", "multi-or-nest"]*/
      
      if (foo)
          // some comment
          bar();
      
      if (foo) {
          // some comment
          bar();
      }

      consistent

      When using any of the multi* options, you can add an option to enforce all bodies of a if, else if and else chain to be with or without braces.

      Examples of incorrect code for the "multi", "consistent" options:

      /*eslint curly: ["error", "multi", "consistent"]*/
      
      if (foo) {
          bar();
          baz();
      } else
          buz();
      
      if (foo)
          bar();
      else if (faa)
          bor();
      else {
          other();
          things();
      }
      
      if (true)
          foo();
      else {
          baz();
      }
      
      if (foo) {
          foo++;
      }

      Examples of correct code for the "multi", "consistent" options:

      /*eslint curly: ["error", "multi", "consistent"]*/
      
      if (foo) {
          bar();
          baz();
      } else {
          buz();
      }
      
      if (foo) {
          bar();
      } else if (faa) {
          bor();
      } else {
          other();
          things();
      }
      
      if (true)
          foo();
      else
          baz();
      
      if (foo)
          foo++;

      When Not To Use It

      If you have no strict conventions about when to use block statements and when not to, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Unexpected string concatenation.
      Open

                      output += "out" + j + ", ";

      Suggest using template literals instead of string concatenation. (prefer-template)

      In ES2015 (ES6), we can use template literals instead of string concatenation.

      var str = "Hello, " + name + "!";
      /*eslint-env es6*/
      
      var str = `Hello, ${name}!`;

      Rule Details

      This rule is aimed to flag usage of + operators with strings.

      Examples

      Examples of incorrect code for this rule:

      /*eslint prefer-template: "error"*/
      
      var str = "Hello, " + name + "!";
      var str = "Time: " + (12 * 60 * 60 * 1000);

      Examples of correct code for this rule:

      /*eslint prefer-template: "error"*/
      /*eslint-env es6*/
      
      var str = "Hello World!";
      var str = `Hello, ${name}!`;
      var str = `Time: ${12 * 60 * 60 * 1000}`;
      
      // This is reported by `no-useless-concat`.
      var str = "Hello, " + "World!";

      When Not To Use It

      This rule should not be used in ES3/5 environments.

      In ES2015 (ES6) or later, if you don't want to be notified about string concatenation, you can safely disable this rule.

      Related Rules

      Expected no linebreak before this statement.
      Open

                      fillText(

      enforce the location of single-line statements (nonblock-statement-body-position)

      When writing if, else, while, do-while, and for statements, the body can be a single statement instead of a block. It can be useful to enforce a consistent location for these single statements.

      For example, some developers avoid writing code like this:

      if (foo)
        bar();

      If another developer attempts to add baz(); to the if statement, they might mistakenly change the code to

      if (foo)
        bar();
        baz(); // this line is not in the `if` statement!

      To avoid this issue, one might require all single-line if statements to appear directly after the conditional, without a linebreak:

      if (foo) bar();

      Rule Details

      This rule aims to enforce a consistent location for single-line statements.

      Note that this rule does not enforce the usage of single-line statements in general. If you would like to disallow single-line statements, use the curly rule instead.

      Options

      This rule accepts a string option:

      • "beside" (default) disallows a newline before a single-line statement.
      • "below" requires a newline before a single-line statement.
      • "any" does not enforce the position of a single-line statement.

      Additionally, the rule accepts an optional object option with an "overrides" key. This can be used to specify a location for particular statements that override the default. For example:

      • "beside", { "overrides": { "while": "below" } } requires all single-line statements to appear on the same line as their parent, unless the parent is a while statement, in which case the single-line statement must not be on the same line.
      • "below", { "overrides": { "do": "any" } } disallows all single-line statements from appearing on the same line as their parent, unless the parent is a do-while statement, in which case the position of the single-line statement is not enforced.

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

      /* eslint nonblock-statement-body-position: ["error", "beside"] */
      
      if (foo)
        bar();
      else
        baz();
      
      while (foo)
        bar();
      
      for (let i = 1; i < foo; i++)
        bar();
      
      do
        bar();
      while (foo)

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

      /* eslint nonblock-statement-body-position: ["error", "beside"] */
      
      if (foo) bar();
      else baz();
      
      while (foo) bar();
      
      for (let i = 1; i < foo; i++) bar();
      
      do bar(); while (foo)
      
      if (foo) { // block statements are always allowed with this rule
        bar();
      } else {
        baz();
      }

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

      /* eslint nonblock-statement-body-position: ["error", "below"] */
      
      if (foo) bar();
      else baz();
      
      while (foo) bar();
      
      for (let i = 1; i < foo; i++) bar();
      
      do bar(); while (foo)

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

      /* eslint nonblock-statement-body-position: ["error", "below"] */
      
      if (foo)
        bar();
      else
        baz();
      
      while (foo)
        bar();
      
      for (let i = 1; i < foo; i++)
        bar();
      
      do
        bar();
      while (foo)
      
      if (foo) {
        // Although the second `if` statement is on the same line as the `else`, this is a very common
        // pattern, so it's not checked by this rule.
      } else if (bar) {
      }

      Examples of incorrect code for this rule with the "beside", { "overrides": { "while": "below" } } rule:

      /* eslint nonblock-statement-body-position: ["error", "beside", { "overrides": { "while": "below" } }] */
      
      if (foo)
        bar();
      
      while (foo) bar();

      Examples of correct code for this rule with the "beside", { "overrides": { "while": "below" } } rule:

      /* eslint nonblock-statement-body-position: ["error", "beside", { "overrides": { "while": "below" } }] */
      
      if (foo) bar();
      
      while (foo)
        bar();

      When Not To Use It

      If you're not concerned about consistent locations of single-line statements, you should not turn on this rule. You can also disable this rule if you're using the "all" option for the curly rule, because this will disallow single-line statements entirely.

      Further Reading

      Operator '-' must be spaced.
      Open

                  output += "  input [" + (size-1) +":0] sel;\n";

      require spacing around infix operators (space-infix-ops)

      While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

      var sum = 1 + 2;

      The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

      var sum = i+++2;

      While this is valid JavaScript syntax, it is hard to determine what the author intended.

      Rule Details

      This rule is aimed at ensuring there are spaces around infix operators.

      Options

      This rule accepts a single options argument with the following defaults:

      "space-infix-ops": ["error", { "int32Hint": false }]

      int32Hint

      Set the int32Hint option to true (default is false) to allow write a|0 without space.

      var foo = bar|0; // `foo` is forced to be signed 32 bit integer

      Examples of incorrect code for this rule:

      /*eslint space-infix-ops: "error"*/
      /*eslint-env es6*/
      
      a+b
      
      a+ b
      
      a +b
      
      a?b:c
      
      const a={b:1};
      
      var {a=0}=bar;
      
      function foo(a=0) { }

      Examples of correct code for this rule:

      /*eslint space-infix-ops: "error"*/
      /*eslint-env es6*/
      
      a + b
      
      a       + b
      
      a ? b : c
      
      const a = {b:1};
      
      var {a = 0} = bar;
      
      function foo(a = 0) { }

      When Not To Use It

      You can turn this rule off if you are not concerned with the consistency of spacing around infix operators. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

      import { correctWidth, lineTo, moveTo, fillText } from "../canvasApi";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      '||' should be placed at the beginning of the line.
      Open

                  (this.hover && !simulationArea.shiftDown) ||

      enforce consistent linebreak style for operators (operator-linebreak)

      When a statement is too long to fit on a single line, line breaks are generally inserted next to the operators separating expressions. The first style coming to mind would be to place the operator at the end of the line, following the English punctuation rules.

      var fullHeight = borderTop +
                       innerHeight +
                       borderBottom;

      Some developers find that placing operators at the beginning of the line makes the code more readable.

      var fullHeight = borderTop
                     + innerHeight
                     + borderBottom;

      Rule Details

      This rule enforces a consistent linebreak style for operators.

      Options

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

      String option:

      • "after" requires linebreaks to be placed after the operator
      • "before" requires linebreaks to be placed before the operator
      • "none" disallows linebreaks on either side of the operator

      Object option:

      • "overrides" overrides the global setting for specified operators

      The default configuration is "after", { "overrides": { "?": "before", ":": "before" } }

      after

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

      /*eslint operator-linebreak: ["error", "after"]*/
      
      foo = 1
      +
      2;
      
      foo = 1
          + 2;
      
      foo
          = 5;
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;

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

      /*eslint operator-linebreak: ["error", "after"]*/
      
      foo = 1 + 2;
      
      foo = 1 +
            2;
      
      foo =
          5;
      
      if (someCondition ||
          otherCondition) {
      }
      
      answer = everything ?
        42 :
        foo;

      before

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

      /*eslint operator-linebreak: ["error", "before"]*/
      
      foo = 1 +
            2;
      
      foo =
          5;
      
      if (someCondition ||
          otherCondition) {
      }
      
      answer = everything ?
        42 :
        foo;

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

      /*eslint operator-linebreak: ["error", "before"]*/
      
      foo = 1 + 2;
      
      foo = 1
          + 2;
      
      foo
          = 5;
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;

      none

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

      /*eslint operator-linebreak: ["error", "none"]*/
      
      foo = 1 +
            2;
      
      foo = 1
          + 2;
      
      if (someCondition ||
          otherCondition) {
      }
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;
      
      answer = everything ?
        42 :
        foo;

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

      /*eslint operator-linebreak: ["error", "none"]*/
      
      foo = 1 + 2;
      
      foo = 5;
      
      if (someCondition || otherCondition) {
      }
      
      answer = everything ? 42 : foo;

      overrides

      Examples of additional incorrect code for this rule with the { "overrides": { "+=": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "+=": "before" } }]*/
      
      var thing = 'thing';
      thing +=
        's';

      Examples of additional correct code for this rule with the { "overrides": { "+=": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "+=": "before" } }]*/
      
      var thing = 'thing';
      thing
        += 's';

      Examples of additional correct code for this rule with the { "overrides": { "?": "ignore", ":": "ignore" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "?": "ignore", ":": "ignore" } }]*/
      
      answer = everything ?
        42
        : foo;
      
      answer = everything
        ?
        42
        :
        foo;

      Examples of incorrect code for this rule with the default "after", { "overrides": { "?": "before", ":": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "?": "before", ":": "before" } }]*/
      
      foo = 1
      +
      2;
      
      foo = 1
          + 2;
      
      foo
          = 5;
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything ?
        42 :
        foo;

      Examples of correct code for this rule with the default "after", { "overrides": { "?": "before", ":": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "?": "before", ":": "before" } }]*/
      
      foo = 1 + 2;
      
      foo = 1 +
            2;
      
      foo =
          5;
      
      if (someCondition ||
          otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;

      When Not To Use It

      If your project will not be using a common operator line break style, turn this rule off.

      Related Rules

      Strings must use singlequote.
      Open

                  ctx.fillStyle = colors["hover_select"];

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Expected exception block, space or tab after '//' in comment.
      Open

          //generate the needed modules

      Requires or disallows a whitespace (space or tab) beginning a comment (spaced-comment)

      Some style guides require or disallow a whitespace immediately after the initial // or /* of a comment. Whitespace after the // or /* makes it easier to read text in comments. On the other hand, commenting out code is easier without having to put a whitespace right after the // or /*.

      Rule Details

      This rule will enforce consistency of spacing after the start of a comment // or /*. It also provides several exceptions for various documentation styles.

      Options

      The rule takes two options.

      • The first is a string which be either "always" or "never". The default is "always".

        • If "always" then the // or /* must be followed by at least one whitespace.
        • If "never" then there should be no whitespace following.
      • This rule can also take a 2nd option, an object with any of the following keys: "exceptions" and "markers".

        • The "exceptions" value is an array of string patterns which are considered exceptions to the rule. The rule will not warn when the pattern starts from the beginning of the comment and repeats until the end of the line or */ if the comment is a single line comment. Please note that exceptions are ignored if the first argument is "never".
        "spaced-comment": ["error", "always", { "exceptions": ["-", "+"] }]
        • The "markers" value is an array of string patterns which are considered markers for docblock-style comments, such as an additional /, used to denote documentation read by doxygen, vsdoc, etc. which must have additional characters. The "markers" array will apply regardless of the value of the first argument, e.g. "always" or "never".
        "spaced-comment": ["error", "always", { "markers": ["/"] }]

      The difference between a marker and an exception is that a marker only appears at the beginning of the comment whereas exceptions can occur anywhere in the comment string.

      You can also define separate exceptions and markers for block and line comments. The "block" object can have an additional key "balanced", a boolean that specifies if inline block comments should have balanced spacing. The default value is false.

      • If "balanced": true and "always" then the /* must be followed by at least one whitespace, and the */ must be preceded by at least one whitespace.

      • If "balanced": true and "never" then there should be no whitespace following /* or preceding */.

      • If "balanced": false then balanced whitespace is not enforced.

      "spaced-comment": ["error", "always", {
          "line": {
              "markers": ["/"],
              "exceptions": ["-", "+"]
          },
          "block": {
              "markers": ["!"],
              "exceptions": ["*"],
              "balanced": true
          }
      }]

      always

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

      /*eslint spaced-comment: ["error", "always"]*/
      
      //This is a comment with no whitespace at the beginning
      
      /*This is a comment with no whitespace at the beginning */
      /* eslint spaced-comment: ["error", "always", { "block": { "balanced": true } }] */
      /* This is a comment with whitespace at the beginning but not the end*/

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

      /* eslint spaced-comment: ["error", "always"] */
      
      // This is a comment with a whitespace at the beginning
      
      /* This is a comment with a whitespace at the beginning */
      
      /*
       * This is a comment with a whitespace at the beginning
       */
      
      /*
      This comment has a newline
      */
      /* eslint spaced-comment: ["error", "always"] */
      
      /**
      * I am jsdoc
      */

      never

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

      /*eslint spaced-comment: ["error", "never"]*/
      
      // This is a comment with a whitespace at the beginning
      
      /* This is a comment with a whitespace at the beginning */
      
      /* \nThis is a comment with a whitespace at the beginning */
      /*eslint spaced-comment: ["error", "never", { "block": { "balanced": true } }]*/
      /*This is a comment with whitespace at the end */

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

      /*eslint spaced-comment: ["error", "never"]*/
      
      /*This is a comment with no whitespace at the beginning */
      /*eslint spaced-comment: ["error", "never"]*/
      
      /**
      * I am jsdoc
      */

      exceptions

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

      /* eslint spaced-comment: ["error", "always", { "block": { "exceptions": ["-"] } }] */
      
      //--------------
      // Comment block
      //--------------
      /* eslint spaced-comment: ["error", "always", { "exceptions": ["-", "+"] }] */
      
      //------++++++++
      // Comment block
      //------++++++++
      /* eslint spaced-comment: ["error", "always", { "exceptions": ["-", "+"] }] */
      
      /*------++++++++*/
      /* Comment block */
      /*------++++++++*/
      /* eslint spaced-comment: ["error", "always", { "line": { "exceptions": ["-+"] } }] */
      
      /*-+-+-+-+-+-+-+*/
      // Comment block
      /*-+-+-+-+-+-+-+*/
      /* eslint spaced-comment: ["error", "always", { "block": { "exceptions": ["*"] } }] */
      
      /******** COMMENT *******/

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

      /* eslint spaced-comment: ["error", "always", { "exceptions": ["-"] }] */
      
      //--------------
      // Comment block
      //--------------
      /* eslint spaced-comment: ["error", "always", { "line": { "exceptions": ["-"] } }] */
      
      //--------------
      // Comment block
      //--------------
      /* eslint spaced-comment: ["error", "always", { "exceptions": ["*"] }] */
      
      /****************
       * Comment block
       ****************/
      /* eslint spaced-comment: ["error", "always", { "exceptions": ["-+"] }] */
      
      //-+-+-+-+-+-+-+
      // Comment block
      //-+-+-+-+-+-+-+
      
      /*-+-+-+-+-+-+-+*/
      // Comment block
      /*-+-+-+-+-+-+-+*/
      /* eslint spaced-comment: ["error", "always", { "block": { "exceptions": ["-+"] } }] */
      
      /*-+-+-+-+-+-+-+*/
      // Comment block
      /*-+-+-+-+-+-+-+*/
      /* eslint spaced-comment: ["error", "always", { "block": { "exceptions": ["*"] } }] */
      
      /***************/
      
      /********
      COMMENT
      *******/

      markers

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

      /* eslint spaced-comment: ["error", "always", { "markers": ["/"] }] */
      
      ///This is a comment with a marker but without whitespace
      /*eslint spaced-comment: ["error", "always", { "block": { "markers": ["!"], "balanced": true } }]*/
      /*! This is a comment with a marker but without whitespace at the end*/
      /*eslint spaced-comment: ["error", "never", { "block": { "markers": ["!"], "balanced": true } }]*/
      /*!This is a comment with a marker but with whitespace at the end */

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

      /* eslint spaced-comment: ["error", "always", { "markers": ["/"] }] */
      
      /// This is a comment with a marker
      /*eslint spaced-comment: ["error", "never", { "markers": ["!<"] }]*/
      
      //!<this is a line comment with marker block subsequent lines are ignored></this>
      /* eslint spaced-comment: ["error", "always", { "markers": ["global"] }] */
      
      /*global ABC*/

      Related Rules

      Strings must use singlequote.
      Open

                  output += "  parameter WIDTH = 1;\n";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                      output += "out" + j + ", ";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                  output += "out" + (numOutput-1) + ";\n";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                  output += "  input [" + (size-1) +":0] sel;\n";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                  output += "  \n";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                      output += "      " + j + " : out" + j + " = in;\n";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Expected a line break before this closing brace.
      Open

      import { correctWidth, lineTo, moveTo, fillText } from "../canvasApi";

      enforce consistent line breaks inside braces (object-curly-newline)

      A number of style guides require or disallow line breaks inside of object braces and other tokens.

      Rule Details

      This rule enforces consistent line breaks inside braces of object literals or destructuring assignments.

      Options

      This rule has either a string option:

      • "always" requires line breaks inside braces
      • "never" disallows line breaks inside braces

      Or an object option:

      • "multiline": true requires line breaks if there are line breaks inside properties or between properties. Otherwise, it disallows line breaks.
      • "minProperties" requires line breaks if the number of properties is at least the given integer. By default, an error will also be reported if an object contains linebreaks and has fewer properties than the given integer. However, the second behavior is disabled if the consistent option is set to true
      • "consistent": true (default) requires that either both curly braces, or neither, directly enclose newlines. Note that enabling this option will also change the behavior of the minProperties option. (See minProperties above for more information)

      You can specify different options for object literals, destructuring assignments, and named imports and exports:

      {
          "object-curly-newline": ["error", {
              "ObjectExpression": "always",
              "ObjectPattern": { "multiline": true },
              "ImportDeclaration": "never",
              "ExportDeclaration": { "multiline": true, "minProperties": 3 }
          }]
      }
      • "ObjectExpression" configuration for object literals
      • "ObjectPattern" configuration for object patterns of destructuring assignments
      • "ImportDeclaration" configuration for named imports
      • "ExportDeclaration" configuration for named exports

      always

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

      /*eslint object-curly-newline: ["error", "always"]*/
      /*eslint-env es6*/
      
      let a = {};
      let b = {foo: 1};
      let c = {foo: 1, bar: 2};
      let d = {foo: 1,
          bar: 2};
      let e = {foo() {
          dosomething();
      }};
      
      let {} = obj;
      let {f} = obj;
      let {g, h} = obj;
      let {i,
          j} = obj;
      let {k = function() {
          dosomething();
      }} = obj;

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

      /*eslint object-curly-newline: ["error", "always"]*/
      /*eslint-env es6*/
      
      let a = {
      };
      let b = {
          foo: 1
      };
      let c = {
          foo: 1, bar: 2
      };
      let d = {
          foo: 1,
          bar: 2
      };
      let e = {
          foo: function() {
              dosomething();
          }
      };
      
      let {
      } = obj;
      let {
          f
      } = obj;
      let {
          g, h
      } = obj;
      let {
          i,
          j
      } = obj;
      let {
          k = function() {
              dosomething();
          }
      } = obj;

      never

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

      /*eslint object-curly-newline: ["error", "never"]*/
      /*eslint-env es6*/
      
      let a = {
      };
      let b = {
          foo: 1
      };
      let c = {
          foo: 1, bar: 2
      };
      let d = {
          foo: 1,
          bar: 2
      };
      let e = {
          foo: function() {
              dosomething();
          }
      };
      
      let {
      } = obj;
      let {
          f
      } = obj;
      let {
          g, h
      } = obj;
      let {
          i,
          j
      } = obj;
      let {
          k = function() {
              dosomething();
          }
      } = obj;

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

      /*eslint object-curly-newline: ["error", "never"]*/
      /*eslint-env es6*/
      
      let a = {};
      let b = {foo: 1};
      let c = {foo: 1, bar: 2};
      let d = {foo: 1,
          bar: 2};
      let e = {foo: function() {
          dosomething();
      }};
      
      let {} = obj;
      let {f} = obj;
      let {g, h} = obj;
      let {i,
          j} = obj;
      let {k = function() {
          dosomething();
      }} = obj;

      multiline

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

      /*eslint object-curly-newline: ["error", { "multiline": true }]*/
      /*eslint-env es6*/
      
      let a = {
      };
      let b = {
          foo: 1
      };
      let c = {
          foo: 1, bar: 2
      };
      let d = {foo: 1,
          bar: 2};
      let e = {foo: function() {
          dosomething();
      }};
      
      let {
      } = obj;
      let {
          f
      } = obj;
      let {
          g, h
      } = obj;
      let {i,
          j} = obj;
      let {k = function() {
          dosomething();
      }} = obj;

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

      /*eslint object-curly-newline: ["error", { "multiline": true }]*/
      /*eslint-env es6*/
      
      let a = {};
      let b = {foo: 1};
      let c = {foo: 1, bar: 2};
      let d = {
          foo: 1,
          bar: 2
      };
      let e = {
          foo: function() {
              dosomething();
          }
      };
      
      let {} = obj;
      let {f} = obj;
      let {g, h} = obj;
      let {
          i,
          j
      } = obj;
      let {
          k = function() {
              dosomething();
          }
      } = obj;

      minProperties

      Examples of incorrect code for this rule with the { "minProperties": 2 } option:

      /*eslint object-curly-newline: ["error", { "minProperties": 2 }]*/
      /*eslint-env es6*/
      
      let a = {
      };
      let b = {
          foo: 1
      };
      let c = {foo: 1, bar: 2};
      let d = {foo: 1,
          bar: 2};
      let e = {
          foo: function() {
              dosomething();
          }
      };
      
      let {
      } = obj;
      let {
          f
      } = obj;
      let {g, h} = obj;
      let {i,
          j} = obj;
      let {
          k = function() {
              dosomething();
          }
      } = obj;

      Examples of correct code for this rule with the { "minProperties": 2 } option:

      /*eslint object-curly-newline: ["error", { "minProperties": 2 }]*/
      /*eslint-env es6*/
      
      let a = {};
      let b = {foo: 1};
      let c = {
          foo: 1, bar: 2
      };
      let d = {
          foo: 1,
          bar: 2
      };
      let e = {foo: function() {
          dosomething();
      }};
      
      let {} = obj;
      let {f} = obj;
      let {
          g, h
      } = obj;
      let {
          i,
          j
      } = obj;
      let {k = function() {
          dosomething();
      }} = obj;

      consistent

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

      /*eslint object-curly-newline: ["error", { "consistent": true }]*/
      /*eslint-env es6*/
      
      let a = {foo: 1
      };
      let b = {
          foo: 1};
      let c = {foo: 1, bar: 2
      };
      let d = {
          foo: 1, bar: 2};
      let e = {foo: function() {
          dosomething();
          }
      };
      let f = {
          foo: function() {
          dosomething();}};
      
      let {g
      } = obj;
      let {
          h} = obj;
      let {i, j
      } = obj;
      let {k, l
      } = obj;
      let {
          m, n} = obj;
      let {
          o, p} = obj;
      let {q = function() {
          dosomething();
          }
      } = obj;
      let {
          r = function() {
              dosomething();
          }} = obj;

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

      /*eslint object-curly-newline: ["error", { "consistent": true }]*/
      /*eslint-env es6*/
      
      
      let empty1 = {};
      let empty2 = {
      };
      let a = {foo: 1};
      let b = {
          foo: 1
      };
      let c = {
          foo: 1, bar: 2
      };
      let d = {
          foo: 1,
          bar: 2
      };
      let e = {foo: function() {dosomething();}};
      let f = {
          foo: function() {
              dosomething();
          }
      };
      
      let {} = obj;
      let {
      } = obj;
      let {g} = obj;
      let {
          h
      } = obj;
      let {i, j} = obj;
      let {
          k, l
      } = obj;
      let {m,
          n} = obj;
      let {
          o,
          p
      } = obj;
      let {q = function() {dosomething();}} = obj;
      let {
          r = function() {
              dosomething();
          }
      } = obj;

      ObjectExpression and ObjectPattern

      Examples of incorrect code for this rule with the { "ObjectExpression": "always", "ObjectPattern": "never" } options:

      /*eslint object-curly-newline: ["error", { "ObjectExpression": "always", "ObjectPattern": "never" }]*/
      /*eslint-env es6*/
      
      let a = {};
      let b = {foo: 1};
      let c = {foo: 1, bar: 2};
      let d = {foo: 1,
          bar: 2};
      let e = {foo: function() {
          dosomething();
      }};
      
      let {
      } = obj;
      let {
          f
      } = obj;
      let {
          g, h
      } = obj;
      let {
          i,
          j
      } = obj;
      let {
          k = function() {
              dosomething();
          }
      } = obj;

      Examples of correct code for this rule with the { "ObjectExpression": "always", "ObjectPattern": "never" } options:

      /*eslint object-curly-newline: ["error", { "ObjectExpression": "always", "ObjectPattern": "never" }]*/
      /*eslint-env es6*/
      
      let a = {
      };
      let b = {
          foo: 1
      };
      let c = {
          foo: 1, bar: 2
      };
      let d = {
          foo: 1,
          bar: 2
      };
      let e = {
          foo: function() {
              dosomething();
          }
      };
      
      let {} = obj;
      let {f} = obj;
      let {g, h} = obj;
      let {i,
          j} = obj;
      let {k = function() {
          dosomething();
      }} = obj;

      ImportDeclaration and ExportDeclaration

      Examples of incorrect code for this rule with the { "ImportDeclaration": "always", "ExportDeclaration": "never" } options:

      /*eslint object-curly-newline: ["error", { "ImportDeclaration": "always", "ExportDeclaration": "never" }]*/
      /*eslint-env es6*/
      
      import {foo, bar} from 'foo-bar';
      import {foo as f, bar} from 'foo-bar';
      import {foo,
          bar} from 'foo-bar';
      
      export {
         foo,
         bar
      };
      export {
         foo as f,
         bar
      } from 'foo-bar';

      Examples of correct code for this rule with the { "ImportDeclaration": "always", "ExportDeclaration": "never" } options:

      /*eslint object-curly-newline: ["error", { "ImportDeclaration": "always", "ExportDeclaration": "never" }]*/
      /*eslint-env es6*/
      
      import {
          foo,
          bar
      } from 'foo-bar';
      import {
          foo, bar
      } from 'foo-bar';
      import {
          foo as f,
          bar
      } from 'foo-bar';
      
      export { foo, bar } from 'foo-bar';
      export { foo as f, bar } from 'foo-bar';

      Compatibility

      When Not To Use It

      If you don't want to enforce consistent line breaks inside braces, then it's safe to disable this rule.

      Related Rules

      • [comma-spacing](comma-spacing.md)
      • [key-spacing](key-spacing.md)
      • [object-curly-spacing](object-curly-spacing.md)
      • [object-property-newline](object-property-newline.md) Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

      import { colors } from "../themer/themer";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                  parseInt(prompt("Enter control signal bitWidth"), 10);

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                      name: "Control Signal Size",

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                      type: "number",

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                      func: "changeControlSignalSize",

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

              ctx.fillStyle = colors["fill"];

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      '||' should be placed at the beginning of the line.
      Open

                  simulationArea.lastSelected === this ||

      enforce consistent linebreak style for operators (operator-linebreak)

      When a statement is too long to fit on a single line, line breaks are generally inserted next to the operators separating expressions. The first style coming to mind would be to place the operator at the end of the line, following the English punctuation rules.

      var fullHeight = borderTop +
                       innerHeight +
                       borderBottom;

      Some developers find that placing operators at the beginning of the line makes the code more readable.

      var fullHeight = borderTop
                     + innerHeight
                     + borderBottom;

      Rule Details

      This rule enforces a consistent linebreak style for operators.

      Options

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

      String option:

      • "after" requires linebreaks to be placed after the operator
      • "before" requires linebreaks to be placed before the operator
      • "none" disallows linebreaks on either side of the operator

      Object option:

      • "overrides" overrides the global setting for specified operators

      The default configuration is "after", { "overrides": { "?": "before", ":": "before" } }

      after

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

      /*eslint operator-linebreak: ["error", "after"]*/
      
      foo = 1
      +
      2;
      
      foo = 1
          + 2;
      
      foo
          = 5;
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;

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

      /*eslint operator-linebreak: ["error", "after"]*/
      
      foo = 1 + 2;
      
      foo = 1 +
            2;
      
      foo =
          5;
      
      if (someCondition ||
          otherCondition) {
      }
      
      answer = everything ?
        42 :
        foo;

      before

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

      /*eslint operator-linebreak: ["error", "before"]*/
      
      foo = 1 +
            2;
      
      foo =
          5;
      
      if (someCondition ||
          otherCondition) {
      }
      
      answer = everything ?
        42 :
        foo;

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

      /*eslint operator-linebreak: ["error", "before"]*/
      
      foo = 1 + 2;
      
      foo = 1
          + 2;
      
      foo
          = 5;
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;

      none

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

      /*eslint operator-linebreak: ["error", "none"]*/
      
      foo = 1 +
            2;
      
      foo = 1
          + 2;
      
      if (someCondition ||
          otherCondition) {
      }
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;
      
      answer = everything ?
        42 :
        foo;

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

      /*eslint operator-linebreak: ["error", "none"]*/
      
      foo = 1 + 2;
      
      foo = 5;
      
      if (someCondition || otherCondition) {
      }
      
      answer = everything ? 42 : foo;

      overrides

      Examples of additional incorrect code for this rule with the { "overrides": { "+=": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "+=": "before" } }]*/
      
      var thing = 'thing';
      thing +=
        's';

      Examples of additional correct code for this rule with the { "overrides": { "+=": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "+=": "before" } }]*/
      
      var thing = 'thing';
      thing
        += 's';

      Examples of additional correct code for this rule with the { "overrides": { "?": "ignore", ":": "ignore" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "?": "ignore", ":": "ignore" } }]*/
      
      answer = everything ?
        42
        : foo;
      
      answer = everything
        ?
        42
        :
        foo;

      Examples of incorrect code for this rule with the default "after", { "overrides": { "?": "before", ":": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "?": "before", ":": "before" } }]*/
      
      foo = 1
      +
      2;
      
      foo = 1
          + 2;
      
      foo
          = 5;
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything ?
        42 :
        foo;

      Examples of correct code for this rule with the default "after", { "overrides": { "?": "before", ":": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "?": "before", ":": "before" } }]*/
      
      foo = 1 + 2;
      
      foo = 1 +
            2;
      
      foo =
          5;
      
      if (someCondition ||
          otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;

      When Not To Use It

      If your project will not be using a common operator line break style, turn this rule off.

      Related Rules

      Expected no linebreak before this statement.
      Open

                      fillText(

      enforce the location of single-line statements (nonblock-statement-body-position)

      When writing if, else, while, do-while, and for statements, the body can be a single statement instead of a block. It can be useful to enforce a consistent location for these single statements.

      For example, some developers avoid writing code like this:

      if (foo)
        bar();

      If another developer attempts to add baz(); to the if statement, they might mistakenly change the code to

      if (foo)
        bar();
        baz(); // this line is not in the `if` statement!

      To avoid this issue, one might require all single-line if statements to appear directly after the conditional, without a linebreak:

      if (foo) bar();

      Rule Details

      This rule aims to enforce a consistent location for single-line statements.

      Note that this rule does not enforce the usage of single-line statements in general. If you would like to disallow single-line statements, use the curly rule instead.

      Options

      This rule accepts a string option:

      • "beside" (default) disallows a newline before a single-line statement.
      • "below" requires a newline before a single-line statement.
      • "any" does not enforce the position of a single-line statement.

      Additionally, the rule accepts an optional object option with an "overrides" key. This can be used to specify a location for particular statements that override the default. For example:

      • "beside", { "overrides": { "while": "below" } } requires all single-line statements to appear on the same line as their parent, unless the parent is a while statement, in which case the single-line statement must not be on the same line.
      • "below", { "overrides": { "do": "any" } } disallows all single-line statements from appearing on the same line as their parent, unless the parent is a do-while statement, in which case the position of the single-line statement is not enforced.

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

      /* eslint nonblock-statement-body-position: ["error", "beside"] */
      
      if (foo)
        bar();
      else
        baz();
      
      while (foo)
        bar();
      
      for (let i = 1; i < foo; i++)
        bar();
      
      do
        bar();
      while (foo)

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

      /* eslint nonblock-statement-body-position: ["error", "beside"] */
      
      if (foo) bar();
      else baz();
      
      while (foo) bar();
      
      for (let i = 1; i < foo; i++) bar();
      
      do bar(); while (foo)
      
      if (foo) { // block statements are always allowed with this rule
        bar();
      } else {
        baz();
      }

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

      /* eslint nonblock-statement-body-position: ["error", "below"] */
      
      if (foo) bar();
      else baz();
      
      while (foo) bar();
      
      for (let i = 1; i < foo; i++) bar();
      
      do bar(); while (foo)

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

      /* eslint nonblock-statement-body-position: ["error", "below"] */
      
      if (foo)
        bar();
      else
        baz();
      
      while (foo)
        bar();
      
      for (let i = 1; i < foo; i++)
        bar();
      
      do
        bar();
      while (foo)
      
      if (foo) {
        // Although the second `if` statement is on the same line as the `else`, this is a very common
        // pattern, so it's not checked by this rule.
      } else if (bar) {
      }

      Examples of incorrect code for this rule with the "beside", { "overrides": { "while": "below" } } rule:

      /* eslint nonblock-statement-body-position: ["error", "beside", { "overrides": { "while": "below" } }] */
      
      if (foo)
        bar();
      
      while (foo) bar();

      Examples of correct code for this rule with the "beside", { "overrides": { "while": "below" } } rule:

      /* eslint nonblock-statement-body-position: ["error", "beside", { "overrides": { "while": "below" } }] */
      
      if (foo) bar();
      
      while (foo)
        bar();

      When Not To Use It

      If you're not concerned about consistent locations of single-line statements, you should not turn on this rule. You can also disable this rule if you're using the "all" option for the curly rule, because this will disallow single-line statements entirely.

      Further Reading

      Strings must use singlequote.
      Open

                      output += "out" + j + ", ";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                      output += "out" + j + ", ";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Unexpected string concatenation.
      Open

                  output += "out" + (numOutput-1) + ";\n";

      Suggest using template literals instead of string concatenation. (prefer-template)

      In ES2015 (ES6), we can use template literals instead of string concatenation.

      var str = "Hello, " + name + "!";
      /*eslint-env es6*/
      
      var str = `Hello, ${name}!`;

      Rule Details

      This rule is aimed to flag usage of + operators with strings.

      Examples

      Examples of incorrect code for this rule:

      /*eslint prefer-template: "error"*/
      
      var str = "Hello, " + name + "!";
      var str = "Time: " + (12 * 60 * 60 * 1000);

      Examples of correct code for this rule:

      /*eslint prefer-template: "error"*/
      /*eslint-env es6*/
      
      var str = "Hello World!";
      var str = `Hello, ${name}!`;
      var str = `Time: ${12 * 60 * 60 * 1000}`;
      
      // This is reported by `no-useless-concat`.
      var str = "Hello, " + "World!";

      When Not To Use It

      This rule should not be used in ES3/5 environments.

      In ES2015 (ES6) or later, if you don't want to be notified about string concatenation, you can safely disable this rule.

      Related Rules

      There should be no line break before or after '='.
      Open

      Demultiplexer.prototype.tooltipText =

      enforce consistent linebreak style for operators (operator-linebreak)

      When a statement is too long to fit on a single line, line breaks are generally inserted next to the operators separating expressions. The first style coming to mind would be to place the operator at the end of the line, following the English punctuation rules.

      var fullHeight = borderTop +
                       innerHeight +
                       borderBottom;

      Some developers find that placing operators at the beginning of the line makes the code more readable.

      var fullHeight = borderTop
                     + innerHeight
                     + borderBottom;

      Rule Details

      This rule enforces a consistent linebreak style for operators.

      Options

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

      String option:

      • "after" requires linebreaks to be placed after the operator
      • "before" requires linebreaks to be placed before the operator
      • "none" disallows linebreaks on either side of the operator

      Object option:

      • "overrides" overrides the global setting for specified operators

      The default configuration is "after", { "overrides": { "?": "before", ":": "before" } }

      after

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

      /*eslint operator-linebreak: ["error", "after"]*/
      
      foo = 1
      +
      2;
      
      foo = 1
          + 2;
      
      foo
          = 5;
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;

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

      /*eslint operator-linebreak: ["error", "after"]*/
      
      foo = 1 + 2;
      
      foo = 1 +
            2;
      
      foo =
          5;
      
      if (someCondition ||
          otherCondition) {
      }
      
      answer = everything ?
        42 :
        foo;

      before

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

      /*eslint operator-linebreak: ["error", "before"]*/
      
      foo = 1 +
            2;
      
      foo =
          5;
      
      if (someCondition ||
          otherCondition) {
      }
      
      answer = everything ?
        42 :
        foo;

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

      /*eslint operator-linebreak: ["error", "before"]*/
      
      foo = 1 + 2;
      
      foo = 1
          + 2;
      
      foo
          = 5;
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;

      none

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

      /*eslint operator-linebreak: ["error", "none"]*/
      
      foo = 1 +
            2;
      
      foo = 1
          + 2;
      
      if (someCondition ||
          otherCondition) {
      }
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;
      
      answer = everything ?
        42 :
        foo;

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

      /*eslint operator-linebreak: ["error", "none"]*/
      
      foo = 1 + 2;
      
      foo = 5;
      
      if (someCondition || otherCondition) {
      }
      
      answer = everything ? 42 : foo;

      overrides

      Examples of additional incorrect code for this rule with the { "overrides": { "+=": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "+=": "before" } }]*/
      
      var thing = 'thing';
      thing +=
        's';

      Examples of additional correct code for this rule with the { "overrides": { "+=": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "+=": "before" } }]*/
      
      var thing = 'thing';
      thing
        += 's';

      Examples of additional correct code for this rule with the { "overrides": { "?": "ignore", ":": "ignore" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "?": "ignore", ":": "ignore" } }]*/
      
      answer = everything ?
        42
        : foo;
      
      answer = everything
        ?
        42
        :
        foo;

      Examples of incorrect code for this rule with the default "after", { "overrides": { "?": "before", ":": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "?": "before", ":": "before" } }]*/
      
      foo = 1
      +
      2;
      
      foo = 1
          + 2;
      
      foo
          = 5;
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything ?
        42 :
        foo;

      Examples of correct code for this rule with the default "after", { "overrides": { "?": "before", ":": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "?": "before", ":": "before" } }]*/
      
      foo = 1 + 2;
      
      foo = 1 +
            2;
      
      foo =
          5;
      
      if (someCondition ||
          otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;

      When Not To Use It

      If your project will not be using a common operator line break style, turn this rule off.

      Related Rules

      Strings must use singlequote.
      Open

      Demultiplexer.prototype.objectType = "Demultiplexer";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

      import Node, { findNode } from "../node";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      ["hover_select"] is better written in dot notation.
      Open

                  ctx.fillStyle = colors["hover_select"];

      Require Dot Notation (dot-notation)

      In JavaScript, one can access properties using the dot notation (foo.bar) or square-bracket notation (foo["bar"]). However, the dot notation is often preferred because it is easier to read, less verbose, and works better with aggressive JavaScript minimizers.

      foo["bar"];

      Rule Details

      This rule is aimed at maintaining code consistency and improving code readability by encouraging use of the dot notation style whenever possible. As such, it will warn when it encounters an unnecessary use of square-bracket notation.

      Examples of incorrect code for this rule:

      /*eslint dot-notation: "error"*/
      
      var x = foo["bar"];

      Examples of correct code for this rule:

      /*eslint dot-notation: "error"*/
      
      var x = foo.bar;
      
      var x = foo[bar];    // Property name is a variable, square-bracket notation required

      Options

      This rule accepts a single options argument:

      • Set the allowKeywords option to false (default is true) to follow ECMAScript version 3 compatible style, avoiding dot notation for reserved word properties.
      • Set the allowPattern option to a regular expression string to allow bracket notation for property names that match a pattern (by default, no pattern is tested).

      allowKeywords

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

      /*eslint dot-notation: ["error", { "allowKeywords": false }]*/
      
      var foo = { "class": "CS 101" }
      var x = foo["class"]; // Property name is a reserved word, square-bracket notation required

      allowPattern

      For example, when preparing data to be sent to an external API, it is often required to use property names that include underscores. If the camelcase rule is in effect, these snake case properties would not be allowed. By providing an allowPattern to the dot-notation rule, these snake case properties can be accessed with bracket notation.

      Examples of correct code for the sample { "allowPattern": "^[a-z]+(_[a-z]+)+$" } option:

      /*eslint camelcase: "error"*/
      /*eslint dot-notation: ["error", { "allowPattern": "^[a-z]+(_[a-z]+)+$" }]*/
      
      var data = {};
      data.foo_bar = 42;
      
      var data = {};
      data["fooBar"] = 42;
      
      var data = {};
      data["foo_bar"] = 42; // no warning

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

      Strings must use singlequote.
      Open

              ctx.fillStyle = "black";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Unexpected string concatenation.
      Open

                  output += "  input [" + (size-1) +":0] sel;\n";

      Suggest using template literals instead of string concatenation. (prefer-template)

      In ES2015 (ES6), we can use template literals instead of string concatenation.

      var str = "Hello, " + name + "!";
      /*eslint-env es6*/
      
      var str = `Hello, ${name}!`;

      Rule Details

      This rule is aimed to flag usage of + operators with strings.

      Examples

      Examples of incorrect code for this rule:

      /*eslint prefer-template: "error"*/
      
      var str = "Hello, " + name + "!";
      var str = "Time: " + (12 * 60 * 60 * 1000);

      Examples of correct code for this rule:

      /*eslint prefer-template: "error"*/
      /*eslint-env es6*/
      
      var str = "Hello World!";
      var str = `Hello, ${name}!`;
      var str = `Time: ${12 * 60 * 60 * 1000}`;
      
      // This is reported by `no-useless-concat`.
      var str = "Hello, " + "World!";

      When Not To Use It

      This rule should not be used in ES3/5 environments.

      In ES2015 (ES6) or later, if you don't want to be notified about string concatenation, you can safely disable this rule.

      Related Rules

      Unexpected string concatenation.
      Open

                      output += "    out" + j + " = 0;\n";

      Suggest using template literals instead of string concatenation. (prefer-template)

      In ES2015 (ES6), we can use template literals instead of string concatenation.

      var str = "Hello, " + name + "!";
      /*eslint-env es6*/
      
      var str = `Hello, ${name}!`;

      Rule Details

      This rule is aimed to flag usage of + operators with strings.

      Examples

      Examples of incorrect code for this rule:

      /*eslint prefer-template: "error"*/
      
      var str = "Hello, " + name + "!";
      var str = "Time: " + (12 * 60 * 60 * 1000);

      Examples of correct code for this rule:

      /*eslint prefer-template: "error"*/
      /*eslint-env es6*/
      
      var str = "Hello World!";
      var str = `Hello, ${name}!`;
      var str = `Time: ${12 * 60 * 60 * 1000}`;
      
      // This is reported by `no-useless-concat`.
      var str = "Hello, " + "World!";

      When Not To Use It

      This rule should not be used in ES3/5 environments.

      In ES2015 (ES6) or later, if you don't want to be notified about string concatenation, you can safely disable this rule.

      Related Rules

      Strings must use singlequote.
      Open

          "https://docs.circuitverse.org/#/chapter4/5muxandplex?id=demultiplexer";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

      import simulationArea from "../simulationArea";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      '||' should be placed at the beginning of the line.
      Open

                  controlSignalSize ||

      enforce consistent linebreak style for operators (operator-linebreak)

      When a statement is too long to fit on a single line, line breaks are generally inserted next to the operators separating expressions. The first style coming to mind would be to place the operator at the end of the line, following the English punctuation rules.

      var fullHeight = borderTop +
                       innerHeight +
                       borderBottom;

      Some developers find that placing operators at the beginning of the line makes the code more readable.

      var fullHeight = borderTop
                     + innerHeight
                     + borderBottom;

      Rule Details

      This rule enforces a consistent linebreak style for operators.

      Options

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

      String option:

      • "after" requires linebreaks to be placed after the operator
      • "before" requires linebreaks to be placed before the operator
      • "none" disallows linebreaks on either side of the operator

      Object option:

      • "overrides" overrides the global setting for specified operators

      The default configuration is "after", { "overrides": { "?": "before", ":": "before" } }

      after

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

      /*eslint operator-linebreak: ["error", "after"]*/
      
      foo = 1
      +
      2;
      
      foo = 1
          + 2;
      
      foo
          = 5;
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;

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

      /*eslint operator-linebreak: ["error", "after"]*/
      
      foo = 1 + 2;
      
      foo = 1 +
            2;
      
      foo =
          5;
      
      if (someCondition ||
          otherCondition) {
      }
      
      answer = everything ?
        42 :
        foo;

      before

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

      /*eslint operator-linebreak: ["error", "before"]*/
      
      foo = 1 +
            2;
      
      foo =
          5;
      
      if (someCondition ||
          otherCondition) {
      }
      
      answer = everything ?
        42 :
        foo;

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

      /*eslint operator-linebreak: ["error", "before"]*/
      
      foo = 1 + 2;
      
      foo = 1
          + 2;
      
      foo
          = 5;
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;

      none

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

      /*eslint operator-linebreak: ["error", "none"]*/
      
      foo = 1 +
            2;
      
      foo = 1
          + 2;
      
      if (someCondition ||
          otherCondition) {
      }
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;
      
      answer = everything ?
        42 :
        foo;

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

      /*eslint operator-linebreak: ["error", "none"]*/
      
      foo = 1 + 2;
      
      foo = 5;
      
      if (someCondition || otherCondition) {
      }
      
      answer = everything ? 42 : foo;

      overrides

      Examples of additional incorrect code for this rule with the { "overrides": { "+=": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "+=": "before" } }]*/
      
      var thing = 'thing';
      thing +=
        's';

      Examples of additional correct code for this rule with the { "overrides": { "+=": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "+=": "before" } }]*/
      
      var thing = 'thing';
      thing
        += 's';

      Examples of additional correct code for this rule with the { "overrides": { "?": "ignore", ":": "ignore" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "?": "ignore", ":": "ignore" } }]*/
      
      answer = everything ?
        42
        : foo;
      
      answer = everything
        ?
        42
        :
        foo;

      Examples of incorrect code for this rule with the default "after", { "overrides": { "?": "before", ":": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "?": "before", ":": "before" } }]*/
      
      foo = 1
      +
      2;
      
      foo = 1
          + 2;
      
      foo
          = 5;
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything ?
        42 :
        foo;

      Examples of correct code for this rule with the default "after", { "overrides": { "?": "before", ":": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "?": "before", ":": "before" } }]*/
      
      foo = 1 + 2;
      
      foo = 1 +
            2;
      
      foo =
          5;
      
      if (someCondition ||
          otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;

      When Not To Use It

      If your project will not be using a common operator line break style, turn this rule off.

      Related Rules

      Strings must use singlequote.
      Open

                  else if (this.direction === "RIGHT")

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                  output += "\n";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Unexpected string concatenation.
      Open

                      output += "out" + j + ", ";

      Suggest using template literals instead of string concatenation. (prefer-template)

      In ES2015 (ES6), we can use template literals instead of string concatenation.

      var str = "Hello, " + name + "!";
      /*eslint-env es6*/
      
      var str = `Hello, ${name}!`;

      Rule Details

      This rule is aimed to flag usage of + operators with strings.

      Examples

      Examples of incorrect code for this rule:

      /*eslint prefer-template: "error"*/
      
      var str = "Hello, " + name + "!";
      var str = "Time: " + (12 * 60 * 60 * 1000);

      Examples of correct code for this rule:

      /*eslint prefer-template: "error"*/
      /*eslint-env es6*/
      
      var str = "Hello World!";
      var str = `Hello, ${name}!`;
      var str = `Time: ${12 * 60 * 60 * 1000}`;
      
      // This is reported by `no-useless-concat`.
      var str = "Hello, " + "World!";

      When Not To Use It

      This rule should not be used in ES3/5 environments.

      In ES2015 (ES6) or later, if you don't want to be notified about string concatenation, you can safely disable this rule.

      Related Rules

      Strings must use singlequote.
      Open

                  output += "(";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                  "Control Signal"

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Expected { after 'if' condition.
      Open

                  if (this.direction === "LEFT")

      Require Following Curly Brace Conventions (curly)

      JavaScript allows the omission of curly braces when a block contains only one statement. However, it is considered by many to be best practice to never omit curly braces around blocks, even when they are optional, because it can lead to bugs and reduces code clarity. So the following:

      if (foo) foo++;

      Can be rewritten as:

      if (foo) {
          foo++;
      }

      There are, however, some who prefer to only use braces when there is more than one statement to be executed.

      Rule Details

      This rule is aimed at preventing bugs and increasing code clarity by ensuring that block statements are wrapped in curly braces. It will warn when it encounters blocks that omit curly braces.

      Options

      all

      Examples of incorrect code for the default "all" option:

      /*eslint curly: "error"*/
      
      if (foo) foo++;
      
      while (bar)
          baz();
      
      if (foo) {
          baz();
      } else qux();

      Examples of correct code for the default "all" option:

      /*eslint curly: "error"*/
      
      if (foo) {
          foo++;
      }
      
      while (bar) {
          baz();
      }
      
      if (foo) {
          baz();
      } else {
          qux();
      }

      multi

      By default, this rule warns whenever if, else, for, while, or do are used without block statements as their body. However, you can specify that block statements should be used only when there are multiple statements in the block and warn when there is only one statement in the block.

      Examples of incorrect code for the "multi" option:

      /*eslint curly: ["error", "multi"]*/
      
      if (foo) {
          foo++;
      }
      
      if (foo) bar();
      else {
          foo++;
      }
      
      while (true) {
          doSomething();
      }
      
      for (var i=0; i < items.length; i++) {
          doSomething();
      }

      Examples of correct code for the "multi" option:

      /*eslint curly: ["error", "multi"]*/
      
      if (foo) foo++;
      
      else foo();
      
      while (true) {
          doSomething();
          doSomethingElse();
      }

      multi-line

      Alternatively, you can relax the rule to allow brace-less single-line if, else if, else, for, while, or do, while still enforcing the use of curly braces for other instances.

      Examples of incorrect code for the "multi-line" option:

      /*eslint curly: ["error", "multi-line"]*/
      
      if (foo)
        doSomething();
      else
        doSomethingElse();
      
      if (foo) foo(
        bar,
        baz);

      Examples of correct code for the "multi-line" option:

      /*eslint curly: ["error", "multi-line"]*/
      
      if (foo) foo++; else doSomething();
      
      if (foo) foo++;
      else if (bar) baz()
      else doSomething();
      
      do something();
      while (foo);
      
      while (foo
        && bar) baz();
      
      if (foo) {
          foo++;
      }
      
      if (foo) { foo++; }
      
      while (true) {
          doSomething();
          doSomethingElse();
      }

      multi-or-nest

      You can use another configuration that forces brace-less if, else if, else, for, while, or do if their body contains only one single-line statement. And forces braces in all other cases.

      Examples of incorrect code for the "multi-or-nest" option:

      /*eslint curly: ["error", "multi-or-nest"]*/
      
      if (!foo)
          foo = {
              bar: baz,
              qux: foo
          };
      
      while (true)
        if(foo)
            doSomething();
        else
            doSomethingElse();
      
      if (foo) {
          foo++;
      }
      
      while (true) {
          doSomething();
      }
      
      for (var i = 0; foo; i++) {
          doSomething();
      }

      Examples of correct code for the "multi-or-nest" option:

      /*eslint curly: ["error", "multi-or-nest"]*/
      
      if (!foo) {
          foo = {
              bar: baz,
              qux: foo
          };
      }
      
      while (true) {
        if(foo)
            doSomething();
        else
            doSomethingElse();
      }
      
      if (foo)
          foo++;
      
      while (true)
          doSomething();
      
      for (var i = 0; foo; i++)
          doSomething();

      For single-line statements preceded by a comment, braces are allowed but not required.

      Examples of additional correct code for the "multi-or-nest" option:

      /*eslint curly: ["error", "multi-or-nest"]*/
      
      if (foo)
          // some comment
          bar();
      
      if (foo) {
          // some comment
          bar();
      }

      consistent

      When using any of the multi* options, you can add an option to enforce all bodies of a if, else if and else chain to be with or without braces.

      Examples of incorrect code for the "multi", "consistent" options:

      /*eslint curly: ["error", "multi", "consistent"]*/
      
      if (foo) {
          bar();
          baz();
      } else
          buz();
      
      if (foo)
          bar();
      else if (faa)
          bor();
      else {
          other();
          things();
      }
      
      if (true)
          foo();
      else {
          baz();
      }
      
      if (foo) {
          foo++;
      }

      Examples of correct code for the "multi", "consistent" options:

      /*eslint curly: ["error", "multi", "consistent"]*/
      
      if (foo) {
          bar();
          baz();
      } else {
          buz();
      }
      
      if (foo) {
          bar();
      } else if (faa) {
          bor();
      } else {
          other();
          things();
      }
      
      if (true)
          foo();
      else
          baz();
      
      if (foo)
          foo++;

      When Not To Use It

      If you have no strict conventions about when to use block statements and when not to, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Unexpected use of '<<'.
      Open

                  var numOutput = 1 << size;

      disallow bitwise operators (no-bitwise)

      The use of bitwise operators in JavaScript is very rare and often & or | is simply a mistyped && or ||, which will lead to unexpected behavior.

      var x = y | z;

      Rule Details

      This rule disallows bitwise operators.

      Examples of incorrect code for this rule:

      /*eslint no-bitwise: "error"*/
      
      var x = y | z;
      
      var x = y & z;
      
      var x = y ^ z;
      
      var x = ~ z;
      
      var x = y << z;
      
      var x = y >> z;
      
      var x = y >>> z;
      
      x |= y;
      
      x &= y;
      
      x ^= y;
      
      x <<= y;
      
      x >>= y;
      
      x >>>= y;

      Examples of correct code for this rule:

      /*eslint no-bitwise: "error"*/
      
      var x = y || z;
      
      var x = y && z;
      
      var x = y > z;
      
      var x = y < z;
      
      x += y;

      Options

      This rule has an object option:

      • "allow": Allows a list of bitwise operators to be used as exceptions.
      • "int32Hint": Allows the use of bitwise OR in |0 pattern for type casting.

      allow

      Examples of correct code for this rule with the { "allow": ["~"] } option:

      /*eslint no-bitwise: ["error", { "allow": ["~"] }] */
      
      ~[1,2,3].indexOf(1) === -1;

      int32Hint

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

      /*eslint no-bitwise: ["error", { "int32Hint": true }] */
      
      var b = a|0;

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

      Strings must use singlequote.
      Open

                  output += "  input [WIDTH-1:0] in;\n"

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                  output += "endmodule\n";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

              dir = "LEFT",

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      ["stroke"] is better written in dot notation.
      Open

              ctx.strokeStyle = colors["stroke"];

      Require Dot Notation (dot-notation)

      In JavaScript, one can access properties using the dot notation (foo.bar) or square-bracket notation (foo["bar"]). However, the dot notation is often preferred because it is easier to read, less verbose, and works better with aggressive JavaScript minimizers.

      foo["bar"];

      Rule Details

      This rule is aimed at maintaining code consistency and improving code readability by encouraging use of the dot notation style whenever possible. As such, it will warn when it encounters an unnecessary use of square-bracket notation.

      Examples of incorrect code for this rule:

      /*eslint dot-notation: "error"*/
      
      var x = foo["bar"];

      Examples of correct code for this rule:

      /*eslint dot-notation: "error"*/
      
      var x = foo.bar;
      
      var x = foo[bar];    // Property name is a variable, square-bracket notation required

      Options

      This rule accepts a single options argument:

      • Set the allowKeywords option to false (default is true) to follow ECMAScript version 3 compatible style, avoiding dot notation for reserved word properties.
      • Set the allowPattern option to a regular expression string to allow bracket notation for property names that match a pattern (by default, no pattern is tested).

      allowKeywords

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

      /*eslint dot-notation: ["error", { "allowKeywords": false }]*/
      
      var foo = { "class": "CS 101" }
      var x = foo["class"]; // Property name is a reserved word, square-bracket notation required

      allowPattern

      For example, when preparing data to be sent to an external API, it is often required to use property names that include underscores. If the camelcase rule is in effect, these snake case properties would not be allowed. By providing an allowPattern to the dot-notation rule, these snake case properties can be accessed with bracket notation.

      Examples of correct code for the sample { "allowPattern": "^[a-z]+(_[a-z]+)+$" } option:

      /*eslint camelcase: "error"*/
      /*eslint dot-notation: ["error", { "allowPattern": "^[a-z]+(_[a-z]+)+$" }]*/
      
      var data = {};
      data.foo_bar = 42;
      
      var data = {};
      data["fooBar"] = 42;
      
      var data = {};
      data["foo_bar"] = 42; // no warning

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

      Unexpected use of '<<'.
      Open

              this.outputsize = 1 << this.controlSignalSize;

      disallow bitwise operators (no-bitwise)

      The use of bitwise operators in JavaScript is very rare and often & or | is simply a mistyped && or ||, which will lead to unexpected behavior.

      var x = y | z;

      Rule Details

      This rule disallows bitwise operators.

      Examples of incorrect code for this rule:

      /*eslint no-bitwise: "error"*/
      
      var x = y | z;
      
      var x = y & z;
      
      var x = y ^ z;
      
      var x = ~ z;
      
      var x = y << z;
      
      var x = y >> z;
      
      var x = y >>> z;
      
      x |= y;
      
      x &= y;
      
      x ^= y;
      
      x <<= y;
      
      x >>= y;
      
      x >>>= y;

      Examples of correct code for this rule:

      /*eslint no-bitwise: "error"*/
      
      var x = y || z;
      
      var x = y && z;
      
      var x = y > z;
      
      var x = y < z;
      
      x += y;

      Options

      This rule has an object option:

      • "allow": Allows a list of bitwise operators to be used as exceptions.
      • "int32Hint": Allows the use of bitwise OR in |0 pattern for type casting.

      allow

      Examples of correct code for this rule with the { "allow": ["~"] } option:

      /*eslint no-bitwise: ["error", { "allow": ["~"] }] */
      
      ~[1,2,3].indexOf(1) === -1;

      int32Hint

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

      /*eslint no-bitwise: ["error", { "int32Hint": true }] */
      
      var b = a|0;

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

      Strings must use singlequote.
      Open

              ctx.textAlign = "center";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Unexpected unnamed function.
      Open

              this.newBitWidth = function (bitWidth) {

      Require or disallow named function expressions (func-names)

      A pattern that's becoming more common is to give function expressions names to aid in debugging. For example:

      Foo.prototype.bar = function bar() {};

      Adding the second bar in the above example is optional. If you leave off the function name then when the function throws an exception you are likely to get something similar to anonymous function in the stack trace. If you provide the optional name for a function expression then you will get the name of the function expression in the stack trace.

      Rule Details

      This rule can enforce or disallow the use of named function expressions.

      Options

      This rule has a string option:

      • "always" (default) requires function expressions to have a name
      • "as-needed" requires function expressions to have a name, if the name cannot be assigned automatically in an ES6 environment
      • "never" disallows named function expressions, except in recursive functions, where a name is needed

      This rule has an object option:

      • "generators": "always" | "as-needed" | "never"
        • "always" require named generators
        • "as-needed" require named generators if the name cannot be assigned automatically in an ES6 environment.
        • "never" disallow named generators where possible.

      When a value for generators is not provided the behavior for generator functions falls back to the base option.

      Please note that "always" and "as-needed" require function expressions and function declarations in export default declarations to have a name.

      always

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

      /*eslint func-names: ["error", "always"]*/
      
      Foo.prototype.bar = function() {};
      
      const cat = {
        meow: function() {}
      }
      
      (function() {
          // ...
      }())
      
      export default function() {}

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

      /*eslint func-names: ["error", "always"]*/
      
      Foo.prototype.bar = function bar() {};
      
      const cat = {
        meow() {}
      }
      
      (function bar() {
          // ...
      }())
      
      export default function foo() {}

      as-needed

      ECMAScript 6 introduced a name property on all functions. The value of name is determined by evaluating the code around the function to see if a name can be inferred. For example, a function assigned to a variable will automatically have a name property equal to the name of the variable. The value of name is then used in stack traces for easier debugging.

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

      /*eslint func-names: ["error", "as-needed"]*/
      
      Foo.prototype.bar = function() {};
      
      (function() {
          // ...
      }())
      
      export default function() {}

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

      /*eslint func-names: ["error", "as-needed"]*/
      
      var bar = function() {};
      
      const cat = {
        meow: function() {}
      }
      
      (function bar() {
          // ...
      }())
      
      export default function foo() {}

      never

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

      /*eslint func-names: ["error", "never"]*/
      
      Foo.prototype.bar = function bar() {};
      
      (function bar() {
          // ...
      }())

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

      /*eslint func-names: ["error", "never"]*/
      
      Foo.prototype.bar = function() {};
      
      (function() {
          // ...
      }())

      generators

      Examples of incorrect code for this rule with the "always", { "generators": "as-needed" } options:

      /*eslint func-names: ["error", "always", { "generators": "as-needed" }]*/
      
      (function*() {
          // ...
      }())

      Examples of correct code for this rule with the "always", { "generators": "as-needed" } options:

      /*eslint func-names: ["error", "always", { "generators": "as-needed" }]*/
      
      var foo = function*() {};

      Examples of incorrect code for this rule with the "always", { "generators": "never" } options:

      /*eslint func-names: ["error", "always", { "generators": "never" }]*/
      
      var foo = bar(function *baz() {});

      Examples of correct code for this rule with the "always", { "generators": "never" } options:

      /*eslint func-names: ["error", "always", { "generators": "never" }]*/
      
      var foo = bar(function *() {});

      Examples of incorrect code for this rule with the "as-needed", { "generators": "never" } options:

      /*eslint func-names: ["error", "as-needed", { "generators": "never" }]*/
      
      var foo = bar(function *baz() {});

      Examples of correct code for this rule with the "as-needed", { "generators": "never" } options:

      /*eslint func-names: ["error", "as-needed", { "generators": "never" }]*/
      
      var foo = bar(function *() {});

      Examples of incorrect code for this rule with the "never", { "generators": "always" } options:

      /*eslint func-names: ["error", "never", { "generators": "always" }]*/
      
      var foo = bar(function *() {});

      Examples of correct code for this rule with the "never", { "generators": "always" } options:

      /*eslint func-names: ["error", "never", { "generators": "always" }]*/
      
      var foo = bar(function *baz() {});

      Further Reading

      Compatibility

      Strings must use singlequote.
      Open

                  output += "    endcase\n";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

              var output = "";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                  output += "module Demultiplexer" + numOutput;

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Expected a line break after this opening brace.
      Open

      import { correctWidth, lineTo, moveTo, fillText } from "../canvasApi";

      enforce consistent line breaks inside braces (object-curly-newline)

      A number of style guides require or disallow line breaks inside of object braces and other tokens.

      Rule Details

      This rule enforces consistent line breaks inside braces of object literals or destructuring assignments.

      Options

      This rule has either a string option:

      • "always" requires line breaks inside braces
      • "never" disallows line breaks inside braces

      Or an object option:

      • "multiline": true requires line breaks if there are line breaks inside properties or between properties. Otherwise, it disallows line breaks.
      • "minProperties" requires line breaks if the number of properties is at least the given integer. By default, an error will also be reported if an object contains linebreaks and has fewer properties than the given integer. However, the second behavior is disabled if the consistent option is set to true
      • "consistent": true (default) requires that either both curly braces, or neither, directly enclose newlines. Note that enabling this option will also change the behavior of the minProperties option. (See minProperties above for more information)

      You can specify different options for object literals, destructuring assignments, and named imports and exports:

      {
          "object-curly-newline": ["error", {
              "ObjectExpression": "always",
              "ObjectPattern": { "multiline": true },
              "ImportDeclaration": "never",
              "ExportDeclaration": { "multiline": true, "minProperties": 3 }
          }]
      }
      • "ObjectExpression" configuration for object literals
      • "ObjectPattern" configuration for object patterns of destructuring assignments
      • "ImportDeclaration" configuration for named imports
      • "ExportDeclaration" configuration for named exports

      always

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

      /*eslint object-curly-newline: ["error", "always"]*/
      /*eslint-env es6*/
      
      let a = {};
      let b = {foo: 1};
      let c = {foo: 1, bar: 2};
      let d = {foo: 1,
          bar: 2};
      let e = {foo() {
          dosomething();
      }};
      
      let {} = obj;
      let {f} = obj;
      let {g, h} = obj;
      let {i,
          j} = obj;
      let {k = function() {
          dosomething();
      }} = obj;

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

      /*eslint object-curly-newline: ["error", "always"]*/
      /*eslint-env es6*/
      
      let a = {
      };
      let b = {
          foo: 1
      };
      let c = {
          foo: 1, bar: 2
      };
      let d = {
          foo: 1,
          bar: 2
      };
      let e = {
          foo: function() {
              dosomething();
          }
      };
      
      let {
      } = obj;
      let {
          f
      } = obj;
      let {
          g, h
      } = obj;
      let {
          i,
          j
      } = obj;
      let {
          k = function() {
              dosomething();
          }
      } = obj;

      never

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

      /*eslint object-curly-newline: ["error", "never"]*/
      /*eslint-env es6*/
      
      let a = {
      };
      let b = {
          foo: 1
      };
      let c = {
          foo: 1, bar: 2
      };
      let d = {
          foo: 1,
          bar: 2
      };
      let e = {
          foo: function() {
              dosomething();
          }
      };
      
      let {
      } = obj;
      let {
          f
      } = obj;
      let {
          g, h
      } = obj;
      let {
          i,
          j
      } = obj;
      let {
          k = function() {
              dosomething();
          }
      } = obj;

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

      /*eslint object-curly-newline: ["error", "never"]*/
      /*eslint-env es6*/
      
      let a = {};
      let b = {foo: 1};
      let c = {foo: 1, bar: 2};
      let d = {foo: 1,
          bar: 2};
      let e = {foo: function() {
          dosomething();
      }};
      
      let {} = obj;
      let {f} = obj;
      let {g, h} = obj;
      let {i,
          j} = obj;
      let {k = function() {
          dosomething();
      }} = obj;

      multiline

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

      /*eslint object-curly-newline: ["error", { "multiline": true }]*/
      /*eslint-env es6*/
      
      let a = {
      };
      let b = {
          foo: 1
      };
      let c = {
          foo: 1, bar: 2
      };
      let d = {foo: 1,
          bar: 2};
      let e = {foo: function() {
          dosomething();
      }};
      
      let {
      } = obj;
      let {
          f
      } = obj;
      let {
          g, h
      } = obj;
      let {i,
          j} = obj;
      let {k = function() {
          dosomething();
      }} = obj;

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

      /*eslint object-curly-newline: ["error", { "multiline": true }]*/
      /*eslint-env es6*/
      
      let a = {};
      let b = {foo: 1};
      let c = {foo: 1, bar: 2};
      let d = {
          foo: 1,
          bar: 2
      };
      let e = {
          foo: function() {
              dosomething();
          }
      };
      
      let {} = obj;
      let {f} = obj;
      let {g, h} = obj;
      let {
          i,
          j
      } = obj;
      let {
          k = function() {
              dosomething();
          }
      } = obj;

      minProperties

      Examples of incorrect code for this rule with the { "minProperties": 2 } option:

      /*eslint object-curly-newline: ["error", { "minProperties": 2 }]*/
      /*eslint-env es6*/
      
      let a = {
      };
      let b = {
          foo: 1
      };
      let c = {foo: 1, bar: 2};
      let d = {foo: 1,
          bar: 2};
      let e = {
          foo: function() {
              dosomething();
          }
      };
      
      let {
      } = obj;
      let {
          f
      } = obj;
      let {g, h} = obj;
      let {i,
          j} = obj;
      let {
          k = function() {
              dosomething();
          }
      } = obj;

      Examples of correct code for this rule with the { "minProperties": 2 } option:

      /*eslint object-curly-newline: ["error", { "minProperties": 2 }]*/
      /*eslint-env es6*/
      
      let a = {};
      let b = {foo: 1};
      let c = {
          foo: 1, bar: 2
      };
      let d = {
          foo: 1,
          bar: 2
      };
      let e = {foo: function() {
          dosomething();
      }};
      
      let {} = obj;
      let {f} = obj;
      let {
          g, h
      } = obj;
      let {
          i,
          j
      } = obj;
      let {k = function() {
          dosomething();
      }} = obj;

      consistent

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

      /*eslint object-curly-newline: ["error", { "consistent": true }]*/
      /*eslint-env es6*/
      
      let a = {foo: 1
      };
      let b = {
          foo: 1};
      let c = {foo: 1, bar: 2
      };
      let d = {
          foo: 1, bar: 2};
      let e = {foo: function() {
          dosomething();
          }
      };
      let f = {
          foo: function() {
          dosomething();}};
      
      let {g
      } = obj;
      let {
          h} = obj;
      let {i, j
      } = obj;
      let {k, l
      } = obj;
      let {
          m, n} = obj;
      let {
          o, p} = obj;
      let {q = function() {
          dosomething();
          }
      } = obj;
      let {
          r = function() {
              dosomething();
          }} = obj;

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

      /*eslint object-curly-newline: ["error", { "consistent": true }]*/
      /*eslint-env es6*/
      
      
      let empty1 = {};
      let empty2 = {
      };
      let a = {foo: 1};
      let b = {
          foo: 1
      };
      let c = {
          foo: 1, bar: 2
      };
      let d = {
          foo: 1,
          bar: 2
      };
      let e = {foo: function() {dosomething();}};
      let f = {
          foo: function() {
              dosomething();
          }
      };
      
      let {} = obj;
      let {
      } = obj;
      let {g} = obj;
      let {
          h
      } = obj;
      let {i, j} = obj;
      let {
          k, l
      } = obj;
      let {m,
          n} = obj;
      let {
          o,
          p
      } = obj;
      let {q = function() {dosomething();}} = obj;
      let {
          r = function() {
              dosomething();
          }
      } = obj;

      ObjectExpression and ObjectPattern

      Examples of incorrect code for this rule with the { "ObjectExpression": "always", "ObjectPattern": "never" } options:

      /*eslint object-curly-newline: ["error", { "ObjectExpression": "always", "ObjectPattern": "never" }]*/
      /*eslint-env es6*/
      
      let a = {};
      let b = {foo: 1};
      let c = {foo: 1, bar: 2};
      let d = {foo: 1,
          bar: 2};
      let e = {foo: function() {
          dosomething();
      }};
      
      let {
      } = obj;
      let {
          f
      } = obj;
      let {
          g, h
      } = obj;
      let {
          i,
          j
      } = obj;
      let {
          k = function() {
              dosomething();
          }
      } = obj;

      Examples of correct code for this rule with the { "ObjectExpression": "always", "ObjectPattern": "never" } options:

      /*eslint object-curly-newline: ["error", { "ObjectExpression": "always", "ObjectPattern": "never" }]*/
      /*eslint-env es6*/
      
      let a = {
      };
      let b = {
          foo: 1
      };
      let c = {
          foo: 1, bar: 2
      };
      let d = {
          foo: 1,
          bar: 2
      };
      let e = {
          foo: function() {
              dosomething();
          }
      };
      
      let {} = obj;
      let {f} = obj;
      let {g, h} = obj;
      let {i,
          j} = obj;
      let {k = function() {
          dosomething();
      }} = obj;

      ImportDeclaration and ExportDeclaration

      Examples of incorrect code for this rule with the { "ImportDeclaration": "always", "ExportDeclaration": "never" } options:

      /*eslint object-curly-newline: ["error", { "ImportDeclaration": "always", "ExportDeclaration": "never" }]*/
      /*eslint-env es6*/
      
      import {foo, bar} from 'foo-bar';
      import {foo as f, bar} from 'foo-bar';
      import {foo,
          bar} from 'foo-bar';
      
      export {
         foo,
         bar
      };
      export {
         foo as f,
         bar
      } from 'foo-bar';

      Examples of correct code for this rule with the { "ImportDeclaration": "always", "ExportDeclaration": "never" } options:

      /*eslint object-curly-newline: ["error", { "ImportDeclaration": "always", "ExportDeclaration": "never" }]*/
      /*eslint-env es6*/
      
      import {
          foo,
          bar
      } from 'foo-bar';
      import {
          foo, bar
      } from 'foo-bar';
      import {
          foo as f,
          bar
      } from 'foo-bar';
      
      export { foo, bar } from 'foo-bar';
      export { foo as f, bar } from 'foo-bar';

      Compatibility

      When Not To Use It

      If you don't want to enforce consistent line breaks inside braces, then it's safe to disable this rule.

      Related Rules

      • [comma-spacing](comma-spacing.md)
      • [key-spacing](key-spacing.md)
      • [object-curly-spacing](object-curly-spacing.md)
      • [object-property-newline](object-property-newline.md) Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

              ctx.strokeStyle = colors["stroke"];

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Unexpected string concatenation.
      Open

                  output += "module Demultiplexer" + numOutput;

      Suggest using template literals instead of string concatenation. (prefer-template)

      In ES2015 (ES6), we can use template literals instead of string concatenation.

      var str = "Hello, " + name + "!";
      /*eslint-env es6*/
      
      var str = `Hello, ${name}!`;

      Rule Details

      This rule is aimed to flag usage of + operators with strings.

      Examples

      Examples of incorrect code for this rule:

      /*eslint prefer-template: "error"*/
      
      var str = "Hello, " + name + "!";
      var str = "Time: " + (12 * 60 * 60 * 1000);

      Examples of correct code for this rule:

      /*eslint prefer-template: "error"*/
      /*eslint-env es6*/
      
      var str = "Hello World!";
      var str = `Hello, ${name}!`;
      var str = `Time: ${12 * 60 * 60 * 1000}`;
      
      // This is reported by `no-useless-concat`.
      var str = "Hello, " + "World!";

      When Not To Use It

      This rule should not be used in ES3/5 environments.

      In ES2015 (ES6) or later, if you don't want to be notified about string concatenation, you can safely disable this rule.

      Related Rules

      Operator '-' must be spaced.
      Open

                  for (var j = 0; j < numOutput-1; j++) {

      require spacing around infix operators (space-infix-ops)

      While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

      var sum = 1 + 2;

      The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

      var sum = i+++2;

      While this is valid JavaScript syntax, it is hard to determine what the author intended.

      Rule Details

      This rule is aimed at ensuring there are spaces around infix operators.

      Options

      This rule accepts a single options argument with the following defaults:

      "space-infix-ops": ["error", { "int32Hint": false }]

      int32Hint

      Set the int32Hint option to true (default is false) to allow write a|0 without space.

      var foo = bar|0; // `foo` is forced to be signed 32 bit integer

      Examples of incorrect code for this rule:

      /*eslint space-infix-ops: "error"*/
      /*eslint-env es6*/
      
      a+b
      
      a+ b
      
      a +b
      
      a?b:c
      
      const a={b:1};
      
      var {a=0}=bar;
      
      function foo(a=0) { }

      Examples of correct code for this rule:

      /*eslint space-infix-ops: "error"*/
      /*eslint-env es6*/
      
      a + b
      
      a       + b
      
      a ? b : c
      
      const a = {b:1};
      
      var {a = 0} = bar;
      
      function foo(a = 0) { }

      When Not To Use It

      You can turn this rule off if you are not concerned with the consistency of spacing around infix operators. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                      output += "    out" + j + " = 0;\n";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                  output += "  end\n";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Unexpected unnamed function.
      Open

              this.changeControlSignalSize = function (size) {

      Require or disallow named function expressions (func-names)

      A pattern that's becoming more common is to give function expressions names to aid in debugging. For example:

      Foo.prototype.bar = function bar() {};

      Adding the second bar in the above example is optional. If you leave off the function name then when the function throws an exception you are likely to get something similar to anonymous function in the stack trace. If you provide the optional name for a function expression then you will get the name of the function expression in the stack trace.

      Rule Details

      This rule can enforce or disallow the use of named function expressions.

      Options

      This rule has a string option:

      • "always" (default) requires function expressions to have a name
      • "as-needed" requires function expressions to have a name, if the name cannot be assigned automatically in an ES6 environment
      • "never" disallows named function expressions, except in recursive functions, where a name is needed

      This rule has an object option:

      • "generators": "always" | "as-needed" | "never"
        • "always" require named generators
        • "as-needed" require named generators if the name cannot be assigned automatically in an ES6 environment.
        • "never" disallow named generators where possible.

      When a value for generators is not provided the behavior for generator functions falls back to the base option.

      Please note that "always" and "as-needed" require function expressions and function declarations in export default declarations to have a name.

      always

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

      /*eslint func-names: ["error", "always"]*/
      
      Foo.prototype.bar = function() {};
      
      const cat = {
        meow: function() {}
      }
      
      (function() {
          // ...
      }())
      
      export default function() {}

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

      /*eslint func-names: ["error", "always"]*/
      
      Foo.prototype.bar = function bar() {};
      
      const cat = {
        meow() {}
      }
      
      (function bar() {
          // ...
      }())
      
      export default function foo() {}

      as-needed

      ECMAScript 6 introduced a name property on all functions. The value of name is determined by evaluating the code around the function to see if a name can be inferred. For example, a function assigned to a variable will automatically have a name property equal to the name of the variable. The value of name is then used in stack traces for easier debugging.

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

      /*eslint func-names: ["error", "as-needed"]*/
      
      Foo.prototype.bar = function() {};
      
      (function() {
          // ...
      }())
      
      export default function() {}

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

      /*eslint func-names: ["error", "as-needed"]*/
      
      var bar = function() {};
      
      const cat = {
        meow: function() {}
      }
      
      (function bar() {
          // ...
      }())
      
      export default function foo() {}

      never

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

      /*eslint func-names: ["error", "never"]*/
      
      Foo.prototype.bar = function bar() {};
      
      (function bar() {
          // ...
      }())

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

      /*eslint func-names: ["error", "never"]*/
      
      Foo.prototype.bar = function() {};
      
      (function() {
          // ...
      }())

      generators

      Examples of incorrect code for this rule with the "always", { "generators": "as-needed" } options:

      /*eslint func-names: ["error", "always", { "generators": "as-needed" }]*/
      
      (function*() {
          // ...
      }())

      Examples of correct code for this rule with the "always", { "generators": "as-needed" } options:

      /*eslint func-names: ["error", "always", { "generators": "as-needed" }]*/
      
      var foo = function*() {};

      Examples of incorrect code for this rule with the "always", { "generators": "never" } options:

      /*eslint func-names: ["error", "always", { "generators": "never" }]*/
      
      var foo = bar(function *baz() {});

      Examples of correct code for this rule with the "always", { "generators": "never" } options:

      /*eslint func-names: ["error", "always", { "generators": "never" }]*/
      
      var foo = bar(function *() {});

      Examples of incorrect code for this rule with the "as-needed", { "generators": "never" } options:

      /*eslint func-names: ["error", "as-needed", { "generators": "never" }]*/
      
      var foo = bar(function *baz() {});

      Examples of correct code for this rule with the "as-needed", { "generators": "never" } options:

      /*eslint func-names: ["error", "as-needed", { "generators": "never" }]*/
      
      var foo = bar(function *() {});

      Examples of incorrect code for this rule with the "never", { "generators": "always" } options:

      /*eslint func-names: ["error", "never", { "generators": "always" }]*/
      
      var foo = bar(function *() {});

      Examples of correct code for this rule with the "never", { "generators": "always" } options:

      /*eslint func-names: ["error", "never", { "generators": "always" }]*/
      
      var foo = bar(function *baz() {});

      Further Reading

      Compatibility

      Strings must use singlequote.
      Open

                  else if (this.direction === "UP")

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Expected exception block, space or tab after '//' in comment.
      Open

          //this code to generate Verilog

      Requires or disallows a whitespace (space or tab) beginning a comment (spaced-comment)

      Some style guides require or disallow a whitespace immediately after the initial // or /* of a comment. Whitespace after the // or /* makes it easier to read text in comments. On the other hand, commenting out code is easier without having to put a whitespace right after the // or /*.

      Rule Details

      This rule will enforce consistency of spacing after the start of a comment // or /*. It also provides several exceptions for various documentation styles.

      Options

      The rule takes two options.

      • The first is a string which be either "always" or "never". The default is "always".

        • If "always" then the // or /* must be followed by at least one whitespace.
        • If "never" then there should be no whitespace following.
      • This rule can also take a 2nd option, an object with any of the following keys: "exceptions" and "markers".

        • The "exceptions" value is an array of string patterns which are considered exceptions to the rule. The rule will not warn when the pattern starts from the beginning of the comment and repeats until the end of the line or */ if the comment is a single line comment. Please note that exceptions are ignored if the first argument is "never".
        "spaced-comment": ["error", "always", { "exceptions": ["-", "+"] }]
        • The "markers" value is an array of string patterns which are considered markers for docblock-style comments, such as an additional /, used to denote documentation read by doxygen, vsdoc, etc. which must have additional characters. The "markers" array will apply regardless of the value of the first argument, e.g. "always" or "never".
        "spaced-comment": ["error", "always", { "markers": ["/"] }]

      The difference between a marker and an exception is that a marker only appears at the beginning of the comment whereas exceptions can occur anywhere in the comment string.

      You can also define separate exceptions and markers for block and line comments. The "block" object can have an additional key "balanced", a boolean that specifies if inline block comments should have balanced spacing. The default value is false.

      • If "balanced": true and "always" then the /* must be followed by at least one whitespace, and the */ must be preceded by at least one whitespace.

      • If "balanced": true and "never" then there should be no whitespace following /* or preceding */.

      • If "balanced": false then balanced whitespace is not enforced.

      "spaced-comment": ["error", "always", {
          "line": {
              "markers": ["/"],
              "exceptions": ["-", "+"]
          },
          "block": {
              "markers": ["!"],
              "exceptions": ["*"],
              "balanced": true
          }
      }]

      always

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

      /*eslint spaced-comment: ["error", "always"]*/
      
      //This is a comment with no whitespace at the beginning
      
      /*This is a comment with no whitespace at the beginning */
      /* eslint spaced-comment: ["error", "always", { "block": { "balanced": true } }] */
      /* This is a comment with whitespace at the beginning but not the end*/

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

      /* eslint spaced-comment: ["error", "always"] */
      
      // This is a comment with a whitespace at the beginning
      
      /* This is a comment with a whitespace at the beginning */
      
      /*
       * This is a comment with a whitespace at the beginning
       */
      
      /*
      This comment has a newline
      */
      /* eslint spaced-comment: ["error", "always"] */
      
      /**
      * I am jsdoc
      */

      never

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

      /*eslint spaced-comment: ["error", "never"]*/
      
      // This is a comment with a whitespace at the beginning
      
      /* This is a comment with a whitespace at the beginning */
      
      /* \nThis is a comment with a whitespace at the beginning */
      /*eslint spaced-comment: ["error", "never", { "block": { "balanced": true } }]*/
      /*This is a comment with whitespace at the end */

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

      /*eslint spaced-comment: ["error", "never"]*/
      
      /*This is a comment with no whitespace at the beginning */
      /*eslint spaced-comment: ["error", "never"]*/
      
      /**
      * I am jsdoc
      */

      exceptions

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

      /* eslint spaced-comment: ["error", "always", { "block": { "exceptions": ["-"] } }] */
      
      //--------------
      // Comment block
      //--------------
      /* eslint spaced-comment: ["error", "always", { "exceptions": ["-", "+"] }] */
      
      //------++++++++
      // Comment block
      //------++++++++
      /* eslint spaced-comment: ["error", "always", { "exceptions": ["-", "+"] }] */
      
      /*------++++++++*/
      /* Comment block */
      /*------++++++++*/
      /* eslint spaced-comment: ["error", "always", { "line": { "exceptions": ["-+"] } }] */
      
      /*-+-+-+-+-+-+-+*/
      // Comment block
      /*-+-+-+-+-+-+-+*/
      /* eslint spaced-comment: ["error", "always", { "block": { "exceptions": ["*"] } }] */
      
      /******** COMMENT *******/

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

      /* eslint spaced-comment: ["error", "always", { "exceptions": ["-"] }] */
      
      //--------------
      // Comment block
      //--------------
      /* eslint spaced-comment: ["error", "always", { "line": { "exceptions": ["-"] } }] */
      
      //--------------
      // Comment block
      //--------------
      /* eslint spaced-comment: ["error", "always", { "exceptions": ["*"] }] */
      
      /****************
       * Comment block
       ****************/
      /* eslint spaced-comment: ["error", "always", { "exceptions": ["-+"] }] */
      
      //-+-+-+-+-+-+-+
      // Comment block
      //-+-+-+-+-+-+-+
      
      /*-+-+-+-+-+-+-+*/
      // Comment block
      /*-+-+-+-+-+-+-+*/
      /* eslint spaced-comment: ["error", "always", { "block": { "exceptions": ["-+"] } }] */
      
      /*-+-+-+-+-+-+-+*/
      // Comment block
      /*-+-+-+-+-+-+-+*/
      /* eslint spaced-comment: ["error", "always", { "block": { "exceptions": ["*"] } }] */
      
      /***************/
      
      /********
      COMMENT
      *******/

      markers

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

      /* eslint spaced-comment: ["error", "always", { "markers": ["/"] }] */
      
      ///This is a comment with a marker but without whitespace
      /*eslint spaced-comment: ["error", "always", { "block": { "markers": ["!"], "balanced": true } }]*/
      /*! This is a comment with a marker but without whitespace at the end*/
      /*eslint spaced-comment: ["error", "never", { "block": { "markers": ["!"], "balanced": true } }]*/
      /*!This is a comment with a marker but with whitespace at the end */

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

      /* eslint spaced-comment: ["error", "always", { "markers": ["/"] }] */
      
      /// This is a comment with a marker
      /*eslint spaced-comment: ["error", "never", { "markers": ["!<"] }]*/
      
      //!<this is a line comment with marker block subsequent lines are ignored></this>
      /* eslint spaced-comment: ["error", "always", { "markers": ["global"] }] */
      
      /*global ABC*/

      Related Rules

      Operator '-' must be spaced.
      Open

                  output += "out" + (numOutput-1) + ";\n";

      require spacing around infix operators (space-infix-ops)

      While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

      var sum = 1 + 2;

      The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

      var sum = i+++2;

      While this is valid JavaScript syntax, it is hard to determine what the author intended.

      Rule Details

      This rule is aimed at ensuring there are spaces around infix operators.

      Options

      This rule accepts a single options argument with the following defaults:

      "space-infix-ops": ["error", { "int32Hint": false }]

      int32Hint

      Set the int32Hint option to true (default is false) to allow write a|0 without space.

      var foo = bar|0; // `foo` is forced to be signed 32 bit integer

      Examples of incorrect code for this rule:

      /*eslint space-infix-ops: "error"*/
      /*eslint-env es6*/
      
      a+b
      
      a+ b
      
      a +b
      
      a?b:c
      
      const a={b:1};
      
      var {a=0}=bar;
      
      function foo(a=0) { }

      Examples of correct code for this rule:

      /*eslint space-infix-ops: "error"*/
      /*eslint-env es6*/
      
      a + b
      
      a       + b
      
      a ? b : c
      
      const a = {b:1};
      
      var {a = 0} = bar;
      
      function foo(a = 0) { }

      When Not To Use It

      You can turn this rule off if you are not concerned with the consistency of spacing around infix operators. Source: http://eslint.org/docs/rules/

      Expected exception block, space or tab after '//' in comment.
      Open

          //reset the sized before Verilog generation

      Requires or disallows a whitespace (space or tab) beginning a comment (spaced-comment)

      Some style guides require or disallow a whitespace immediately after the initial // or /* of a comment. Whitespace after the // or /* makes it easier to read text in comments. On the other hand, commenting out code is easier without having to put a whitespace right after the // or /*.

      Rule Details

      This rule will enforce consistency of spacing after the start of a comment // or /*. It also provides several exceptions for various documentation styles.

      Options

      The rule takes two options.

      • The first is a string which be either "always" or "never". The default is "always".

        • If "always" then the // or /* must be followed by at least one whitespace.
        • If "never" then there should be no whitespace following.
      • This rule can also take a 2nd option, an object with any of the following keys: "exceptions" and "markers".

        • The "exceptions" value is an array of string patterns which are considered exceptions to the rule. The rule will not warn when the pattern starts from the beginning of the comment and repeats until the end of the line or */ if the comment is a single line comment. Please note that exceptions are ignored if the first argument is "never".
        "spaced-comment": ["error", "always", { "exceptions": ["-", "+"] }]
        • The "markers" value is an array of string patterns which are considered markers for docblock-style comments, such as an additional /, used to denote documentation read by doxygen, vsdoc, etc. which must have additional characters. The "markers" array will apply regardless of the value of the first argument, e.g. "always" or "never".
        "spaced-comment": ["error", "always", { "markers": ["/"] }]

      The difference between a marker and an exception is that a marker only appears at the beginning of the comment whereas exceptions can occur anywhere in the comment string.

      You can also define separate exceptions and markers for block and line comments. The "block" object can have an additional key "balanced", a boolean that specifies if inline block comments should have balanced spacing. The default value is false.

      • If "balanced": true and "always" then the /* must be followed by at least one whitespace, and the */ must be preceded by at least one whitespace.

      • If "balanced": true and "never" then there should be no whitespace following /* or preceding */.

      • If "balanced": false then balanced whitespace is not enforced.

      "spaced-comment": ["error", "always", {
          "line": {
              "markers": ["/"],
              "exceptions": ["-", "+"]
          },
          "block": {
              "markers": ["!"],
              "exceptions": ["*"],
              "balanced": true
          }
      }]

      always

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

      /*eslint spaced-comment: ["error", "always"]*/
      
      //This is a comment with no whitespace at the beginning
      
      /*This is a comment with no whitespace at the beginning */
      /* eslint spaced-comment: ["error", "always", { "block": { "balanced": true } }] */
      /* This is a comment with whitespace at the beginning but not the end*/

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

      /* eslint spaced-comment: ["error", "always"] */
      
      // This is a comment with a whitespace at the beginning
      
      /* This is a comment with a whitespace at the beginning */
      
      /*
       * This is a comment with a whitespace at the beginning
       */
      
      /*
      This comment has a newline
      */
      /* eslint spaced-comment: ["error", "always"] */
      
      /**
      * I am jsdoc
      */

      never

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

      /*eslint spaced-comment: ["error", "never"]*/
      
      // This is a comment with a whitespace at the beginning
      
      /* This is a comment with a whitespace at the beginning */
      
      /* \nThis is a comment with a whitespace at the beginning */
      /*eslint spaced-comment: ["error", "never", { "block": { "balanced": true } }]*/
      /*This is a comment with whitespace at the end */

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

      /*eslint spaced-comment: ["error", "never"]*/
      
      /*This is a comment with no whitespace at the beginning */
      /*eslint spaced-comment: ["error", "never"]*/
      
      /**
      * I am jsdoc
      */

      exceptions

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

      /* eslint spaced-comment: ["error", "always", { "block": { "exceptions": ["-"] } }] */
      
      //--------------
      // Comment block
      //--------------
      /* eslint spaced-comment: ["error", "always", { "exceptions": ["-", "+"] }] */
      
      //------++++++++
      // Comment block
      //------++++++++
      /* eslint spaced-comment: ["error", "always", { "exceptions": ["-", "+"] }] */
      
      /*------++++++++*/
      /* Comment block */
      /*------++++++++*/
      /* eslint spaced-comment: ["error", "always", { "line": { "exceptions": ["-+"] } }] */
      
      /*-+-+-+-+-+-+-+*/
      // Comment block
      /*-+-+-+-+-+-+-+*/
      /* eslint spaced-comment: ["error", "always", { "block": { "exceptions": ["*"] } }] */
      
      /******** COMMENT *******/

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

      /* eslint spaced-comment: ["error", "always", { "exceptions": ["-"] }] */
      
      //--------------
      // Comment block
      //--------------
      /* eslint spaced-comment: ["error", "always", { "line": { "exceptions": ["-"] } }] */
      
      //--------------
      // Comment block
      //--------------
      /* eslint spaced-comment: ["error", "always", { "exceptions": ["*"] }] */
      
      /****************
       * Comment block
       ****************/
      /* eslint spaced-comment: ["error", "always", { "exceptions": ["-+"] }] */
      
      //-+-+-+-+-+-+-+
      // Comment block
      //-+-+-+-+-+-+-+
      
      /*-+-+-+-+-+-+-+*/
      // Comment block
      /*-+-+-+-+-+-+-+*/
      /* eslint spaced-comment: ["error", "always", { "block": { "exceptions": ["-+"] } }] */
      
      /*-+-+-+-+-+-+-+*/
      // Comment block
      /*-+-+-+-+-+-+-+*/
      /* eslint spaced-comment: ["error", "always", { "block": { "exceptions": ["*"] } }] */
      
      /***************/
      
      /********
      COMMENT
      *******/

      markers

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

      /* eslint spaced-comment: ["error", "always", { "markers": ["/"] }] */
      
      ///This is a comment with a marker but without whitespace
      /*eslint spaced-comment: ["error", "always", { "block": { "markers": ["!"], "balanced": true } }]*/
      /*! This is a comment with a marker but without whitespace at the end*/
      /*eslint spaced-comment: ["error", "never", { "block": { "markers": ["!"], "balanced": true } }]*/
      /*!This is a comment with a marker but with whitespace at the end */

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

      /* eslint spaced-comment: ["error", "always", { "markers": ["/"] }] */
      
      /// This is a comment with a marker
      /*eslint spaced-comment: ["error", "never", { "markers": ["!<"] }]*/
      
      //!<this is a line comment with marker block subsequent lines are ignored></this>
      /* eslint spaced-comment: ["error", "always", { "markers": ["global"] }] */
      
      /*global ABC*/

      Related Rules

      Strings must use singlequote.
      Open

                      min: "1",

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Expected no linebreak before this statement.
      Open

                      fillText(

      enforce the location of single-line statements (nonblock-statement-body-position)

      When writing if, else, while, do-while, and for statements, the body can be a single statement instead of a block. It can be useful to enforce a consistent location for these single statements.

      For example, some developers avoid writing code like this:

      if (foo)
        bar();

      If another developer attempts to add baz(); to the if statement, they might mistakenly change the code to

      if (foo)
        bar();
        baz(); // this line is not in the `if` statement!

      To avoid this issue, one might require all single-line if statements to appear directly after the conditional, without a linebreak:

      if (foo) bar();

      Rule Details

      This rule aims to enforce a consistent location for single-line statements.

      Note that this rule does not enforce the usage of single-line statements in general. If you would like to disallow single-line statements, use the curly rule instead.

      Options

      This rule accepts a string option:

      • "beside" (default) disallows a newline before a single-line statement.
      • "below" requires a newline before a single-line statement.
      • "any" does not enforce the position of a single-line statement.

      Additionally, the rule accepts an optional object option with an "overrides" key. This can be used to specify a location for particular statements that override the default. For example:

      • "beside", { "overrides": { "while": "below" } } requires all single-line statements to appear on the same line as their parent, unless the parent is a while statement, in which case the single-line statement must not be on the same line.
      • "below", { "overrides": { "do": "any" } } disallows all single-line statements from appearing on the same line as their parent, unless the parent is a do-while statement, in which case the position of the single-line statement is not enforced.

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

      /* eslint nonblock-statement-body-position: ["error", "beside"] */
      
      if (foo)
        bar();
      else
        baz();
      
      while (foo)
        bar();
      
      for (let i = 1; i < foo; i++)
        bar();
      
      do
        bar();
      while (foo)

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

      /* eslint nonblock-statement-body-position: ["error", "beside"] */
      
      if (foo) bar();
      else baz();
      
      while (foo) bar();
      
      for (let i = 1; i < foo; i++) bar();
      
      do bar(); while (foo)
      
      if (foo) { // block statements are always allowed with this rule
        bar();
      } else {
        baz();
      }

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

      /* eslint nonblock-statement-body-position: ["error", "below"] */
      
      if (foo) bar();
      else baz();
      
      while (foo) bar();
      
      for (let i = 1; i < foo; i++) bar();
      
      do bar(); while (foo)

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

      /* eslint nonblock-statement-body-position: ["error", "below"] */
      
      if (foo)
        bar();
      else
        baz();
      
      while (foo)
        bar();
      
      for (let i = 1; i < foo; i++)
        bar();
      
      do
        bar();
      while (foo)
      
      if (foo) {
        // Although the second `if` statement is on the same line as the `else`, this is a very common
        // pattern, so it's not checked by this rule.
      } else if (bar) {
      }

      Examples of incorrect code for this rule with the "beside", { "overrides": { "while": "below" } } rule:

      /* eslint nonblock-statement-body-position: ["error", "beside", { "overrides": { "while": "below" } }] */
      
      if (foo)
        bar();
      
      while (foo) bar();

      Examples of correct code for this rule with the "beside", { "overrides": { "while": "below" } } rule:

      /* eslint nonblock-statement-body-position: ["error", "beside", { "overrides": { "while": "below" } }] */
      
      if (foo) bar();
      
      while (foo)
        bar();

      When Not To Use It

      If you're not concerned about consistent locations of single-line statements, you should not turn on this rule. You can also disable this rule if you're using the "all" option for the curly rule, because this will disallow single-line statements entirely.

      Further Reading

      Expected { after 'if' condition.
      Open

                  else if (this.direction === "UP")

      Require Following Curly Brace Conventions (curly)

      JavaScript allows the omission of curly braces when a block contains only one statement. However, it is considered by many to be best practice to never omit curly braces around blocks, even when they are optional, because it can lead to bugs and reduces code clarity. So the following:

      if (foo) foo++;

      Can be rewritten as:

      if (foo) {
          foo++;
      }

      There are, however, some who prefer to only use braces when there is more than one statement to be executed.

      Rule Details

      This rule is aimed at preventing bugs and increasing code clarity by ensuring that block statements are wrapped in curly braces. It will warn when it encounters blocks that omit curly braces.

      Options

      all

      Examples of incorrect code for the default "all" option:

      /*eslint curly: "error"*/
      
      if (foo) foo++;
      
      while (bar)
          baz();
      
      if (foo) {
          baz();
      } else qux();

      Examples of correct code for the default "all" option:

      /*eslint curly: "error"*/
      
      if (foo) {
          foo++;
      }
      
      while (bar) {
          baz();
      }
      
      if (foo) {
          baz();
      } else {
          qux();
      }

      multi

      By default, this rule warns whenever if, else, for, while, or do are used without block statements as their body. However, you can specify that block statements should be used only when there are multiple statements in the block and warn when there is only one statement in the block.

      Examples of incorrect code for the "multi" option:

      /*eslint curly: ["error", "multi"]*/
      
      if (foo) {
          foo++;
      }
      
      if (foo) bar();
      else {
          foo++;
      }
      
      while (true) {
          doSomething();
      }
      
      for (var i=0; i < items.length; i++) {
          doSomething();
      }

      Examples of correct code for the "multi" option:

      /*eslint curly: ["error", "multi"]*/
      
      if (foo) foo++;
      
      else foo();
      
      while (true) {
          doSomething();
          doSomethingElse();
      }

      multi-line

      Alternatively, you can relax the rule to allow brace-less single-line if, else if, else, for, while, or do, while still enforcing the use of curly braces for other instances.

      Examples of incorrect code for the "multi-line" option:

      /*eslint curly: ["error", "multi-line"]*/
      
      if (foo)
        doSomething();
      else
        doSomethingElse();
      
      if (foo) foo(
        bar,
        baz);

      Examples of correct code for the "multi-line" option:

      /*eslint curly: ["error", "multi-line"]*/
      
      if (foo) foo++; else doSomething();
      
      if (foo) foo++;
      else if (bar) baz()
      else doSomething();
      
      do something();
      while (foo);
      
      while (foo
        && bar) baz();
      
      if (foo) {
          foo++;
      }
      
      if (foo) { foo++; }
      
      while (true) {
          doSomething();
          doSomethingElse();
      }

      multi-or-nest

      You can use another configuration that forces brace-less if, else if, else, for, while, or do if their body contains only one single-line statement. And forces braces in all other cases.

      Examples of incorrect code for the "multi-or-nest" option:

      /*eslint curly: ["error", "multi-or-nest"]*/
      
      if (!foo)
          foo = {
              bar: baz,
              qux: foo
          };
      
      while (true)
        if(foo)
            doSomething();
        else
            doSomethingElse();
      
      if (foo) {
          foo++;
      }
      
      while (true) {
          doSomething();
      }
      
      for (var i = 0; foo; i++) {
          doSomething();
      }

      Examples of correct code for the "multi-or-nest" option:

      /*eslint curly: ["error", "multi-or-nest"]*/
      
      if (!foo) {
          foo = {
              bar: baz,
              qux: foo
          };
      }
      
      while (true) {
        if(foo)
            doSomething();
        else
            doSomethingElse();
      }
      
      if (foo)
          foo++;
      
      while (true)
          doSomething();
      
      for (var i = 0; foo; i++)
          doSomething();

      For single-line statements preceded by a comment, braces are allowed but not required.

      Examples of additional correct code for the "multi-or-nest" option:

      /*eslint curly: ["error", "multi-or-nest"]*/
      
      if (foo)
          // some comment
          bar();
      
      if (foo) {
          // some comment
          bar();
      }

      consistent

      When using any of the multi* options, you can add an option to enforce all bodies of a if, else if and else chain to be with or without braces.

      Examples of incorrect code for the "multi", "consistent" options:

      /*eslint curly: ["error", "multi", "consistent"]*/
      
      if (foo) {
          bar();
          baz();
      } else
          buz();
      
      if (foo)
          bar();
      else if (faa)
          bor();
      else {
          other();
          things();
      }
      
      if (true)
          foo();
      else {
          baz();
      }
      
      if (foo) {
          foo++;
      }

      Examples of correct code for the "multi", "consistent" options:

      /*eslint curly: ["error", "multi", "consistent"]*/
      
      if (foo) {
          bar();
          baz();
      } else {
          buz();
      }
      
      if (foo) {
          bar();
      } else if (faa) {
          bor();
      } else {
          other();
          things();
      }
      
      if (true)
          foo();
      else
          baz();
      
      if (foo)
          foo++;

      When Not To Use It

      If you have no strict conventions about when to use block statements and when not to, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                  output += "  output reg [WIDTH-1:0] ";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Missing semicolon.
      Open

                  output += "  input [WIDTH-1:0] in;\n"

      require or disallow semicolons instead of ASI (semi)

      JavaScript doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

      var name = "ESLint"
      var website = "eslint.org";

      On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

      In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

      However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

      return
      {
          name: "ESLint"
      };

      This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

      return;
      {
          name: "ESLint";
      }

      Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

      On the other side of the argument are those who say that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

      var globalCounter = { }
      
      (function () {
          var n = 0
          globalCounter.increment = function () {
              return ++n
          }
      })()

      In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

      Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

      1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
      2. The line is -- or ++ (in which case it will decrement/increment the next token.)
      3. It is a for(), while(), do, if(), or else, and there is no {
      4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

      Rule Details

      This rule enforces consistent use of semicolons.

      Options

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

      String option:

      • "always" (default) requires semicolons at the end of statements
      • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

      Object option (when "always"):

      • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

      Object option (when "never"):

      • "beforeStatementContinuationChars": "any" (default) ignores semicolons (or lacking semicolon) at the end of statements if the next line starts with [, (, /, +, or -.
      • "beforeStatementContinuationChars": "always" requires semicolons at the end of statements if the next line starts with [, (, /, +, or -.
      • "beforeStatementContinuationChars": "never" disallows semicolons as the end of statements if it doesn't make ASI hazard even if the next line starts with [, (, /, +, or -.

      always

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

      /*eslint semi: ["error", "always"]*/
      
      var name = "ESLint"
      
      object.method = function() {
          // ...
      }

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

      /*eslint semi: "error"*/
      
      var name = "ESLint";
      
      object.method = function() {
          // ...
      };

      never

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

      /*eslint semi: ["error", "never"]*/
      
      var name = "ESLint";
      
      object.method = function() {
          // ...
      };

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

      /*eslint semi: ["error", "never"]*/
      
      var name = "ESLint"
      
      object.method = function() {
          // ...
      }
      
      var name = "ESLint"
      
      ;(function() {
          // ...
      })()
      
      import a from "a"
      (function() {
          // ...
      })()
      
      import b from "b"
      ;(function() {
          // ...
      })()

      omitLastInOneLineBlock

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

      /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
      
      if (foo) { bar() }
      
      if (foo) { bar(); baz() }

      beforeStatementContinuationChars

      Examples of additional incorrect code for this rule with the "never", { "beforeStatementContinuationChars": "always" } options:

      /*eslint semi: ["error", "never", { "beforeStatementContinuationChars": "always"}] */
      import a from "a"
      
      (function() {
          // ...
      })()

      Examples of additional incorrect code for this rule with the "never", { "beforeStatementContinuationChars": "never" } options:

      /*eslint semi: ["error", "never", { "beforeStatementContinuationChars": "never"}] */
      import a from "a"
      
      ;(function() {
          // ...
      })()

      When Not To Use It

      If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

      Further Reading

      Related Rules

      • [no-extra-semi](no-extra-semi.md)
      • [no-unexpected-multiline](no-unexpected-multiline.md)
      • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

      import CircuitElement from "../circuitElement";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                  output += "in, sel);\n";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                  output += "out" + (numOutput-1) + ";\n";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                  output += "  always @ (*) begin\n";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                      output += "out" + j + ", ";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                  output += "  input [" + (size-1) +":0] sel;\n";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                  output += "    case (sel)\n";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Unexpected string concatenation.
      Open

                      output += "      " + j + " : out" + j + " = in;\n";

      Suggest using template literals instead of string concatenation. (prefer-template)

      In ES2015 (ES6), we can use template literals instead of string concatenation.

      var str = "Hello, " + name + "!";
      /*eslint-env es6*/
      
      var str = `Hello, ${name}!`;

      Rule Details

      This rule is aimed to flag usage of + operators with strings.

      Examples

      Examples of incorrect code for this rule:

      /*eslint prefer-template: "error"*/
      
      var str = "Hello, " + name + "!";
      var str = "Time: " + (12 * 60 * 60 * 1000);

      Examples of correct code for this rule:

      /*eslint prefer-template: "error"*/
      /*eslint-env es6*/
      
      var str = "Hello World!";
      var str = `Hello, ${name}!`;
      var str = `Time: ${12 * 60 * 60 * 1000}`;
      
      // This is reported by `no-useless-concat`.
      var str = "Hello, " + "World!";

      When Not To Use It

      This rule should not be used in ES3/5 environments.

      In ES2015 (ES6) or later, if you don't want to be notified about string concatenation, you can safely disable this rule.

      Related Rules

      Strings must use singlequote.
      Open

                      output += "      " + j + " : out" + j + " = in;\n";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

                      output += "      " + j + " : out" + j + " = in;\n";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Strings must use singlequote.
      Open

          "DeMultiplexer ToolTip : Multiple outputs and a single line input.";

      enforce the consistent use of either backticks, double, or single quotes (quotes)

      JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

      /*eslint-env es6*/
      
      var double = "double";
      var single = 'single';
      var backtick = `backtick`;    // ES6 only

      Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

      Many codebases require strings to be defined in a consistent manner.

      Rule Details

      This rule enforces the consistent use of either backticks, double, or single quotes.

      Options

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

      String option:

      • "double" (default) requires the use of double quotes wherever possible
      • "single" requires the use of single quotes wherever possible
      • "backtick" requires the use of backticks wherever possible

      Object option:

      • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
      • "allowTemplateLiterals": true allows strings to use backticks

      Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

      double

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

      /*eslint quotes: ["error", "double"]*/
      
      var single = 'single';
      var unescaped = 'a string containing "double" quotes';
      var backtick = `back\ntick`; // you can use \n in single or double quoted strings

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

      /*eslint quotes: ["error", "double"]*/
      /*eslint-env es6*/
      
      var double = "double";
      var backtick = `back
      tick`;  // backticks are allowed due to newline
      var backtick = tag`backtick`; // backticks are allowed due to tag

      single

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

      /*eslint quotes: ["error", "single"]*/
      
      var double = "double";
      var unescaped = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "single"]*/
      /*eslint-env es6*/
      
      var single = 'single';
      var backtick = `back${x}tick`; // backticks are allowed due to substitution

      backticks

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

      /*eslint quotes: ["error", "backtick"]*/
      
      var single = 'single';
      var double = "double";
      var unescaped = 'a string containing `backticks`';

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

      /*eslint quotes: ["error", "backtick"]*/
      /*eslint-env es6*/
      
      var backtick = `backtick`;

      avoidEscape

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

      /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
      
      var single = 'a string containing "double" quotes';

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

      /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
      
      var double = "a string containing 'single' quotes";

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

      /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
      
      var double = "a string containing `backtick` quotes"

      allowTemplateLiterals

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

      /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
      
      var double = "double";
      var double = `double`;

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

      /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
      
      var single = 'single';
      var single = `single`;

      { "allowTemplateLiterals": false } will not disallow the usage of all template literals. If you want to forbid any instance of template literals, use no-restricted-syntax and target the TemplateLiteral selector.

      When Not To Use It

      If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      There should be no line break before or after '='.
      Open

      Demultiplexer.prototype.helplink =

      enforce consistent linebreak style for operators (operator-linebreak)

      When a statement is too long to fit on a single line, line breaks are generally inserted next to the operators separating expressions. The first style coming to mind would be to place the operator at the end of the line, following the English punctuation rules.

      var fullHeight = borderTop +
                       innerHeight +
                       borderBottom;

      Some developers find that placing operators at the beginning of the line makes the code more readable.

      var fullHeight = borderTop
                     + innerHeight
                     + borderBottom;

      Rule Details

      This rule enforces a consistent linebreak style for operators.

      Options

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

      String option:

      • "after" requires linebreaks to be placed after the operator
      • "before" requires linebreaks to be placed before the operator
      • "none" disallows linebreaks on either side of the operator

      Object option:

      • "overrides" overrides the global setting for specified operators

      The default configuration is "after", { "overrides": { "?": "before", ":": "before" } }

      after

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

      /*eslint operator-linebreak: ["error", "after"]*/
      
      foo = 1
      +
      2;
      
      foo = 1
          + 2;
      
      foo
          = 5;
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;

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

      /*eslint operator-linebreak: ["error", "after"]*/
      
      foo = 1 + 2;
      
      foo = 1 +
            2;
      
      foo =
          5;
      
      if (someCondition ||
          otherCondition) {
      }
      
      answer = everything ?
        42 :
        foo;

      before

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

      /*eslint operator-linebreak: ["error", "before"]*/
      
      foo = 1 +
            2;
      
      foo =
          5;
      
      if (someCondition ||
          otherCondition) {
      }
      
      answer = everything ?
        42 :
        foo;

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

      /*eslint operator-linebreak: ["error", "before"]*/
      
      foo = 1 + 2;
      
      foo = 1
          + 2;
      
      foo
          = 5;
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;

      none

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

      /*eslint operator-linebreak: ["error", "none"]*/
      
      foo = 1 +
            2;
      
      foo = 1
          + 2;
      
      if (someCondition ||
          otherCondition) {
      }
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;
      
      answer = everything ?
        42 :
        foo;

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

      /*eslint operator-linebreak: ["error", "none"]*/
      
      foo = 1 + 2;
      
      foo = 5;
      
      if (someCondition || otherCondition) {
      }
      
      answer = everything ? 42 : foo;

      overrides

      Examples of additional incorrect code for this rule with the { "overrides": { "+=": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "+=": "before" } }]*/
      
      var thing = 'thing';
      thing +=
        's';

      Examples of additional correct code for this rule with the { "overrides": { "+=": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "+=": "before" } }]*/
      
      var thing = 'thing';
      thing
        += 's';

      Examples of additional correct code for this rule with the { "overrides": { "?": "ignore", ":": "ignore" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "?": "ignore", ":": "ignore" } }]*/
      
      answer = everything ?
        42
        : foo;
      
      answer = everything
        ?
        42
        :
        foo;

      Examples of incorrect code for this rule with the default "after", { "overrides": { "?": "before", ":": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "?": "before", ":": "before" } }]*/
      
      foo = 1
      +
      2;
      
      foo = 1
          + 2;
      
      foo
          = 5;
      
      if (someCondition
          || otherCondition) {
      }
      
      answer = everything ?
        42 :
        foo;

      Examples of correct code for this rule with the default "after", { "overrides": { "?": "before", ":": "before" } } option:

      /*eslint operator-linebreak: ["error", "after", { "overrides": { "?": "before", ":": "before" } }]*/
      
      foo = 1 + 2;
      
      foo = 1 +
            2;
      
      foo =
          5;
      
      if (someCondition ||
          otherCondition) {
      }
      
      answer = everything
        ? 42
        : foo;

      When Not To Use It

      If your project will not be using a common operator line break style, turn this rule off.

      Related Rules

      'j' used outside of binding context.
      Open

                      output += "out" + j + ", ";

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput-1; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                      output += "      " + j + " : out" + j + " = in;\n";

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      Missing trailing comma.
      Open

                      this

      require or disallow trailing commas (comma-dangle)

      Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

      var foo = {
          bar: "baz",
          qux: "quux",
      };

      Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

      Less clear:

      var foo = {
      -    bar: "baz",
      -    qux: "quux"
      +    bar: "baz"
       };

      More clear:

      var foo = {
           bar: "baz",
      -    qux: "quux",
       };

      Rule Details

      This rule enforces consistent use of trailing commas in object and array literals.

      Options

      This rule has a string option or an object option:

      {
          "comma-dangle": ["error", "never"],
          // or
          "comma-dangle": ["error", {
              "arrays": "never",
              "objects": "never",
              "imports": "never",
              "exports": "never",
              "functions": "never"
          }]
      }
      • "never" (default) disallows trailing commas
      • "always" requires trailing commas
      • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
      • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

      You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

      • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
      • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
      • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
      • exports is for export declarations of ES Modules. (e.g. export {a,};)
      • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
        • functions should only be enabled when linting ECMAScript 2017 or higher.

      never

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

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

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

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      always

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

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

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

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      always-multiline

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

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

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

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      only-multiline

      Examples of incorrect code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];

      Examples of correct code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      functions

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

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

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

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

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

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

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

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      When Not To Use It

      You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

      Missing trailing comma.
      Open

                  this.direction

      require or disallow trailing commas (comma-dangle)

      Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

      var foo = {
          bar: "baz",
          qux: "quux",
      };

      Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

      Less clear:

      var foo = {
      -    bar: "baz",
      -    qux: "quux"
      +    bar: "baz"
       };

      More clear:

      var foo = {
           bar: "baz",
      -    qux: "quux",
       };

      Rule Details

      This rule enforces consistent use of trailing commas in object and array literals.

      Options

      This rule has a string option or an object option:

      {
          "comma-dangle": ["error", "never"],
          // or
          "comma-dangle": ["error", {
              "arrays": "never",
              "objects": "never",
              "imports": "never",
              "exports": "never",
              "functions": "never"
          }]
      }
      • "never" (default) disallows trailing commas
      • "always" requires trailing commas
      • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
      • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

      You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

      • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
      • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
      • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
      • exports is for export declarations of ES Modules. (e.g. export {a,};)
      • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
        • functions should only be enabled when linting ECMAScript 2017 or higher.

      never

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

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

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

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      always

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

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

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

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      always-multiline

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

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

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

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      only-multiline

      Examples of incorrect code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];

      Examples of correct code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      functions

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

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

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

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

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

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

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

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      When Not To Use It

      You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      Unexpected prompt.
      Open

                  parseInt(prompt("Enter control signal bitWidth"), 10);

      Disallow Use of Alert (no-alert)

      JavaScript's alert, confirm, and prompt functions are widely considered to be obtrusive as UI elements and should be replaced by a more appropriate custom UI implementation. Furthermore, alert is often used while debugging code, which should be removed before deployment to production.

      alert("here!");

      Rule Details

      This rule is aimed at catching debugging code that should be removed and popup UI elements that should be replaced with less obtrusive, custom UIs. As such, it will warn when it encounters alert, prompt, and confirm function calls which are not shadowed.

      Examples of incorrect code for this rule:

      /*eslint no-alert: "error"*/
      
      alert("here!");
      
      confirm("Are you sure?");
      
      prompt("What's your name?", "John Doe");

      Examples of correct code for this rule:

      /*eslint no-alert: "error"*/
      
      customAlert("Something happened!");
      
      customConfirm("Are you sure?");
      
      customPrompt("Who are you?");
      
      function foo() {
          var alert = myCustomLib.customAlert;
          alert();
      }

      Related Rules

      Missing trailing comma.
      Open

                          10

      require or disallow trailing commas (comma-dangle)

      Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

      var foo = {
          bar: "baz",
          qux: "quux",
      };

      Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

      Less clear:

      var foo = {
      -    bar: "baz",
      -    qux: "quux"
      +    bar: "baz"
       };

      More clear:

      var foo = {
           bar: "baz",
      -    qux: "quux",
       };

      Rule Details

      This rule enforces consistent use of trailing commas in object and array literals.

      Options

      This rule has a string option or an object option:

      {
          "comma-dangle": ["error", "never"],
          // or
          "comma-dangle": ["error", {
              "arrays": "never",
              "objects": "never",
              "imports": "never",
              "exports": "never",
              "functions": "never"
          }]
      }
      • "never" (default) disallows trailing commas
      • "always" requires trailing commas
      • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
      • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

      You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

      • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
      • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
      • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
      • exports is for export declarations of ES Modules. (e.g. export {a,};)
      • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
        • functions should only be enabled when linting ECMAScript 2017 or higher.

      never

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

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

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

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      always

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

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

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

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      always-multiline

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

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

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

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      only-multiline

      Examples of incorrect code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];

      Examples of correct code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      functions

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

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

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

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

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

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

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

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      When Not To Use It

      You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

      Missing trailing comma.
      Open

                          10

      require or disallow trailing commas (comma-dangle)

      Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

      var foo = {
          bar: "baz",
          qux: "quux",
      };

      Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

      Less clear:

      var foo = {
      -    bar: "baz",
      -    qux: "quux"
      +    bar: "baz"
       };

      More clear:

      var foo = {
           bar: "baz",
      -    qux: "quux",
       };

      Rule Details

      This rule enforces consistent use of trailing commas in object and array literals.

      Options

      This rule has a string option or an object option:

      {
          "comma-dangle": ["error", "never"],
          // or
          "comma-dangle": ["error", {
              "arrays": "never",
              "objects": "never",
              "imports": "never",
              "exports": "never",
              "functions": "never"
          }]
      }
      • "never" (default) disallows trailing commas
      • "always" requires trailing commas
      • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
      • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

      You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

      • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
      • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
      • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
      • exports is for export declarations of ES Modules. (e.g. export {a,};)
      • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
        • functions should only be enabled when linting ECMAScript 2017 or higher.

      never

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

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

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

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      always

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

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

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

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      always-multiline

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

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

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

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      only-multiline

      Examples of incorrect code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];

      Examples of correct code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      functions

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

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

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

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

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

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

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

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      When Not To Use It

      You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput-1; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                      output += "out" + j + ", ";

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput-1; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                      output += "out" + j + ", ";

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                      output += "      " + j + " : out" + j + " = in;\n";

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput-1; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                      output += "    out" + j + " = 0;\n";

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                      output += "      " + j + " : out" + j + " = in;\n";

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      Missing trailing comma.
      Open

              controlSignalSize = 1

      require or disallow trailing commas (comma-dangle)

      Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

      var foo = {
          bar: "baz",
          qux: "quux",
      };

      Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

      Less clear:

      var foo = {
      -    bar: "baz",
      -    qux: "quux"
      +    bar: "baz"
       };

      More clear:

      var foo = {
           bar: "baz",
      -    qux: "quux",
       };

      Rule Details

      This rule enforces consistent use of trailing commas in object and array literals.

      Options

      This rule has a string option or an object option:

      {
          "comma-dangle": ["error", "never"],
          // or
          "comma-dangle": ["error", {
              "arrays": "never",
              "objects": "never",
              "imports": "never",
              "exports": "never",
              "functions": "never"
          }]
      }
      • "never" (default) disallows trailing commas
      • "always" requires trailing commas
      • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
      • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

      You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

      • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
      • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
      • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
      • exports is for export declarations of ES Modules. (e.g. export {a,};)
      • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
        • functions should only be enabled when linting ECMAScript 2017 or higher.

      never

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

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

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

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      always

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

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

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

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      always-multiline

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

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

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

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      only-multiline

      Examples of incorrect code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];

      Examples of correct code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      functions

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

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

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

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

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

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

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

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      When Not To Use It

      You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

      Missing trailing comma.
      Open

                  "Control Signal"

      require or disallow trailing commas (comma-dangle)

      Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

      var foo = {
          bar: "baz",
          qux: "quux",
      };

      Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

      Less clear:

      var foo = {
      -    bar: "baz",
      -    qux: "quux"
      +    bar: "baz"
       };

      More clear:

      var foo = {
           bar: "baz",
      -    qux: "quux",
       };

      Rule Details

      This rule enforces consistent use of trailing commas in object and array literals.

      Options

      This rule has a string option or an object option:

      {
          "comma-dangle": ["error", "never"],
          // or
          "comma-dangle": ["error", {
              "arrays": "never",
              "objects": "never",
              "imports": "never",
              "exports": "never",
              "functions": "never"
          }]
      }
      • "never" (default) disallows trailing commas
      • "always" requires trailing commas
      • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
      • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

      You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

      • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
      • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
      • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
      • exports is for export declarations of ES Modules. (e.g. export {a,};)
      • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
        • functions should only be enabled when linting ECMAScript 2017 or higher.

      never

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

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

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

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      always

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

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

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

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      always-multiline

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

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

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

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      only-multiline

      Examples of incorrect code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];

      Examples of correct code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      functions

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

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

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

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

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

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

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

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      When Not To Use It

      You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

      Missing trailing comma.
      Open

                  this.direction

      require or disallow trailing commas (comma-dangle)

      Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

      var foo = {
          bar: "baz",
          qux: "quux",
      };

      Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

      Less clear:

      var foo = {
      -    bar: "baz",
      -    qux: "quux"
      +    bar: "baz"
       };

      More clear:

      var foo = {
           bar: "baz",
      -    qux: "quux",
       };

      Rule Details

      This rule enforces consistent use of trailing commas in object and array literals.

      Options

      This rule has a string option or an object option:

      {
          "comma-dangle": ["error", "never"],
          // or
          "comma-dangle": ["error", {
              "arrays": "never",
              "objects": "never",
              "imports": "never",
              "exports": "never",
              "functions": "never"
          }]
      }
      • "never" (default) disallows trailing commas
      • "always" requires trailing commas
      • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
      • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

      You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

      • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
      • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
      • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
      • exports is for export declarations of ES Modules. (e.g. export {a,};)
      • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
        • functions should only be enabled when linting ECMAScript 2017 or higher.

      never

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

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

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

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      Examples of correct code for this rule with the "always" option:

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      always-multiline

      Examples of incorrect code for this rule with the "always-multiline" option:

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      Examples of correct code for this rule with the "always-multiline" option:

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      only-multiline

      Examples of incorrect code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];

      Examples of correct code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      functions

      Examples of incorrect code for this rule with the {"functions": "never"} option:

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      Examples of correct code for this rule with the {"functions": "never"} option:

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

      Examples of incorrect code for this rule with the {"functions": "always"} option:

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

      Examples of correct code for this rule with the {"functions": "always"} option:

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      When Not To Use It

      You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

      Missing trailing comma.
      Open

                  this.direction

      require or disallow trailing commas (comma-dangle)

      Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

      var foo = {
          bar: "baz",
          qux: "quux",
      };

      Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

      Less clear:

      var foo = {
      -    bar: "baz",
      -    qux: "quux"
      +    bar: "baz"
       };

      More clear:

      var foo = {
           bar: "baz",
      -    qux: "quux",
       };

      Rule Details

      This rule enforces consistent use of trailing commas in object and array literals.

      Options

      This rule has a string option or an object option:

      {
          "comma-dangle": ["error", "never"],
          // or
          "comma-dangle": ["error", {
              "arrays": "never",
              "objects": "never",
              "imports": "never",
              "exports": "never",
              "functions": "never"
          }]
      }
      • "never" (default) disallows trailing commas
      • "always" requires trailing commas
      • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
      • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

      You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

      • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
      • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
      • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
      • exports is for export declarations of ES Modules. (e.g. export {a,};)
      • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
        • functions should only be enabled when linting ECMAScript 2017 or higher.

      never

      Examples of incorrect code for this rule with the default "never" option:

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      Examples of correct code for this rule with the default "never" option:

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      Examples of correct code for this rule with the "always" option:

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      always-multiline

      Examples of incorrect code for this rule with the "always-multiline" option:

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      Examples of correct code for this rule with the "always-multiline" option:

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      only-multiline

      Examples of incorrect code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];

      Examples of correct code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      functions

      Examples of incorrect code for this rule with the {"functions": "never"} option:

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      Examples of correct code for this rule with the {"functions": "never"} option:

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

      Examples of incorrect code for this rule with the {"functions": "always"} option:

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

      Examples of correct code for this rule with the {"functions": "always"} option:

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      When Not To Use It

      You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput-1; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                      output += "      " + j + " : out" + j + " = in;\n";

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      Missing trailing comma.
      Open

                      size

      require or disallow trailing commas (comma-dangle)

      Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

      var foo = {
          bar: "baz",
          qux: "quux",
      };

      Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

      Less clear:

      var foo = {
      -    bar: "baz",
      -    qux: "quux"
      +    bar: "baz"
       };

      More clear:

      var foo = {
           bar: "baz",
      -    qux: "quux",
       };

      Rule Details

      This rule enforces consistent use of trailing commas in object and array literals.

      Options

      This rule has a string option or an object option:

      {
          "comma-dangle": ["error", "never"],
          // or
          "comma-dangle": ["error", {
              "arrays": "never",
              "objects": "never",
              "imports": "never",
              "exports": "never",
              "functions": "never"
          }]
      }
      • "never" (default) disallows trailing commas
      • "always" requires trailing commas
      • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
      • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

      You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

      • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
      • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
      • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
      • exports is for export declarations of ES Modules. (e.g. export {a,};)
      • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
        • functions should only be enabled when linting ECMAScript 2017 or higher.

      never

      Examples of incorrect code for this rule with the default "never" option:

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      Examples of correct code for this rule with the default "never" option:

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      Examples of correct code for this rule with the "always" option:

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      always-multiline

      Examples of incorrect code for this rule with the "always-multiline" option:

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      Examples of correct code for this rule with the "always-multiline" option:

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      only-multiline

      Examples of incorrect code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];

      Examples of correct code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      functions

      Examples of incorrect code for this rule with the {"functions": "never"} option:

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      Examples of correct code for this rule with the {"functions": "never"} option:

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

      Examples of incorrect code for this rule with the {"functions": "always"} option:

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

      Examples of correct code for this rule with the {"functions": "always"} option:

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      When Not To Use It

      You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

      Missing trailing comma.
      Open

                  this.direction

      require or disallow trailing commas (comma-dangle)

      Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

      var foo = {
          bar: "baz",
          qux: "quux",
      };

      Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

      Less clear:

      var foo = {
      -    bar: "baz",
      -    qux: "quux"
      +    bar: "baz"
       };

      More clear:

      var foo = {
           bar: "baz",
      -    qux: "quux",
       };

      Rule Details

      This rule enforces consistent use of trailing commas in object and array literals.

      Options

      This rule has a string option or an object option:

      {
          "comma-dangle": ["error", "never"],
          // or
          "comma-dangle": ["error", {
              "arrays": "never",
              "objects": "never",
              "imports": "never",
              "exports": "never",
              "functions": "never"
          }]
      }
      • "never" (default) disallows trailing commas
      • "always" requires trailing commas
      • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
      • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

      You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

      • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
      • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
      • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
      • exports is for export declarations of ES Modules. (e.g. export {a,};)
      • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
        • functions should only be enabled when linting ECMAScript 2017 or higher.

      never

      Examples of incorrect code for this rule with the default "never" option:

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      Examples of correct code for this rule with the default "never" option:

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      Examples of correct code for this rule with the "always" option:

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      always-multiline

      Examples of incorrect code for this rule with the "always-multiline" option:

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      Examples of correct code for this rule with the "always-multiline" option:

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      only-multiline

      Examples of incorrect code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];

      Examples of correct code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      functions

      Examples of incorrect code for this rule with the {"functions": "never"} option:

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      Examples of correct code for this rule with the {"functions": "never"} option:

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

      Examples of incorrect code for this rule with the {"functions": "always"} option:

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

      Examples of correct code for this rule with the {"functions": "always"} option:

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      When Not To Use It

      You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

      iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.
      Open

              for (var size of Demultiplexer.selSizes) {

      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 AST Explorer with the espree 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/

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput-1; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                      output += "out" + j + ", ";

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput-1; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      Missing trailing comma.
      Open

                  this.direction

      require or disallow trailing commas (comma-dangle)

      Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

      var foo = {
          bar: "baz",
          qux: "quux",
      };

      Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

      Less clear:

      var foo = {
      -    bar: "baz",
      -    qux: "quux"
      +    bar: "baz"
       };

      More clear:

      var foo = {
           bar: "baz",
      -    qux: "quux",
       };

      Rule Details

      This rule enforces consistent use of trailing commas in object and array literals.

      Options

      This rule has a string option or an object option:

      {
          "comma-dangle": ["error", "never"],
          // or
          "comma-dangle": ["error", {
              "arrays": "never",
              "objects": "never",
              "imports": "never",
              "exports": "never",
              "functions": "never"
          }]
      }
      • "never" (default) disallows trailing commas
      • "always" requires trailing commas
      • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
      • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

      You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

      • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
      • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
      • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
      • exports is for export declarations of ES Modules. (e.g. export {a,};)
      • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
        • functions should only be enabled when linting ECMAScript 2017 or higher.

      never

      Examples of incorrect code for this rule with the default "never" option:

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      Examples of correct code for this rule with the default "never" option:

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      Examples of correct code for this rule with the "always" option:

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      always-multiline

      Examples of incorrect code for this rule with the "always-multiline" option:

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      Examples of correct code for this rule with the "always-multiline" option:

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      only-multiline

      Examples of incorrect code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];

      Examples of correct code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      functions

      Examples of incorrect code for this rule with the {"functions": "never"} option:

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      Examples of correct code for this rule with the {"functions": "never"} option:

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

      Examples of incorrect code for this rule with the {"functions": "always"} option:

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

      Examples of correct code for this rule with the {"functions": "always"} option:

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      When Not To Use It

      You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

      Missing trailing comma.
      Open

                          10

      require or disallow trailing commas (comma-dangle)

      Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

      var foo = {
          bar: "baz",
          qux: "quux",
      };

      Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

      Less clear:

      var foo = {
      -    bar: "baz",
      -    qux: "quux"
      +    bar: "baz"
       };

      More clear:

      var foo = {
           bar: "baz",
      -    qux: "quux",
       };

      Rule Details

      This rule enforces consistent use of trailing commas in object and array literals.

      Options

      This rule has a string option or an object option:

      {
          "comma-dangle": ["error", "never"],
          // or
          "comma-dangle": ["error", {
              "arrays": "never",
              "objects": "never",
              "imports": "never",
              "exports": "never",
              "functions": "never"
          }]
      }
      • "never" (default) disallows trailing commas
      • "always" requires trailing commas
      • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
      • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

      You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

      • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
      • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
      • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
      • exports is for export declarations of ES Modules. (e.g. export {a,};)
      • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
        • functions should only be enabled when linting ECMAScript 2017 or higher.

      never

      Examples of incorrect code for this rule with the default "never" option:

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      Examples of correct code for this rule with the default "never" option:

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      Examples of correct code for this rule with the "always" option:

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      always-multiline

      Examples of incorrect code for this rule with the "always-multiline" option:

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      Examples of correct code for this rule with the "always-multiline" option:

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      only-multiline

      Examples of incorrect code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];

      Examples of correct code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      functions

      Examples of incorrect code for this rule with the {"functions": "never"} option:

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      Examples of correct code for this rule with the {"functions": "never"} option:

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

      Examples of incorrect code for this rule with the {"functions": "always"} option:

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

      Examples of correct code for this rule with the {"functions": "always"} option:

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      When Not To Use It

      You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                      output += "out" + j + ", ";

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                      output += "out" + j + ", ";

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput-1; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' is already defined.
      Open

                  for (var j = 0; j < numOutput; j++) {

      disallow variable redeclaration (no-redeclare)

      In JavaScript, it's possible to redeclare the same variable name using var. This can lead to confusion as to where the variable is actually declared and initialized.

      Rule Details

      This rule is aimed at eliminating variables that have multiple declarations in the same scope.

      Examples of incorrect code for this rule:

      /*eslint no-redeclare: "error"*/
      
      var a = 3;
      var a = 10;

      Examples of correct code for this rule:

      /*eslint no-redeclare: "error"*/
      
      var a = 3;
      // ...
      a = 10;

      Options

      This rule takes one optional argument, an object with a boolean property "builtinGlobals". It defaults to true. If set to true, this rule also checks redeclaration of built-in globals, such as Object, Array, Number...

      builtinGlobals

      The "builtinGlobals" option will check for redeclaration of built-in globals in global scope.

      Examples of incorrect code for the { "builtinGlobals": true } option:

      /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
      
      var Object = 0;

      Examples of incorrect code for the { "builtinGlobals": true } option and the browser environment:

      /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
      /*eslint-env browser*/
      
      var top = 0;

      The browser environment has many built-in global variables (for example, top). Some of built-in global variables cannot be redeclared.

      Note that when using the node or commonjs environments (or ecmaFeatures.globalReturn, if using the default parser), the top scope of a program is not actually the global scope, but rather a "module" scope. When this is the case, declaring a variable named after a builtin global is not a redeclaration, but rather a shadowing of the global variable. In that case, the [no-shadow](no-shadow.md) rule with the "builtinGlobals" option should be used.

      Related Rules

      'j' used outside of binding context.
      Open

                      output += "      " + j + " : out" + j + " = in;\n";

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      Function expected no return value.
      Open

                  return obj;

      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/

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput-1; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                      output += "    out" + j + " = 0;\n";

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                      output += "      " + j + " : out" + j + " = in;\n";

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' is already defined.
      Open

                  for (var j = 0; j < numOutput-1; j++) {

      disallow variable redeclaration (no-redeclare)

      In JavaScript, it's possible to redeclare the same variable name using var. This can lead to confusion as to where the variable is actually declared and initialized.

      Rule Details

      This rule is aimed at eliminating variables that have multiple declarations in the same scope.

      Examples of incorrect code for this rule:

      /*eslint no-redeclare: "error"*/
      
      var a = 3;
      var a = 10;

      Examples of correct code for this rule:

      /*eslint no-redeclare: "error"*/
      
      var a = 3;
      // ...
      a = 10;

      Options

      This rule takes one optional argument, an object with a boolean property "builtinGlobals". It defaults to true. If set to true, this rule also checks redeclaration of built-in globals, such as Object, Array, Number...

      builtinGlobals

      The "builtinGlobals" option will check for redeclaration of built-in globals in global scope.

      Examples of incorrect code for the { "builtinGlobals": true } option:

      /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
      
      var Object = 0;

      Examples of incorrect code for the { "builtinGlobals": true } option and the browser environment:

      /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
      /*eslint-env browser*/
      
      var top = 0;

      The browser environment has many built-in global variables (for example, top). Some of built-in global variables cannot be redeclared.

      Note that when using the node or commonjs environments (or ecmaFeatures.globalReturn, if using the default parser), the top scope of a program is not actually the global scope, but rather a "module" scope. When this is the case, declaring a variable named after a builtin global is not a redeclaration, but rather a shadowing of the global variable. In that case, the [no-shadow](no-shadow.md) rule with the "builtinGlobals" option should be used.

      Related Rules

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                      output += "    out" + j + " = 0;\n";

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      Missing trailing comma.
      Open

                  this.direction

      require or disallow trailing commas (comma-dangle)

      Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

      var foo = {
          bar: "baz",
          qux: "quux",
      };

      Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

      Less clear:

      var foo = {
      -    bar: "baz",
      -    qux: "quux"
      +    bar: "baz"
       };

      More clear:

      var foo = {
           bar: "baz",
      -    qux: "quux",
       };

      Rule Details

      This rule enforces consistent use of trailing commas in object and array literals.

      Options

      This rule has a string option or an object option:

      {
          "comma-dangle": ["error", "never"],
          // or
          "comma-dangle": ["error", {
              "arrays": "never",
              "objects": "never",
              "imports": "never",
              "exports": "never",
              "functions": "never"
          }]
      }
      • "never" (default) disallows trailing commas
      • "always" requires trailing commas
      • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
      • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

      You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

      • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
      • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
      • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
      • exports is for export declarations of ES Modules. (e.g. export {a,};)
      • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
        • functions should only be enabled when linting ECMAScript 2017 or higher.

      never

      Examples of incorrect code for this rule with the default "never" option:

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      Examples of correct code for this rule with the default "never" option:

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      Examples of correct code for this rule with the "always" option:

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      always-multiline

      Examples of incorrect code for this rule with the "always-multiline" option:

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      Examples of correct code for this rule with the "always-multiline" option:

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      only-multiline

      Examples of incorrect code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];

      Examples of correct code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      functions

      Examples of incorrect code for this rule with the {"functions": "never"} option:

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      Examples of correct code for this rule with the {"functions": "never"} option:

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

      Examples of incorrect code for this rule with the {"functions": "always"} option:

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

      Examples of correct code for this rule with the {"functions": "always"} option:

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      When Not To Use It

      You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

      Missing trailing comma.
      Open

                          10

      require or disallow trailing commas (comma-dangle)

      Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

      var foo = {
          bar: "baz",
          qux: "quux",
      };

      Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

      Less clear:

      var foo = {
      -    bar: "baz",
      -    qux: "quux"
      +    bar: "baz"
       };

      More clear:

      var foo = {
           bar: "baz",
      -    qux: "quux",
       };

      Rule Details

      This rule enforces consistent use of trailing commas in object and array literals.

      Options

      This rule has a string option or an object option:

      {
          "comma-dangle": ["error", "never"],
          // or
          "comma-dangle": ["error", {
              "arrays": "never",
              "objects": "never",
              "imports": "never",
              "exports": "never",
              "functions": "never"
          }]
      }
      • "never" (default) disallows trailing commas
      • "always" requires trailing commas
      • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
      • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

      You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

      • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
      • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
      • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
      • exports is for export declarations of ES Modules. (e.g. export {a,};)
      • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
        • functions should only be enabled when linting ECMAScript 2017 or higher.

      never

      Examples of incorrect code for this rule with the default "never" option:

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      Examples of correct code for this rule with the default "never" option:

      /*eslint comma-dangle: ["error", "never"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      always

      Examples of incorrect code for this rule with the "always" option:

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var arr = [1,2];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      Examples of correct code for this rule with the "always" option:

      /*eslint comma-dangle: ["error", "always"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var arr = [1,2,];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      always-multiline

      Examples of incorrect code for this rule with the "always-multiline" option:

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      Examples of correct code for this rule with the "always-multiline" option:

      /*eslint comma-dangle: ["error", "always-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });

      only-multiline

      Examples of incorrect code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = { bar: "baz", qux: "quux", };
      
      var arr = [1,2,];
      
      var arr = [1,
          2,];

      Examples of correct code for this rule with the "only-multiline" option:

      /*eslint comma-dangle: ["error", "only-multiline"]*/
      
      var foo = {
          bar: "baz",
          qux: "quux",
      };
      
      var foo = {
          bar: "baz",
          qux: "quux"
      };
      
      var foo = {bar: "baz", qux: "quux"};
      var arr = [1,2];
      
      var arr = [1,
          2];
      
      var arr = [
          1,
          2,
      ];
      
      var arr = [
          1,
          2
      ];
      
      foo({
        bar: "baz",
        qux: "quux",
      });
      
      foo({
        bar: "baz",
        qux: "quux"
      });

      functions

      Examples of incorrect code for this rule with the {"functions": "never"} option:

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      Examples of correct code for this rule with the {"functions": "never"} option:

      /*eslint comma-dangle: ["error", {"functions": "never"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

      Examples of incorrect code for this rule with the {"functions": "always"} option:

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b) {
      }
      
      foo(a, b);
      new foo(a, b);

      Examples of correct code for this rule with the {"functions": "always"} option:

      /*eslint comma-dangle: ["error", {"functions": "always"}]*/
      
      function foo(a, b,) {
      }
      
      foo(a, b,);
      new foo(a, b,);

      When Not To Use It

      You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' used outside of binding context.
      Open

                  for (var j = 0; j < numOutput; j++) {

      Treat var as Block Scoped (block-scoped-var)

      The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope.

      Rule Details

      This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable hoisting.

      Examples of incorrect code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          if (true) {
              var build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          if (true) {
              var build = true;
          } else {
              var build = false;
          }
      }
      
      function doTryCatch() {
          try {
              var build = 1;
          } catch (e) {
              var f = build;
          }
      }

      Examples of correct code for this rule:

      /*eslint block-scoped-var: "error"*/
      
      function doIf() {
          var build;
      
          if (true) {
              build = true;
          }
      
          console.log(build);
      }
      
      function doIfElse() {
          var build;
      
          if (true) {
              build = true;
          } else {
              build = false;
          }
      }
      
      function doTryCatch() {
          var build;
          var f;
      
          try {
              build = 1;
          } catch (e) {
              f = build;
          }
      }

      Further Reading

      'j' is already defined.
      Open

                  for (var j = 0; j < numOutput; j++) {

      disallow variable redeclaration (no-redeclare)

      In JavaScript, it's possible to redeclare the same variable name using var. This can lead to confusion as to where the variable is actually declared and initialized.

      Rule Details

      This rule is aimed at eliminating variables that have multiple declarations in the same scope.

      Examples of incorrect code for this rule:

      /*eslint no-redeclare: "error"*/
      
      var a = 3;
      var a = 10;

      Examples of correct code for this rule:

      /*eslint no-redeclare: "error"*/
      
      var a = 3;
      // ...
      a = 10;

      Options

      This rule takes one optional argument, an object with a boolean property "builtinGlobals". It defaults to true. If set to true, this rule also checks redeclaration of built-in globals, such as Object, Array, Number...

      builtinGlobals

      The "builtinGlobals" option will check for redeclaration of built-in globals in global scope.

      Examples of incorrect code for the { "builtinGlobals": true } option:

      /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
      
      var Object = 0;

      Examples of incorrect code for the { "builtinGlobals": true } option and the browser environment:

      /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
      /*eslint-env browser*/
      
      var top = 0;

      The browser environment has many built-in global variables (for example, top). Some of built-in global variables cannot be redeclared.

      Note that when using the node or commonjs environments (or ecmaFeatures.globalReturn, if using the default parser), the top scope of a program is not actually the global scope, but rather a "module" scope. When this is the case, declaring a variable named after a builtin global is not a redeclaration, but rather a shadowing of the global variable. In that case, the [no-shadow](no-shadow.md) rule with the "builtinGlobals" option should be used.

      Related Rules

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

              for (let i = 0; i < this.outputsize; i++) {
                  if (this.direction === "LEFT")
                      fillText(
                          ctx,
                          String(i),
      Severity: Major
      Found in simulator/src/modules/Demultiplexer.js and 1 other location - About 1 day to fix
      simulator/src/modules/Decoder.js on lines 189..222

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 280.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              this.changeControlSignalSize = function (size) {
                  if (size === undefined || size < 1 || size > 32) return;
                  if (this.controlSignalSize === size) return;
                  const obj = new Demultiplexer(
                      this.x,
      Severity: Major
      Found in simulator/src/modules/Demultiplexer.js and 1 other location - About 3 hrs to fix
      simulator/src/modules/Multiplexer.js on lines 72..86

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 102.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              for (let i = 0; i < this.outputsize; i++) {
                  const a = new Node(
                      -20 + this.xOff,
                      +this.yOff * 10 * (i - this.outputsize / 2) + 10,
                      1,
      Severity: Major
      Found in simulator/src/modules/Demultiplexer.js and 1 other location - About 3 hrs to fix
      simulator/src/modules/Multiplexer.js on lines 48..56

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 96.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          customSave() {
              const data = {
                  constructorParamaters: [
                      this.direction,
                      this.bitWidth,
      Severity: Major
      Found in simulator/src/modules/Demultiplexer.js and 1 other location - About 2 hrs to fix
      simulator/src/modules/Multiplexer.js on lines 119..133

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 93.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              this.newBitWidth = function (bitWidth) {
                  this.bitWidth = bitWidth;
                  for (let i = 0; i < this.outputsize; i++) {
                      this.output1[i].bitWidth = bitWidth;
                  }
      Severity: Major
      Found in simulator/src/modules/Demultiplexer.js and 1 other location - About 2 hrs to fix
      simulator/src/modules/Multiplexer.js on lines 93..99

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 76.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 6 locations. Consider refactoring.
      Open

              if (
                  (this.hover && !simulationArea.shiftDown) ||
                  simulationArea.lastSelected === this ||
                  simulationArea.multipleObjectSelections.contains(this)
              ) {
      Severity: Major
      Found in simulator/src/modules/Demultiplexer.js and 5 other locations - About 1 hr to fix
      simulator/src/modules/ALU.js on lines 98..98
      simulator/src/modules/Decoder.js on lines 175..181
      simulator/src/modules/Multiplexer.js on lines 215..221
      simulator/src/modules/Output.js on lines 143..149
      simulator/src/modules/Tunnel.js on lines 244..250

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 64.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              this.controlSignalInput = new Node(
                  0,
                  this.yOff * 10 * (this.outputsize / 2 - 1) + this.xOff + 10,
                  0,
                  this,
      Severity: Major
      Found in simulator/src/modules/Demultiplexer.js and 1 other location - About 1 hr to fix
      simulator/src/modules/Multiplexer.js on lines 58..65

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 60.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

              lineTo(
                  ctx,
                  20 - this.xOff,
                  -this.yOff * 10 * (this.outputsize / 2) - this.xOff + 20,
                  xx,
      Severity: Major
      Found in simulator/src/modules/Demultiplexer.js and 2 other locations - About 1 hr to fix
      simulator/src/modules/Decoder.js on lines 165..172
      simulator/src/modules/Multiplexer.js on lines 205..212

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 58.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

              lineTo(
                  ctx,
                  20 - this.xOff,
                  +this.yOff * 10 * (this.outputsize / 2 - 1) + this.xOff,
                  xx,
      Severity: Major
      Found in simulator/src/modules/Demultiplexer.js and 2 other locations - About 1 hr to fix
      simulator/src/modules/Decoder.js on lines 157..164
      simulator/src/modules/Multiplexer.js on lines 197..204

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 58.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              moveTo(
                  ctx,
                  0,
                  this.yOff * 10 * (this.outputsize / 2 - 1) + 10 + 0.5 * this.xOff,
                  xx,
      Severity: Major
      Found in simulator/src/modules/Demultiplexer.js and 1 other location - About 1 hr to fix
      simulator/src/modules/Multiplexer.js on lines 158..165

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 56.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

              lineTo(
                  ctx,
                  -20 + this.xOff,
                  20 + this.yOff * 10 * (this.outputsize / 2 - 1),
                  xx,
      Severity: Major
      Found in simulator/src/modules/Demultiplexer.js and 2 other locations - About 55 mins to fix
      simulator/src/modules/Decoder.js on lines 149..156
      simulator/src/modules/Multiplexer.js on lines 189..196

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 54.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

              for (let i = 0; i < this.output1.length; i++) {
                  this.output1[i].value = 0;
              }
      Severity: Minor
      Found in simulator/src/modules/Demultiplexer.js and 1 other location - About 45 mins to fix
      simulator/src/modules/Decoder.js on lines 113..115

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 50.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          generateVerilog() {
              Demultiplexer.selSizes.add(this.controlSignalSize);
              return CircuitElement.prototype.generateVerilog.call(this);
          }
      Severity: Minor
      Found in simulator/src/modules/Demultiplexer.js and 1 other location - About 45 mins to fix
      simulator/src/modules/Multiplexer.js on lines 271..274

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 50.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

              moveTo(
                  ctx,
                  -20 + this.xOff,
                  -this.yOff * 10 * (this.outputsize / 2),
                  xx,
      Severity: Minor
      Found in simulator/src/modules/Demultiplexer.js and 2 other locations - About 40 mins to fix
      simulator/src/modules/Decoder.js on lines 141..148
      simulator/src/modules/Multiplexer.js on lines 181..188

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 48.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  for (var j = 0; j < numOutput; j++) {
                      output += "      " + j + " : out" + j + " = in;\n";
                  }
      Severity: Minor
      Found in simulator/src/modules/Demultiplexer.js and 1 other location - About 35 mins to fix
      simulator/src/modules/Decoder.js on lines 263..265

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 46.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      There are no issues that match your filters.

      Category
      Status