CircuitVerse/CircuitVerse

View on GitHub
simulator/src/plotArea.js

Summary

Maintainability
F
3 days
Test Coverage

Function render has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        var { width, height } = this;
        this.canvas.height = height;
        this.canvas.width = width;
        var endTime = this.getCurrentTime();
Severity: Minor
Found in simulator/src/plotArea.js - About 1 day 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

File plotArea.js has 420 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import simulationArea from './simulationArea';
import {convertors} from './utils';
import { currentScreen } from './listeners';

var DPR = window.devicePixelRatio || 1;
Severity: Minor
Found in simulator/src/plotArea.js - About 6 hrs to fix

    Function render has 141 lines of code (exceeds 100 allowed). Consider refactoring.
    Open

        render() {
            var { width, height } = this;
            this.canvas.height = height;
            this.canvas.width = width;
            var endTime = this.getCurrentTime();
    Severity: Major
    Found in simulator/src/plotArea.js - About 2 hrs to fix

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

          update() {
              this.resize();
              var dangerColor = '#dc5656';
              var normalColor = '#42b983';
              this.unitUsed = Math.max(this.unitUsed, simulationArea.simulationQueue.time);
      Severity: Minor
      Found in simulator/src/plotArea.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

      Avoid deeply nested control flow statements.
      Open

                              if (x1 < timeLineStartX)
                                  continue;
      Severity: Major
      Found in simulator/src/plotArea.js - About 45 mins to fix

        'i' used outside of binding context.
        Open

                for (var i = Math.floor(plotArea.cycleOffset); getCycleStartX(i) <= width ; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x1' used outside of binding context.
        Open

                        if (x1 >= timeLineStartX) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                for (var i = 0; i < globalScope.Flag.length; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'startHeight' used outside of binding context.
        Open

                    ctx.fillRect(0, startHeight, flagLabelWidth, plotHeight);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                    ctx.fillText(globalScope.Flag[i].identifier, sh(5), startHeight + plotHeight * 0.7);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                for (var i = 0; i < globalScope.Flag.length; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                    var plotValues = globalScope.Flag[i].plotValues;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                    globalScope.Flag[i].cachedIndex = j;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x1' is already defined.
        Open

                                var x1 = getCycleStartX(plotValues[j + 1][0]);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x1' used outside of binding context.
        Open

                                var x1 = getCycleStartX(plotValues[j + 1][0]);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                        if (globalScope.Flag[i].bitWidth == 1) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x' used outside of binding context.
        Open

                            ctx.lineTo(x + smallOffset, yTop);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                for (var i = 0; i < globalScope.Flag.length; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                    var x = getCycleStartX(i);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x' used outside of binding context.
        Open

                    var x = getCycleStartX(i);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x1' used outside of binding context.
        Open

                            ctx.moveTo(x1, timeLineHeight - sh(2));
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                for (var i = Math.floor(plotArea.cycleOffset); getCycleStartX(i) <= width ; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x' used outside of binding context.
        Open

                    if (x >= timeLineStartX) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                        ctx.fillText(`${i}`, x, timeLineHeight - sh(15)/2);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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 = 1; j < 5; j++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x' used outside of binding context.
        Open

                        ctx.fillText(`${i}`, x, timeLineHeight - sh(15)/2);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        Expected '===' and instead saw '=='.
        Open

                if (oldHeight == this.height && oldWidth == this.width) return;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Require === and !== (eqeqeq)

        It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

        The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

        • [] == false
        • [] == ![]
        • 3 == "03"

        If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

        Rule Details

        This rule is aimed at eliminating the type-unsafe equality operators.

        Examples of incorrect code for this rule:

        /*eslint eqeqeq: "error"*/
        
        if (x == 42) { }
        
        if ("" == text) { }
        
        if (obj.getStuff() != undefined) { }

        The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

        Options

        always

        The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

        Examples of incorrect code for the "always" option:

        /*eslint eqeqeq: ["error", "always"]*/
        
        a == b
        foo == true
        bananas != 1
        value == undefined
        typeof foo == 'undefined'
        'hello' != 'world'
        0 == 0
        true == true
        foo == null

        Examples of correct code for the "always" option:

        /*eslint eqeqeq: ["error", "always"]*/
        
        a === b
        foo === true
        bananas !== 1
        value === undefined
        typeof foo === 'undefined'
        'hello' !== 'world'
        0 === 0
        true === true
        foo === null

        This rule optionally takes a second argument, which should be an object with the following supported properties:

        • "null": Customize how this rule treats null literals. Possible values:
          • always (default) - Always use === or !==.
          • never - Never use === or !== with null.
          • ignore - Do not apply this rule to null.

        smart

        The "smart" option enforces the use of === and !== except for these cases:

        • Comparing two literal values
        • Evaluating the value of typeof
        • Comparing against null

        Examples of incorrect code for the "smart" option:

        /*eslint eqeqeq: ["error", "smart"]*/
        
        // comparing two variables requires ===
        a == b
        
        // only one side is a literal
        foo == true
        bananas != 1
        
        // comparing to undefined requires ===
        value == undefined

        Examples of correct code for the "smart" option:

        /*eslint eqeqeq: ["error", "smart"]*/
        
        typeof foo == 'undefined'
        'hello' != 'world'
        0 == 0
        true == true
        foo == null

        allow-null

        Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell ESLint to always enforce strict equality except when comparing with the null literal.

        ["error", "always", {"null": "ignore"}]

        When Not To Use It

        If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

        'x' used outside of binding context.
        Open

                        ctx.moveTo(x, timeLineHeight - sh(5));
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                for (var i = Math.floor(plotArea.cycleOffset); getCycleStartX(i) <= width ; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                for (var i = Math.floor(plotArea.cycleOffset); getCycleStartX(i) <= width ; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                for (var i = 0; i < globalScope.Flag.length; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x' used outside of binding context.
        Open

                        var x1 = x + Math.round(j * cycleWidth / 5);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                for (var i = Math.floor(plotArea.cycleOffset); getCycleStartX(i) <= width ; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                for (var i = Math.floor(plotArea.cycleOffset); getCycleStartX(i) <= width ; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x' used outside of binding context.
        Open

                        ctx.lineTo(x, timeLineHeight);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x1' used outside of binding context.
        Open

                        var x1 = x + Math.round(j * cycleWidth / 5);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x1' used outside of binding context.
        Open

                        if (x1 >= timeLineStartX) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x1' used outside of binding context.
        Open

                            ctx.lineTo(x1, timeLineHeight);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                    if (globalScope.Flag[i].cachedIndex) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

                        j = globalScope.Flag[i].cachedIndex;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

                    while (j + 1 < plotValues.length && getCycleStartX(plotValues[j][0]) < timeLineStartX) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                    globalScope.Flag[i].cachedIndex = j;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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 (; j < plotValues.length; j++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        Expected '===' and instead saw '=='.
        Open

                if (oldHeight == this.height && oldWidth == this.width) return;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Require === and !== (eqeqeq)

        It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

        The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

        • [] == false
        • [] == ![]
        • 3 == "03"

        If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

        Rule Details

        This rule is aimed at eliminating the type-unsafe equality operators.

        Examples of incorrect code for this rule:

        /*eslint eqeqeq: "error"*/
        
        if (x == 42) { }
        
        if ("" == text) { }
        
        if (obj.getStuff() != undefined) { }

        The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

        Options

        always

        The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

        Examples of incorrect code for the "always" option:

        /*eslint eqeqeq: ["error", "always"]*/
        
        a == b
        foo == true
        bananas != 1
        value == undefined
        typeof foo == 'undefined'
        'hello' != 'world'
        0 == 0
        true == true
        foo == null

        Examples of correct code for the "always" option:

        /*eslint eqeqeq: ["error", "always"]*/
        
        a === b
        foo === true
        bananas !== 1
        value === undefined
        typeof foo === 'undefined'
        'hello' !== 'world'
        0 === 0
        true === true
        foo === null

        This rule optionally takes a second argument, which should be an object with the following supported properties:

        • "null": Customize how this rule treats null literals. Possible values:
          • always (default) - Always use === or !==.
          • never - Never use === or !== with null.
          • ignore - Do not apply this rule to null.

        smart

        The "smart" option enforces the use of === and !== except for these cases:

        • Comparing two literal values
        • Evaluating the value of typeof
        • Comparing against null

        Examples of incorrect code for the "smart" option:

        /*eslint eqeqeq: ["error", "smart"]*/
        
        // comparing two variables requires ===
        a == b
        
        // only one side is a literal
        foo == true
        bananas != 1
        
        // comparing to undefined requires ===
        value == undefined

        Examples of correct code for the "smart" option:

        /*eslint eqeqeq: ["error", "smart"]*/
        
        typeof foo == 'undefined'
        'hello' != 'world'
        0 == 0
        true == true
        foo == null

        allow-null

        Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell ESLint to always enforce strict equality except when comparing with the null literal.

        ["error", "always", {"null": "ignore"}]

        When Not To Use It

        If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

        'i' used outside of binding context.
        Open

                        ctx.fillText(`${i}`, x, timeLineHeight - sh(15)/2);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                for (var i = 0; i < globalScope.Flag.length; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

                    var j = 0;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

                    while (j > 0 && getCycleStartX(plotValues[j][0]) > timeLineStartX) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

                    globalScope.Flag[i].cachedIndex = j;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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 (; j < plotValues.length; j++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x1' used outside of binding context.
        Open

                            var textPositionX = (x1 + x2) / 2 ;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

                        var x1 = x + Math.round(j * cycleWidth / 5);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                    var startHeight = getFlagStartY(i);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'startHeight' used outside of binding context.
        Open

                    var yTop = startHeight;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'startHeight' used outside of binding context.
        Open

                    var yBottom = startHeight + waveFormHeight;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x' is already defined.
        Open

                        var x = getCycleStartX(plotValues[j][0]);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x' used outside of binding context.
        Open

                        var x = getCycleStartX(plotValues[j][0]);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x' used outside of binding context.
        Open

                                ctx.lineTo(x, prevY);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

                            if (j + 1 == plotValues.length) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x1' used outside of binding context.
        Open

                            var x1 = Math.max(x, timeLineStartX);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x1' used outside of binding context.
        Open

                            ctx.moveTo(x1, timeLineHeight - sh(2));
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                    ctx.fillText(globalScope.Flag[i].identifier, sh(5), startHeight + plotHeight * 0.7);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' is already defined.
        Open

                for (var i = 0; i < globalScope.Flag.length; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'startHeight' is already defined.
        Open

                    var startHeight = getFlagStartY(i) + waveFormPadding;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'startHeight' used outside of binding context.
        Open

                    var startHeight = getFlagStartY(i) + waveFormPadding;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x' used outside of binding context.
        Open

                            x = timeLineStartX;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                        j = globalScope.Flag[i].cachedIndex;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                        if (globalScope.Flag[i].bitWidth == 1) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'endX' used outside of binding context.
        Open

                            if (x > endX) break;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        Expected '===' and instead saw '=='.
        Open

                    if (state == WAVEFORM_STARTED) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Require === and !== (eqeqeq)

        It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

        The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

        • [] == false
        • [] == ![]
        • 3 == "03"

        If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

        Rule Details

        This rule is aimed at eliminating the type-unsafe equality operators.

        Examples of incorrect code for this rule:

        /*eslint eqeqeq: "error"*/
        
        if (x == 42) { }
        
        if ("" == text) { }
        
        if (obj.getStuff() != undefined) { }

        The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

        Options

        always

        The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

        Examples of incorrect code for the "always" option:

        /*eslint eqeqeq: ["error", "always"]*/
        
        a == b
        foo == true
        bananas != 1
        value == undefined
        typeof foo == 'undefined'
        'hello' != 'world'
        0 == 0
        true == true
        foo == null

        Examples of correct code for the "always" option:

        /*eslint eqeqeq: ["error", "always"]*/
        
        a === b
        foo === true
        bananas !== 1
        value === undefined
        typeof foo === 'undefined'
        'hello' !== 'world'
        0 === 0
        true === true
        foo === null

        This rule optionally takes a second argument, which should be an object with the following supported properties:

        • "null": Customize how this rule treats null literals. Possible values:
          • always (default) - Always use === or !==.
          • never - Never use === or !== with null.
          • ignore - Do not apply this rule to null.

        smart

        The "smart" option enforces the use of === and !== except for these cases:

        • Comparing two literal values
        • Evaluating the value of typeof
        • Comparing against null

        Examples of incorrect code for the "smart" option:

        /*eslint eqeqeq: ["error", "smart"]*/
        
        // comparing two variables requires ===
        a == b
        
        // only one side is a literal
        foo == true
        bananas != 1
        
        // comparing to undefined requires ===
        value == undefined

        Examples of correct code for the "smart" option:

        /*eslint eqeqeq: ["error", "smart"]*/
        
        typeof foo == 'undefined'
        'hello' != 'world'
        0 == 0
        true == true
        foo == null

        allow-null

        Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell ESLint to always enforce strict equality except when comparing with the null literal.

        ["error", "always", {"null": "ignore"}]

        When Not To Use It

        If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

        'i' used outside of binding context.
        Open

                    if (globalScope.Flag[i].cachedIndex) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

                        j++;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

                    while (j > 0 && getCycleStartX(plotValues[j][0]) > timeLineStartX) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        Expected '===' and instead saw '=='.
        Open

                            if (state == WAVEFORM_NOT_STARTED) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Require === and !== (eqeqeq)

        It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

        The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

        • [] == false
        • [] == ![]
        • 3 == "03"

        If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

        Rule Details

        This rule is aimed at eliminating the type-unsafe equality operators.

        Examples of incorrect code for this rule:

        /*eslint eqeqeq: "error"*/
        
        if (x == 42) { }
        
        if ("" == text) { }
        
        if (obj.getStuff() != undefined) { }

        The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

        Options

        always

        The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

        Examples of incorrect code for the "always" option:

        /*eslint eqeqeq: ["error", "always"]*/
        
        a == b
        foo == true
        bananas != 1
        value == undefined
        typeof foo == 'undefined'
        'hello' != 'world'
        0 == 0
        true == true
        foo == null

        Examples of correct code for the "always" option:

        /*eslint eqeqeq: ["error", "always"]*/
        
        a === b
        foo === true
        bananas !== 1
        value === undefined
        typeof foo === 'undefined'
        'hello' !== 'world'
        0 === 0
        true === true
        foo === null

        This rule optionally takes a second argument, which should be an object with the following supported properties:

        • "null": Customize how this rule treats null literals. Possible values:
          • always (default) - Always use === or !==.
          • never - Never use === or !== with null.
          • ignore - Do not apply this rule to null.

        smart

        The "smart" option enforces the use of === and !== except for these cases:

        • Comparing two literal values
        • Evaluating the value of typeof
        • Comparing against null

        Examples of incorrect code for the "smart" option:

        /*eslint eqeqeq: ["error", "smart"]*/
        
        // comparing two variables requires ===
        a == b
        
        // only one side is a literal
        foo == true
        bananas != 1
        
        // comparing to undefined requires ===
        value == undefined

        Examples of correct code for the "smart" option:

        /*eslint eqeqeq: ["error", "smart"]*/
        
        typeof foo == 'undefined'
        'hello' != 'world'
        0 == 0
        true == true
        foo == null

        allow-null

        Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell ESLint to always enforce strict equality except when comparing with the null literal.

        ["error", "always", {"null": "ignore"}]

        When Not To Use It

        If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

        'x' used outside of binding context.
        Open

                                ctx.moveTo(x, y);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'endX' is already defined.
        Open

                            var endX;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

                                endX = getCycleStartX(plotValues[j + 1][0]);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x1' used outside of binding context.
        Open

                            var textPositionX = (x1 + x2) / 2 ;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x1' used outside of binding context.
        Open

                        var x1 = x + Math.round(j * cycleWidth / 5);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' is already defined.
        Open

                for (var i = 0; i < globalScope.Flag.length; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                for (var i = 0; i < globalScope.Flag.length; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

                                var x1 = getCycleStartX(plotValues[j + 1][0]);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                for (var i = 0; i < globalScope.Flag.length; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                    var plotValues = globalScope.Flag[i].plotValues;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x1' used outside of binding context.
        Open

                                var x1 = getCycleStartX(plotValues[j + 1][0]);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

                        var value = plotValues[j][1];
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        Expected '===' and instead saw '=='.
        Open

                            if (j + 1 == plotValues.length) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Require === and !== (eqeqeq)

        It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

        The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

        • [] == false
        • [] == ![]
        • 3 == "03"

        If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

        Rule Details

        This rule is aimed at eliminating the type-unsafe equality operators.

        Examples of incorrect code for this rule:

        /*eslint eqeqeq: "error"*/
        
        if (x == 42) { }
        
        if ("" == text) { }
        
        if (obj.getStuff() != undefined) { }

        The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

        Options

        always

        The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

        Examples of incorrect code for the "always" option:

        /*eslint eqeqeq: ["error", "always"]*/
        
        a == b
        foo == true
        bananas != 1
        value == undefined
        typeof foo == 'undefined'
        'hello' != 'world'
        0 == 0
        true == true
        foo == null

        Examples of correct code for the "always" option:

        /*eslint eqeqeq: ["error", "always"]*/
        
        a === b
        foo === true
        bananas !== 1
        value === undefined
        typeof foo === 'undefined'
        'hello' !== 'world'
        0 === 0
        true === true
        foo === null

        This rule optionally takes a second argument, which should be an object with the following supported properties:

        • "null": Customize how this rule treats null literals. Possible values:
          • always (default) - Always use === or !==.
          • never - Never use === or !== with null.
          • ignore - Do not apply this rule to null.

        smart

        The "smart" option enforces the use of === and !== except for these cases:

        • Comparing two literal values
        • Evaluating the value of typeof
        • Comparing against null

        Examples of incorrect code for the "smart" option:

        /*eslint eqeqeq: ["error", "smart"]*/
        
        // comparing two variables requires ===
        a == b
        
        // only one side is a literal
        foo == true
        bananas != 1
        
        // comparing to undefined requires ===
        value == undefined

        Examples of correct code for the "smart" option:

        /*eslint eqeqeq: ["error", "smart"]*/
        
        typeof foo == 'undefined'
        'hello' != 'world'
        0 == 0
        true == true
        foo == null

        allow-null

        Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell ESLint to always enforce strict equality except when comparing with the null literal.

        ["error", "always", {"null": "ignore"}]

        When Not To Use It

        If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

        'x' used outside of binding context.
        Open

                            ctx.lineTo(x, yMid);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                    var x = getCycleStartX(i);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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 = 1; j < 5; j++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'startHeight' used outside of binding context.
        Open

                    ctx.fillText(globalScope.Flag[i].identifier, sh(5), startHeight + plotHeight * 0.7);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'startHeight' used outside of binding context.
        Open

                    var yMid = startHeight + waveFormHeight / 2;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        Expected '!==' and instead saw '!='.
        Open

                            if(j + 1 != plotValues.length) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Require === and !== (eqeqeq)

        It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

        The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

        • [] == false
        • [] == ![]
        • 3 == "03"

        If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

        Rule Details

        This rule is aimed at eliminating the type-unsafe equality operators.

        Examples of incorrect code for this rule:

        /*eslint eqeqeq: "error"*/
        
        if (x == 42) { }
        
        if ("" == text) { }
        
        if (obj.getStuff() != undefined) { }

        The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

        Options

        always

        The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

        Examples of incorrect code for the "always" option:

        /*eslint eqeqeq: ["error", "always"]*/
        
        a == b
        foo == true
        bananas != 1
        value == undefined
        typeof foo == 'undefined'
        'hello' != 'world'
        0 == 0
        true == true
        foo == null

        Examples of correct code for the "always" option:

        /*eslint eqeqeq: ["error", "always"]*/
        
        a === b
        foo === true
        bananas !== 1
        value === undefined
        typeof foo === 'undefined'
        'hello' !== 'world'
        0 === 0
        true === true
        foo === null

        This rule optionally takes a second argument, which should be an object with the following supported properties:

        • "null": Customize how this rule treats null literals. Possible values:
          • always (default) - Always use === or !==.
          • never - Never use === or !== with null.
          • ignore - Do not apply this rule to null.

        smart

        The "smart" option enforces the use of === and !== except for these cases:

        • Comparing two literal values
        • Evaluating the value of typeof
        • Comparing against null

        Examples of incorrect code for the "smart" option:

        /*eslint eqeqeq: ["error", "smart"]*/
        
        // comparing two variables requires ===
        a == b
        
        // only one side is a literal
        foo == true
        bananas != 1
        
        // comparing to undefined requires ===
        value == undefined

        Examples of correct code for the "smart" option:

        /*eslint eqeqeq: ["error", "smart"]*/
        
        typeof foo == 'undefined'
        'hello' != 'world'
        0 == 0
        true == true
        foo == null

        allow-null

        Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell ESLint to always enforce strict equality except when comparing with the null literal.

        ["error", "always", {"null": "ignore"}]

        When Not To Use It

        If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

        'x' used outside of binding context.
        Open

                            if (x > endX) break;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                        if (globalScope.Flag[i].bitWidth == 1) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x1' used outside of binding context.
        Open

                            ctx.lineTo(x1, timeLineHeight);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                for (var i = 0; i < globalScope.Flag.length; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

                        j--;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x1' used outside of binding context.
        Open

                                if (x1 < timeLineStartX)
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x1' used outside of binding context.
        Open

                                if (x1 < timeLineStartX)
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x' used outside of binding context.
        Open

                            var x1 = Math.max(x, timeLineStartX);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                for (var i = 0; i < globalScope.Flag.length; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                    var startHeight = getFlagStartY(i);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        Expected '===' and instead saw '=='.
        Open

                        if (globalScope.Flag[i].bitWidth == 1) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Require === and !== (eqeqeq)

        It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

        The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

        • [] == false
        • [] == ![]
        • 3 == "03"

        If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

        Rule Details

        This rule is aimed at eliminating the type-unsafe equality operators.

        Examples of incorrect code for this rule:

        /*eslint eqeqeq: "error"*/
        
        if (x == 42) { }
        
        if ("" == text) { }
        
        if (obj.getStuff() != undefined) { }

        The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

        Options

        always

        The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

        Examples of incorrect code for the "always" option:

        /*eslint eqeqeq: ["error", "always"]*/
        
        a == b
        foo == true
        bananas != 1
        value == undefined
        typeof foo == 'undefined'
        'hello' != 'world'
        0 == 0
        true == true
        foo == null

        Examples of correct code for the "always" option:

        /*eslint eqeqeq: ["error", "always"]*/
        
        a === b
        foo === true
        bananas !== 1
        value === undefined
        typeof foo === 'undefined'
        'hello' !== 'world'
        0 === 0
        true === true
        foo === null

        This rule optionally takes a second argument, which should be an object with the following supported properties:

        • "null": Customize how this rule treats null literals. Possible values:
          • always (default) - Always use === or !==.
          • never - Never use === or !== with null.
          • ignore - Do not apply this rule to null.

        smart

        The "smart" option enforces the use of === and !== except for these cases:

        • Comparing two literal values
        • Evaluating the value of typeof
        • Comparing against null

        Examples of incorrect code for the "smart" option:

        /*eslint eqeqeq: ["error", "smart"]*/
        
        // comparing two variables requires ===
        a == b
        
        // only one side is a literal
        foo == true
        bananas != 1
        
        // comparing to undefined requires ===
        value == undefined

        Examples of correct code for the "smart" option:

        /*eslint eqeqeq: ["error", "smart"]*/
        
        typeof foo == 'undefined'
        'hello' != 'world'
        0 == 0
        true == true
        foo == null

        allow-null

        Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell ESLint to always enforce strict equality except when comparing with the null literal.

        ["error", "always", {"null": "ignore"}]

        When Not To Use It

        If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

        'i' used outside of binding context.
        Open

                        if (globalScope.Flag[i].bitWidth == 1) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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 = 1; j < 5; j++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                for (var i = 0; i < globalScope.Flag.length; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                for (var i = 0; i < globalScope.Flag.length; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                    var startHeight = getFlagStartY(i) + waveFormPadding;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'startHeight' used outside of binding context.
        Open

                    var startHeight = getFlagStartY(i);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

                    var j = 0;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x1' used outside of binding context.
        Open

                            var x1 = Math.max(x, timeLineStartX);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                    var startHeight = getFlagStartY(i) + waveFormPadding;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'endX' used outside of binding context.
        Open

                var endX = Math.min(getCycleStartX(endTime), width);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                for (var i = 0; i < globalScope.Flag.length; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'i' used outside of binding context.
        Open

                        j = globalScope.Flag[i].cachedIndex;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x' used outside of binding context.
        Open

                        if (x < timeLineStartX) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

                    while (j + 1 < plotValues.length && getCycleStartX(plotValues[j][0]) < timeLineStartX) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

                        var x = getCycleStartX(plotValues[j][0]);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x' used outside of binding context.
        Open

                                ctx.lineTo(x, y);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

                            if(j + 1 != plotValues.length) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x' used outside of binding context.
        Open

                            ctx.lineTo(x + smallOffset, yBottom);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'x1' is already defined.
        Open

                            var x1 = Math.max(x, timeLineStartX);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'endX' used outside of binding context.
        Open

                            ctx.lineTo(endX, prevY);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        Expected '===' and instead saw '=='.
        Open

                            if (state == WAVEFORM_STARTED) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Require === and !== (eqeqeq)

        It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

        The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

        • [] == false
        • [] == ![]
        • 3 == "03"

        If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

        Rule Details

        This rule is aimed at eliminating the type-unsafe equality operators.

        Examples of incorrect code for this rule:

        /*eslint eqeqeq: "error"*/
        
        if (x == 42) { }
        
        if ("" == text) { }
        
        if (obj.getStuff() != undefined) { }

        The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

        Options

        always

        The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

        Examples of incorrect code for the "always" option:

        /*eslint eqeqeq: ["error", "always"]*/
        
        a == b
        foo == true
        bananas != 1
        value == undefined
        typeof foo == 'undefined'
        'hello' != 'world'
        0 == 0
        true == true
        foo == null

        Examples of correct code for the "always" option:

        /*eslint eqeqeq: ["error", "always"]*/
        
        a === b
        foo === true
        bananas !== 1
        value === undefined
        typeof foo === 'undefined'
        'hello' !== 'world'
        0 === 0
        true === true
        foo === null

        This rule optionally takes a second argument, which should be an object with the following supported properties:

        • "null": Customize how this rule treats null literals. Possible values:
          • always (default) - Always use === or !==.
          • never - Never use === or !== with null.
          • ignore - Do not apply this rule to null.

        smart

        The "smart" option enforces the use of === and !== except for these cases:

        • Comparing two literal values
        • Evaluating the value of typeof
        • Comparing against null

        Examples of incorrect code for the "smart" option:

        /*eslint eqeqeq: ["error", "smart"]*/
        
        // comparing two variables requires ===
        a == b
        
        // only one side is a literal
        foo == true
        bananas != 1
        
        // comparing to undefined requires ===
        value == undefined

        Examples of correct code for the "smart" option:

        /*eslint eqeqeq: ["error", "smart"]*/
        
        typeof foo == 'undefined'
        'hello' != 'world'
        0 == 0
        true == true
        foo == null

        allow-null

        Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell ESLint to always enforce strict equality except when comparing with the null literal.

        ["error", "always", {"null": "ignore"}]

        When Not To Use It

        If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

        Expected '===' and instead saw '=='.
        Open

                            var y = value == 1 ? yTop : yBottom;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Require === and !== (eqeqeq)

        It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

        The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

        • [] == false
        • [] == ![]
        • 3 == "03"

        If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

        Rule Details

        This rule is aimed at eliminating the type-unsafe equality operators.

        Examples of incorrect code for this rule:

        /*eslint eqeqeq: "error"*/
        
        if (x == 42) { }
        
        if ("" == text) { }
        
        if (obj.getStuff() != undefined) { }

        The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

        Options

        always

        The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

        Examples of incorrect code for the "always" option:

        /*eslint eqeqeq: ["error", "always"]*/
        
        a == b
        foo == true
        bananas != 1
        value == undefined
        typeof foo == 'undefined'
        'hello' != 'world'
        0 == 0
        true == true
        foo == null

        Examples of correct code for the "always" option:

        /*eslint eqeqeq: ["error", "always"]*/
        
        a === b
        foo === true
        bananas !== 1
        value === undefined
        typeof foo === 'undefined'
        'hello' !== 'world'
        0 === 0
        true === true
        foo === null

        This rule optionally takes a second argument, which should be an object with the following supported properties:

        • "null": Customize how this rule treats null literals. Possible values:
          • always (default) - Always use === or !==.
          • never - Never use === or !== with null.
          • ignore - Do not apply this rule to null.

        smart

        The "smart" option enforces the use of === and !== except for these cases:

        • Comparing two literal values
        • Evaluating the value of typeof
        • Comparing against null

        Examples of incorrect code for the "smart" option:

        /*eslint eqeqeq: ["error", "smart"]*/
        
        // comparing two variables requires ===
        a == b
        
        // only one side is a literal
        foo == true
        bananas != 1
        
        // comparing to undefined requires ===
        value == undefined

        Examples of correct code for the "smart" option:

        /*eslint eqeqeq: ["error", "smart"]*/
        
        typeof foo == 'undefined'
        'hello' != 'world'
        0 == 0
        true == true
        foo == null

        allow-null

        Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell ESLint to always enforce strict equality except when comparing with the null literal.

        ["error", "always", {"null": "ignore"}]

        When Not To Use It

        If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

        'x' used outside of binding context.
        Open

                        if (x > width) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        Expected '===' and instead saw '=='.
        Open

                        if (globalScope.Flag[i].bitWidth == 1) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Require === and !== (eqeqeq)

        It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

        The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

        • [] == false
        • [] == ![]
        • 3 == "03"

        If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

        Rule Details

        This rule is aimed at eliminating the type-unsafe equality operators.

        Examples of incorrect code for this rule:

        /*eslint eqeqeq: "error"*/
        
        if (x == 42) { }
        
        if ("" == text) { }
        
        if (obj.getStuff() != undefined) { }

        The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

        Options

        always

        The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

        Examples of incorrect code for the "always" option:

        /*eslint eqeqeq: ["error", "always"]*/
        
        a == b
        foo == true
        bananas != 1
        value == undefined
        typeof foo == 'undefined'
        'hello' != 'world'
        0 == 0
        true == true
        foo == null

        Examples of correct code for the "always" option:

        /*eslint eqeqeq: ["error", "always"]*/
        
        a === b
        foo === true
        bananas !== 1
        value === undefined
        typeof foo === 'undefined'
        'hello' !== 'world'
        0 === 0
        true === true
        foo === null

        This rule optionally takes a second argument, which should be an object with the following supported properties:

        • "null": Customize how this rule treats null literals. Possible values:
          • always (default) - Always use === or !==.
          • never - Never use === or !== with null.
          • ignore - Do not apply this rule to null.

        smart

        The "smart" option enforces the use of === and !== except for these cases:

        • Comparing two literal values
        • Evaluating the value of typeof
        • Comparing against null

        Examples of incorrect code for the "smart" option:

        /*eslint eqeqeq: ["error", "smart"]*/
        
        // comparing two variables requires ===
        a == b
        
        // only one side is a literal
        foo == true
        bananas != 1
        
        // comparing to undefined requires ===
        value == undefined

        Examples of correct code for the "smart" option:

        /*eslint eqeqeq: ["error", "smart"]*/
        
        typeof foo == 'undefined'
        'hello' != 'world'
        0 == 0
        true == true
        foo == null

        allow-null

        Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell ESLint to always enforce strict equality except when comparing with the null literal.

        ["error", "always", {"null": "ignore"}]

        When Not To Use It

        If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

        Unexpected whitespace before semicolon.
        Open

                            var textPositionX = (x1 + x2) / 2 ;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Enforce spacing before and after semicolons (semi-spacing)

        JavaScript allows you to place unnecessary spaces before or after a semicolon.

        Disallowing or enforcing space around a semicolon can improve the readability of your program.

        var a = "b" ;
        
        var c = "d";var e = "f";

        Rule Details

        This rule aims to enforce spacing around a semicolon. This rule prevents the use of spaces before a semicolon in expressions.

        This rule doesn't check spacing in the following cases:

        • The spacing after the semicolon if it is the first token in the line.

        • The spacing before the semicolon if it is after an opening parenthesis (( or {), or the spacing after the semicolon if it is before a closing parenthesis () or }). That spacing is checked by space-in-parens or block-spacing.

        • The spacing around the semicolon in a for loop with an empty condition (for(;;)).

        Options

        The rule takes one option, an object, which has two keys before and after having boolean values true or false. If before is true, space is enforced before semicolons and if it's false, space is disallowed before semicolons. If after is true, space is enforced after semicolons and if it's false, space is disallowed after semicolons. The after option will be only applied if a semicolon is not at the end of line.

        The default is {"before": false, "after": true}.

        "semi-spacing": ["error", {"before": false, "after": true}]

        {"before": false, "after": true}

        This is the default option. It enforces spacing after semicolons and disallows spacing before semicolons.

        Examples of incorrect code for this rule:

        /*eslint semi-spacing: "error"*/
        
        var foo ;
        var foo;var bar;
        throw new Error("error") ;
        while (a) { break ; }
        for (i = 0 ; i < 10 ; i++) {}
        for (i = 0;i < 10;i++) {}

        Examples of correct code for this rule:

        /*eslint semi-spacing: "error"*/
        
        var foo;
        var foo; var bar;
        throw new Error("error");
        while (a) { break; }
        for (i = 0; i < 10; i++) {}
        for (;;) {}
        if (true) {;}
        ;foo();

        {"before": true, "after": false}

        This option enforces spacing before semicolons and disallows spacing after semicolons.

        Examples of incorrect code for this rule with the {"before": true, "after": false} option:

        /*eslint semi-spacing: ["error", { "before": true, "after": false }]*/
        
        var foo;
        var foo ; var bar;
        throw new Error("error");
        while (a) { break; }
        for (i = 0;i < 10;i++) {}
        for (i = 0; i < 10; i++) {}

        Examples of correct code for this rule with the {"before": true, "after": false} option:

        /*eslint semi-spacing: ["error", { "before": true, "after": false }]*/
        
        var foo ;
        var foo ;var bar ;
        throw new Error("error") ;
        while (a) {break ;}
        for (i = 0 ;i < 10 ;i++) {}

        When Not To Use It

        You can turn this rule off if you are not concerned with the consistency of spacing before or after semicolons.

        Related Rules

        • [semi](semi.md)
        • [no-extra-semi](no-extra-semi.md)
        • [comma-spacing](comma-spacing.md)
        • [block-spacing](block-spacing.md)
        • [space-in-parens](space-in-parens.md) Source: http://eslint.org/docs/rules/

        A space is required after '{'.
        Open

        import {convertors} from './utils';
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

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

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

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

        Rule Details

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

        Options

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

        String option:

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

        Object option:

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

        never

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

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

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

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

        always

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

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

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

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

        arraysInObjects

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

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

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

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

        objectsInObjects

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

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

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

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

        When Not To Use It

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

        Related Rules

        • [array-bracket-spacing](array-bracket-spacing.md)
        • [comma-spacing](comma-spacing.md)
        • [computed-property-spacing](computed-property-spacing.md)
        • [space-in-parens](space-in-parens.md) Source: http://eslint.org/docs/rules/

        A space is required before '}'.
        Open

        import {convertors} from './utils';
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

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

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

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

        Rule Details

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

        Options

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

        String option:

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

        Object option:

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

        never

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

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

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

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

        always

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

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

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

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

        arraysInObjects

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

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

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

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

        objectsInObjects

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

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

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

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

        When Not To Use It

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

        Related Rules

        • [array-bracket-spacing](array-bracket-spacing.md)
        • [comma-spacing](comma-spacing.md)
        • [computed-property-spacing](computed-property-spacing.md)
        • [space-in-parens](space-in-parens.md) Source: http://eslint.org/docs/rules/

        Strings must use singlequote.
        Open

                anchor.download = `waveform.png`;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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/

        Use object destructuring.
        Open

                var timePeriod = simulationArea.timePeriod;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Prefer destructuring from arrays and objects (prefer-destructuring)

        With JavaScript ES6, a new syntax was added for creating variables from an array index or object property, called destructuring. This rule enforces usage of destructuring instead of accessing a property through a member expression.

        Rule Details

        Options

        This rule takes two sets of configuration objects. The first object parameter determines what types of destructuring the rule applies to.

        The two properties, array and object, can be used to turn on or off the destructuring requirement for each of those types independently. By default, both are true.

        Alternatively, you can use separate configurations for different assignment types. It accepts 2 other keys instead of array and object.

        One key is VariableDeclarator and the other is AssignmentExpression, which can be used to control the destructuring requirement for each of those types independently. Each property accepts an object that accepts two properties, array and object, which can be used to control the destructuring requirement for each of array and object independently for variable declarations and assignment expressions. By default, array and object are set to true for both VariableDeclarator and AssignmentExpression.

        The rule has a second object with a single key, enforceForRenamedProperties, which determines whether the object destructuring applies to renamed variables.

        Note: It is not possible to determine if a variable will be referring to an object or an array at runtime. This rule therefore guesses the assignment type by checking whether the key being accessed is an integer. This can lead to the following possibly confusing situations:

        • Accessing an object property whose key is an integer will fall under the category array destructuring.
        • Accessing an array element through a computed index will fall under the category object destructuring.

        Examples of incorrect code for this rule:

        // With `array` enabled
        var foo = array[0];
        
        // With `object` enabled
        var foo = object.foo;
        var foo = object['foo'];

        Examples of correct code for this rule:

        // With `array` enabled
        var [ foo ] = array;
        var foo = array[someIndex];
        
        // With `object` enabled
        var { foo } = object;
        
        var foo = object.bar;
        
        let foo;
        ({ foo } = object);

        Examples of incorrect code when enforceForRenamedProperties is enabled:

        var foo = object.bar;

        Examples of correct code when enforceForRenamedProperties is enabled:

        var { bar: foo } = object;

        An example configuration, with the defaults array and object filled in, looks like this:

        {
          "rules": {
            "prefer-destructuring": ["error", {
              "array": true,
              "object": true
            }, {
              "enforceForRenamedProperties": false
            }]
          }
        }

        The two properties, array and object, which can be used to turn on or off the destructuring requirement for each of those types independently. By default, both are true.

        For example, the following configuration enforces only object destructuring, but not array destructuring:

        {
          "rules": {
            "prefer-destructuring": ["error", {"object": true, "array": false}]
          }
        }

        An example configuration, with the defaults VariableDeclarator and AssignmentExpression filled in, looks like this:

        {
          "rules": {
            "prefer-destructuring": ["error", {
              "VariableDeclarator": {
                "array": false,
                "object": true
              },
              "AssignmentExpression": {
                "array": true,
                "object": true
              }
            }, {
              "enforceForRenamedProperties": false
            }]
          }
        }

        The two properties, VariableDeclarator and AssignmentExpression, which can be used to turn on or off the destructuring requirement for array and object. By default, all values are true.

        For example, the following configuration enforces object destructuring in variable declarations and enforces array destructuring in assignment expressions.

        {
          "rules": {
            "prefer-destructuring": ["error", {
              "VariableDeclarator": {
                "array": false,
                "object": true
              },
              "AssignmentExpression": {
                "array": true,
                "object": false
              }
            }, {
              "enforceForRenamedProperties": false
            }]
          }
        }

        Examples of correct code when object destructuring in VariableDeclarator is enforced:

        /* eslint prefer-destructuring: ["error", {VariableDeclarator: {object: true}}] */
        var {bar: foo} = object;

        Examples of correct code when array destructuring in AssignmentExpression is enforced:

        /* eslint prefer-destructuring: ["error", {AssignmentExpression: {array: true}}] */
        [bar] = array;

        When Not To Use It

        If you want to be able to access array indices or object properties directly, you can either configure the rule to your tastes or disable the rule entirely.

        Additionally, if you intend to access large array indices directly, like:

        var foo = array[100];

        Then the array part of this rule is not recommended, as destructuring does not match this use case very well.

        Or for non-iterable 'array-like' objects:

        var $ = require('jquery');
        var foo = $('body')[0];
        var [bar] = $('body'); // fails with a TypeError

        Further Reading

        If you want to learn more about destructuring, check out the links below:

        Expected { after 'if' condition.
        Open

                    if (this.cycleOffset < 0)
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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/

        Closing curly brace does not appear on the same line as the subsequent block.
        Open

                }
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Require Brace Style (brace-style)

        Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

        The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

        if (foo) {
          bar();
        } else {
          baz();
        }

        One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

        if (foo) {
          bar();
        }
        else {
          baz();
        }

        Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

        if (foo)
        {
          bar();
        }
        else
        {
          baz();
        }

        While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

        Rule Details

        This rule enforces consistent brace style for blocks.

        Options

        This rule has a string option:

        • "1tbs" (default) enforces one true brace style
        • "stroustrup" enforces Stroustrup style
        • "allman" enforces Allman style

        This rule has an object option for an exception:

        • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

        1tbs

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

        /*eslint brace-style: "error"*/
        
        function foo()
        {
          return true;
        }
        
        if (foo)
        {
          bar();
        }
        
        try
        {
          somethingRisky();
        } catch(e)
        {
          handleError();
        }
        
        if (foo) {
          bar();
        }
        else {
          baz();
        }

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

        /*eslint brace-style: "error"*/
        
        function foo() {
          return true;
        }
        
        if (foo) {
          bar();
        }
        
        if (foo) {
          bar();
        } else {
          baz();
        }
        
        try {
          somethingRisky();
        } catch(e) {
          handleError();
        }
        
        // when there are no braces, there are no problems
        if (foo) bar();
        else if (baz) boom();

        Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

        /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
        
        function nop() { return; }
        
        if (foo) { bar(); }
        
        if (foo) { bar(); } else { baz(); }
        
        try { somethingRisky(); } catch(e) { handleError(); }
        
        if (foo) { baz(); } else {
          boom();
        }
        
        if (foo) { baz(); } else if (bar) {
          boom();
        }
        
        if (foo) { baz(); } else
        if (bar) {
          boom();
        }
        
        if (foo) { baz(); } else if (bar) {
          boom();
        }
        
        try { somethingRisky(); } catch(e) {
          handleError();
        }

        stroustrup

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

        /*eslint brace-style: ["error", "stroustrup"]*/
        
        function foo()
        {
          return true;
        }
        
        if (foo)
        {
          bar();
        }
        
        try
        {
          somethingRisky();
        } catch(e)
        {
          handleError();
        }
        
        if (foo) {
          bar();
        } else {
          baz();
        }

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

        /*eslint brace-style: ["error", "stroustrup"]*/
        
        function foo() {
          return true;
        }
        
        if (foo) {
          bar();
        }
        
        if (foo) {
          bar();
        }
        else {
          baz();
        }
        
        try {
          somethingRisky();
        }
        catch(e) {
          handleError();
        }
        
        // when there are no braces, there are no problems
        if (foo) bar();
        else if (baz) boom();

        Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

        /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
        
        function nop() { return; }
        
        if (foo) { bar(); }
        
        if (foo) { bar(); }
        else { baz(); }
        
        try { somethingRisky(); }
        catch(e) { handleError(); }

        allman

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

        /*eslint brace-style: ["error", "allman"]*/
        
        function foo() {
          return true;
        }
        
        if (foo)
        {
          bar(); }
        
        try
        {
          somethingRisky();
        } catch(e)
        {
          handleError();
        }
        
        if (foo) {
          bar();
        } else {
          baz();
        }

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

        /*eslint brace-style: ["error", "allman"]*/
        
        function foo()
        {
          return true;
        }
        
        if (foo)
        {
          bar();
        }
        
        if (foo)
        {
          bar();
        }
        else
        {
          baz();
        }
        
        try
        {
          somethingRisky();
        }
        catch(e)
        {
          handleError();
        }
        
        // when there are no braces, there are no problems
        if (foo) bar();
        else if (baz) boom();

        Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

        /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
        
        function nop() { return; }
        
        if (foo) { bar(); }
        
        if (foo) { bar(); }
        else { baz(); }
        
        try { somethingRisky(); }
        catch(e) { handleError(); }

        When Not To Use It

        If you don't want to enforce a particular brace style, don't enable this rule.

        Further Reading

        Use object destructuring.
        Open

                var timePeriod = simulationArea.timePeriod;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Prefer destructuring from arrays and objects (prefer-destructuring)

        With JavaScript ES6, a new syntax was added for creating variables from an array index or object property, called destructuring. This rule enforces usage of destructuring instead of accessing a property through a member expression.

        Rule Details

        Options

        This rule takes two sets of configuration objects. The first object parameter determines what types of destructuring the rule applies to.

        The two properties, array and object, can be used to turn on or off the destructuring requirement for each of those types independently. By default, both are true.

        Alternatively, you can use separate configurations for different assignment types. It accepts 2 other keys instead of array and object.

        One key is VariableDeclarator and the other is AssignmentExpression, which can be used to control the destructuring requirement for each of those types independently. Each property accepts an object that accepts two properties, array and object, which can be used to control the destructuring requirement for each of array and object independently for variable declarations and assignment expressions. By default, array and object are set to true for both VariableDeclarator and AssignmentExpression.

        The rule has a second object with a single key, enforceForRenamedProperties, which determines whether the object destructuring applies to renamed variables.

        Note: It is not possible to determine if a variable will be referring to an object or an array at runtime. This rule therefore guesses the assignment type by checking whether the key being accessed is an integer. This can lead to the following possibly confusing situations:

        • Accessing an object property whose key is an integer will fall under the category array destructuring.
        • Accessing an array element through a computed index will fall under the category object destructuring.

        Examples of incorrect code for this rule:

        // With `array` enabled
        var foo = array[0];
        
        // With `object` enabled
        var foo = object.foo;
        var foo = object['foo'];

        Examples of correct code for this rule:

        // With `array` enabled
        var [ foo ] = array;
        var foo = array[someIndex];
        
        // With `object` enabled
        var { foo } = object;
        
        var foo = object.bar;
        
        let foo;
        ({ foo } = object);

        Examples of incorrect code when enforceForRenamedProperties is enabled:

        var foo = object.bar;

        Examples of correct code when enforceForRenamedProperties is enabled:

        var { bar: foo } = object;

        An example configuration, with the defaults array and object filled in, looks like this:

        {
          "rules": {
            "prefer-destructuring": ["error", {
              "array": true,
              "object": true
            }, {
              "enforceForRenamedProperties": false
            }]
          }
        }

        The two properties, array and object, which can be used to turn on or off the destructuring requirement for each of those types independently. By default, both are true.

        For example, the following configuration enforces only object destructuring, but not array destructuring:

        {
          "rules": {
            "prefer-destructuring": ["error", {"object": true, "array": false}]
          }
        }

        An example configuration, with the defaults VariableDeclarator and AssignmentExpression filled in, looks like this:

        {
          "rules": {
            "prefer-destructuring": ["error", {
              "VariableDeclarator": {
                "array": false,
                "object": true
              },
              "AssignmentExpression": {
                "array": true,
                "object": true
              }
            }, {
              "enforceForRenamedProperties": false
            }]
          }
        }

        The two properties, VariableDeclarator and AssignmentExpression, which can be used to turn on or off the destructuring requirement for array and object. By default, all values are true.

        For example, the following configuration enforces object destructuring in variable declarations and enforces array destructuring in assignment expressions.

        {
          "rules": {
            "prefer-destructuring": ["error", {
              "VariableDeclarator": {
                "array": false,
                "object": true
              },
              "AssignmentExpression": {
                "array": true,
                "object": false
              }
            }, {
              "enforceForRenamedProperties": false
            }]
          }
        }

        Examples of correct code when object destructuring in VariableDeclarator is enforced:

        /* eslint prefer-destructuring: ["error", {VariableDeclarator: {object: true}}] */
        var {bar: foo} = object;

        Examples of correct code when array destructuring in AssignmentExpression is enforced:

        /* eslint prefer-destructuring: ["error", {AssignmentExpression: {array: true}}] */
        [bar] = array;

        When Not To Use It

        If you want to be able to access array indices or object properties directly, you can either configure the rule to your tastes or disable the rule entirely.

        Additionally, if you intend to access large array indices directly, like:

        var foo = array[100];

        Then the array part of this rule is not recommended, as destructuring does not match this use case very well.

        Or for non-iterable 'array-like' objects:

        var $ = require('jquery');
        var foo = $('body')[0];
        var [bar] = $('body'); // fails with a TypeError

        Further Reading

        If you want to learn more about destructuring, check out the links below:

        Use object destructuring.
        Open

                var width = this.width;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Prefer destructuring from arrays and objects (prefer-destructuring)

        With JavaScript ES6, a new syntax was added for creating variables from an array index or object property, called destructuring. This rule enforces usage of destructuring instead of accessing a property through a member expression.

        Rule Details

        Options

        This rule takes two sets of configuration objects. The first object parameter determines what types of destructuring the rule applies to.

        The two properties, array and object, can be used to turn on or off the destructuring requirement for each of those types independently. By default, both are true.

        Alternatively, you can use separate configurations for different assignment types. It accepts 2 other keys instead of array and object.

        One key is VariableDeclarator and the other is AssignmentExpression, which can be used to control the destructuring requirement for each of those types independently. Each property accepts an object that accepts two properties, array and object, which can be used to control the destructuring requirement for each of array and object independently for variable declarations and assignment expressions. By default, array and object are set to true for both VariableDeclarator and AssignmentExpression.

        The rule has a second object with a single key, enforceForRenamedProperties, which determines whether the object destructuring applies to renamed variables.

        Note: It is not possible to determine if a variable will be referring to an object or an array at runtime. This rule therefore guesses the assignment type by checking whether the key being accessed is an integer. This can lead to the following possibly confusing situations:

        • Accessing an object property whose key is an integer will fall under the category array destructuring.
        • Accessing an array element through a computed index will fall under the category object destructuring.

        Examples of incorrect code for this rule:

        // With `array` enabled
        var foo = array[0];
        
        // With `object` enabled
        var foo = object.foo;
        var foo = object['foo'];

        Examples of correct code for this rule:

        // With `array` enabled
        var [ foo ] = array;
        var foo = array[someIndex];
        
        // With `object` enabled
        var { foo } = object;
        
        var foo = object.bar;
        
        let foo;
        ({ foo } = object);

        Examples of incorrect code when enforceForRenamedProperties is enabled:

        var foo = object.bar;

        Examples of correct code when enforceForRenamedProperties is enabled:

        var { bar: foo } = object;

        An example configuration, with the defaults array and object filled in, looks like this:

        {
          "rules": {
            "prefer-destructuring": ["error", {
              "array": true,
              "object": true
            }, {
              "enforceForRenamedProperties": false
            }]
          }
        }

        The two properties, array and object, which can be used to turn on or off the destructuring requirement for each of those types independently. By default, both are true.

        For example, the following configuration enforces only object destructuring, but not array destructuring:

        {
          "rules": {
            "prefer-destructuring": ["error", {"object": true, "array": false}]
          }
        }

        An example configuration, with the defaults VariableDeclarator and AssignmentExpression filled in, looks like this:

        {
          "rules": {
            "prefer-destructuring": ["error", {
              "VariableDeclarator": {
                "array": false,
                "object": true
              },
              "AssignmentExpression": {
                "array": true,
                "object": true
              }
            }, {
              "enforceForRenamedProperties": false
            }]
          }
        }

        The two properties, VariableDeclarator and AssignmentExpression, which can be used to turn on or off the destructuring requirement for array and object. By default, all values are true.

        For example, the following configuration enforces object destructuring in variable declarations and enforces array destructuring in assignment expressions.

        {
          "rules": {
            "prefer-destructuring": ["error", {
              "VariableDeclarator": {
                "array": false,
                "object": true
              },
              "AssignmentExpression": {
                "array": true,
                "object": false
              }
            }, {
              "enforceForRenamedProperties": false
            }]
          }
        }

        Examples of correct code when object destructuring in VariableDeclarator is enforced:

        /* eslint prefer-destructuring: ["error", {VariableDeclarator: {object: true}}] */
        var {bar: foo} = object;

        Examples of correct code when array destructuring in AssignmentExpression is enforced:

        /* eslint prefer-destructuring: ["error", {AssignmentExpression: {array: true}}] */
        [bar] = array;

        When Not To Use It

        If you want to be able to access array indices or object properties directly, you can either configure the rule to your tastes or disable the rule entirely.

        Additionally, if you intend to access large array indices directly, like:

        var foo = array[100];

        Then the array part of this rule is not recommended, as destructuring does not match this use case very well.

        Or for non-iterable 'array-like' objects:

        var $ = require('jquery');
        var foo = $('body')[0];
        var [bar] = $('body'); // fails with a TypeError

        Further Reading

        If you want to learn more about destructuring, check out the links below:

        Expected no linebreak before this statement.
        Open

                        plotArea.scrollAcc = this.cycleOffset / 5;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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 space(s) after "for".
        Open

                    for(var j = 1; j < 5; j++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        enforce consistent spacing before and after keywords (keyword-spacing)

        Keywords are syntax elements of JavaScript, such as try and if. These keywords have special meaning to the language and so often appear in a different color in code editors. As an important part of the language, style guides often refer to the spacing that should be used around keywords. For example, you might have a style guide that says keywords should be always surrounded by spaces, which would mean if-else statements must look like this:

        if (foo) {
            // ...
        } else {
            // ...
        }

        Of course, you could also have a style guide that disallows spaces around keywords.

        However, if you want to enforce the style of spacing between the function keyword and the following opening parenthesis, please refer to [space-before-function-paren](space-before-function-paren.md).

        Rule Details

        This rule enforces consistent spacing around keywords and keyword-like tokens: as (in module declarations), async (of async functions), await (of await expressions), break, case, catch, class, const, continue, debugger, default, delete, do, else, export, extends, finally, for, from (in module declarations), function, get (of getters), if, import, in, instanceof, let, new, of (in for-of statements), return, set (of setters), static, super, switch, this, throw, try, typeof, var, void, while, with, and yield. This rule is designed carefully not to conflict with other spacing rules: it does not apply to spacing where other rules report problems.

        Options

        This rule has an object option:

        • "before": true (default) requires at least one space before keywords
        • "before": false disallows spaces before keywords
        • "after": true (default) requires at least one space after keywords
        • "after": false disallows spaces after keywords
        • "overrides" allows overriding spacing style for specified keywords

        before

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

        /*eslint keyword-spacing: ["error", { "before": true }]*/
        
        if (foo) {
            //...
        }else if (bar) {
            //...
        }else {
            //...
        }

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

        /*eslint keyword-spacing: ["error", { "before": true }]*/
        /*eslint-env es6*/
        
        if (foo) {
            //...
        } else if (bar) {
            //...
        } else {
            //...
        }
        
        // Avoid conflict with `array-bracket-spacing`
        let a = [this];
        let b = [function() {}];
        
        // Avoid conflict with `arrow-spacing`
        let a = ()=> this.foo;
        
        // Avoid conflict with `block-spacing`
        {function foo() {}}
        
        // Avoid conflict with `comma-spacing`
        let a = [100,this.foo, this.bar];
        
        // Avoid conflict with `computed-property-spacing`
        obj[this.foo] = 0;
        
        // Avoid conflict with `generator-star-spacing`
        function *foo() {}
        
        // Avoid conflict with `key-spacing`
        let obj = {
            foo:function() {}
        };
        
        // Avoid conflict with `object-curly-spacing`
        let obj = {foo: this};
        
        // Avoid conflict with `semi-spacing`
        let a = this;function foo() {}
        
        // Avoid conflict with `space-in-parens`
        (function () {})();
        
        // Avoid conflict with `space-infix-ops`
        if ("foo"in {foo: 0}) {}
        if (10+this.foo<= this.bar) {}
        
        // Avoid conflict with `jsx-curly-spacing`
        let a = 

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

        /*eslint keyword-spacing: ["error", { "before": false }]*/
        
        if (foo) {
            //...
        } else if (bar) {
            //...
        } else {
            //...
        }

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

        /*eslint keyword-spacing: ["error", { "before": false }]*/
        
        if (foo) {
            //...
        }else if (bar) {
            //...
        }else {
            //...
        }

        after

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

        /*eslint keyword-spacing: ["error", { "after": true }]*/
        
        if(foo) {
            //...
        } else if(bar) {
            //...
        } else{
            //...
        }

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

        /*eslint keyword-spacing: ["error", { "after": true }]*/
        
        if (foo) {
            //...
        } else if (bar) {
            //...
        } else {
            //...
        }
        
        // Avoid conflict with `array-bracket-spacing`
        let a = [this];
        
        // Avoid conflict with `arrow-spacing`
        let a = ()=> this.foo;
        
        // Avoid conflict with `comma-spacing`
        let a = [100, this.foo, this.bar];
        
        // Avoid conflict with `computed-property-spacing`
        obj[this.foo] = 0;
        
        // Avoid conflict with `generator-star-spacing`
        function* foo() {}
        
        // Avoid conflict with `key-spacing`
        let obj = {
            foo:function() {}
        };
        
        // Avoid conflict with `func-call-spacing`
        class A {
            constructor() {
                super();
            }
        }
        
        // Avoid conflict with `object-curly-spacing`
        let obj = {foo: this};
        
        // Avoid conflict with `semi-spacing`
        let a = this;function foo() {}
        
        // Avoid conflict with `space-before-function-paren`
        function() {}
        
        // Avoid conflict with `space-infix-ops`
        if ("foo"in{foo: 0}) {}
        if (10+this.foo<= this.bar) {}
        
        // Avoid conflict with `space-unary-ops`
        function* foo(a) {
            return yield+a;
        }
        
        // Avoid conflict with `yield-star-spacing`
        function* foo(a) {
            return yield* a;
        }
        
        // Avoid conflict with `jsx-curly-spacing`
        let a = 

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

        /*eslint keyword-spacing: ["error", { "after": false }]*/
        
        if (foo) {
            //...
        } else if (bar) {
            //...
        } else {
            //...
        }

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

        /*eslint keyword-spacing: ["error", { "after": false }]*/
        
        if(foo) {
            //...
        } else if(bar) {
            //...
        } else{
            //...
        }

        overrides

        Examples of correct code for this rule with the { "overrides": { "if": { "after": false }, "for": { "after": false }, "while": { "after": false } } } option:

        /*eslint keyword-spacing: ["error", { "overrides": {
          "if": { "after": false },
          "for": { "after": false },
          "while": { "after": false }
        } }]*/
        
        if(foo) {
            //...
        } else if(bar) {
            //...
        } else {
            //...
        }
        
        for(;;);
        
        while(true) {
          //...
        }

        When Not To Use It

        If you don't want to enforce consistency on keyword spacing, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

        Unexpected use of continue statement.
        Open

                                    continue;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        disallow continue statements (no-continue)

        The continue statement terminates execution of the statements in the current iteration of the current or labeled loop, and continues execution of the loop with the next iteration. When used incorrectly it makes code less testable, less readable and less maintainable. Structured control flow statements such as if should be used instead.

        var sum = 0,
            i;
        
        for(i = 0; i < 10; i++) {
            if(i >= 5) {
                continue;
            }
        
            a += i;
        }

        Rule Details

        This rule disallows continue statements.

        Examples of incorrect code for this rule:

        /*eslint no-continue: "error"*/
        
        var sum = 0,
            i;
        
        for(i = 0; i < 10; i++) {
            if(i >= 5) {
                continue;
            }
        
            a += i;
        }
        /*eslint no-continue: "error"*/
        
        var sum = 0,
            i;
        
        labeledLoop: for(i = 0; i < 10; i++) {
            if(i >= 5) {
                continue labeledLoop;
            }
        
            a += i;
        }

        Examples of correct code for this rule:

        /*eslint no-continue: "error"*/
        
        var sum = 0,
            i;
        
        for(i = 0; i < 10; i++) {
            if(i < 5) {
               a += i;
            }
        }

        Compatibility

        Use object destructuring.
        Open

                var unitUsed = this.unitUsed;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Prefer destructuring from arrays and objects (prefer-destructuring)

        With JavaScript ES6, a new syntax was added for creating variables from an array index or object property, called destructuring. This rule enforces usage of destructuring instead of accessing a property through a member expression.

        Rule Details

        Options

        This rule takes two sets of configuration objects. The first object parameter determines what types of destructuring the rule applies to.

        The two properties, array and object, can be used to turn on or off the destructuring requirement for each of those types independently. By default, both are true.

        Alternatively, you can use separate configurations for different assignment types. It accepts 2 other keys instead of array and object.

        One key is VariableDeclarator and the other is AssignmentExpression, which can be used to control the destructuring requirement for each of those types independently. Each property accepts an object that accepts two properties, array and object, which can be used to control the destructuring requirement for each of array and object independently for variable declarations and assignment expressions. By default, array and object are set to true for both VariableDeclarator and AssignmentExpression.

        The rule has a second object with a single key, enforceForRenamedProperties, which determines whether the object destructuring applies to renamed variables.

        Note: It is not possible to determine if a variable will be referring to an object or an array at runtime. This rule therefore guesses the assignment type by checking whether the key being accessed is an integer. This can lead to the following possibly confusing situations:

        • Accessing an object property whose key is an integer will fall under the category array destructuring.
        • Accessing an array element through a computed index will fall under the category object destructuring.

        Examples of incorrect code for this rule:

        // With `array` enabled
        var foo = array[0];
        
        // With `object` enabled
        var foo = object.foo;
        var foo = object['foo'];

        Examples of correct code for this rule:

        // With `array` enabled
        var [ foo ] = array;
        var foo = array[someIndex];
        
        // With `object` enabled
        var { foo } = object;
        
        var foo = object.bar;
        
        let foo;
        ({ foo } = object);

        Examples of incorrect code when enforceForRenamedProperties is enabled:

        var foo = object.bar;

        Examples of correct code when enforceForRenamedProperties is enabled:

        var { bar: foo } = object;

        An example configuration, with the defaults array and object filled in, looks like this:

        {
          "rules": {
            "prefer-destructuring": ["error", {
              "array": true,
              "object": true
            }, {
              "enforceForRenamedProperties": false
            }]
          }
        }

        The two properties, array and object, which can be used to turn on or off the destructuring requirement for each of those types independently. By default, both are true.

        For example, the following configuration enforces only object destructuring, but not array destructuring:

        {
          "rules": {
            "prefer-destructuring": ["error", {"object": true, "array": false}]
          }
        }

        An example configuration, with the defaults VariableDeclarator and AssignmentExpression filled in, looks like this:

        {
          "rules": {
            "prefer-destructuring": ["error", {
              "VariableDeclarator": {
                "array": false,
                "object": true
              },
              "AssignmentExpression": {
                "array": true,
                "object": true
              }
            }, {
              "enforceForRenamedProperties": false
            }]
          }
        }

        The two properties, VariableDeclarator and AssignmentExpression, which can be used to turn on or off the destructuring requirement for array and object. By default, all values are true.

        For example, the following configuration enforces object destructuring in variable declarations and enforces array destructuring in assignment expressions.

        {
          "rules": {
            "prefer-destructuring": ["error", {
              "VariableDeclarator": {
                "array": false,
                "object": true
              },
              "AssignmentExpression": {
                "array": true,
                "object": false
              }
            }, {
              "enforceForRenamedProperties": false
            }]
          }
        }

        Examples of correct code when object destructuring in VariableDeclarator is enforced:

        /* eslint prefer-destructuring: ["error", {VariableDeclarator: {object: true}}] */
        var {bar: foo} = object;

        Examples of correct code when array destructuring in AssignmentExpression is enforced:

        /* eslint prefer-destructuring: ["error", {AssignmentExpression: {array: true}}] */
        [bar] = array;

        When Not To Use It

        If you want to be able to access array indices or object properties directly, you can either configure the rule to your tastes or disable the rule entirely.

        Additionally, if you intend to access large array indices directly, like:

        var foo = array[100];

        Then the array part of this rule is not recommended, as destructuring does not match this use case very well.

        Or for non-iterable 'array-like' objects:

        var $ = require('jquery');
        var foo = $('body')[0];
        var [bar] = $('body'); // fails with a TypeError

        Further Reading

        If you want to learn more about destructuring, check out the links below:

        Missing semicolon.
        Open

            })
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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/

        Missing semicolon.
        Open

            })
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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/

        Expected { after 'if' condition.
        Open

                                if (x1 < timeLineStartX)
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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/

        Expected space(s) after "if".
        Open

                        if(value === undefined) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        enforce consistent spacing before and after keywords (keyword-spacing)

        Keywords are syntax elements of JavaScript, such as try and if. These keywords have special meaning to the language and so often appear in a different color in code editors. As an important part of the language, style guides often refer to the spacing that should be used around keywords. For example, you might have a style guide that says keywords should be always surrounded by spaces, which would mean if-else statements must look like this:

        if (foo) {
            // ...
        } else {
            // ...
        }

        Of course, you could also have a style guide that disallows spaces around keywords.

        However, if you want to enforce the style of spacing between the function keyword and the following opening parenthesis, please refer to [space-before-function-paren](space-before-function-paren.md).

        Rule Details

        This rule enforces consistent spacing around keywords and keyword-like tokens: as (in module declarations), async (of async functions), await (of await expressions), break, case, catch, class, const, continue, debugger, default, delete, do, else, export, extends, finally, for, from (in module declarations), function, get (of getters), if, import, in, instanceof, let, new, of (in for-of statements), return, set (of setters), static, super, switch, this, throw, try, typeof, var, void, while, with, and yield. This rule is designed carefully not to conflict with other spacing rules: it does not apply to spacing where other rules report problems.

        Options

        This rule has an object option:

        • "before": true (default) requires at least one space before keywords
        • "before": false disallows spaces before keywords
        • "after": true (default) requires at least one space after keywords
        • "after": false disallows spaces after keywords
        • "overrides" allows overriding spacing style for specified keywords

        before

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

        /*eslint keyword-spacing: ["error", { "before": true }]*/
        
        if (foo) {
            //...
        }else if (bar) {
            //...
        }else {
            //...
        }

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

        /*eslint keyword-spacing: ["error", { "before": true }]*/
        /*eslint-env es6*/
        
        if (foo) {
            //...
        } else if (bar) {
            //...
        } else {
            //...
        }
        
        // Avoid conflict with `array-bracket-spacing`
        let a = [this];
        let b = [function() {}];
        
        // Avoid conflict with `arrow-spacing`
        let a = ()=> this.foo;
        
        // Avoid conflict with `block-spacing`
        {function foo() {}}
        
        // Avoid conflict with `comma-spacing`
        let a = [100,this.foo, this.bar];
        
        // Avoid conflict with `computed-property-spacing`
        obj[this.foo] = 0;
        
        // Avoid conflict with `generator-star-spacing`
        function *foo() {}
        
        // Avoid conflict with `key-spacing`
        let obj = {
            foo:function() {}
        };
        
        // Avoid conflict with `object-curly-spacing`
        let obj = {foo: this};
        
        // Avoid conflict with `semi-spacing`
        let a = this;function foo() {}
        
        // Avoid conflict with `space-in-parens`
        (function () {})();
        
        // Avoid conflict with `space-infix-ops`
        if ("foo"in {foo: 0}) {}
        if (10+this.foo<= this.bar) {}
        
        // Avoid conflict with `jsx-curly-spacing`
        let a = 

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

        /*eslint keyword-spacing: ["error", { "before": false }]*/
        
        if (foo) {
            //...
        } else if (bar) {
            //...
        } else {
            //...
        }

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

        /*eslint keyword-spacing: ["error", { "before": false }]*/
        
        if (foo) {
            //...
        }else if (bar) {
            //...
        }else {
            //...
        }

        after

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

        /*eslint keyword-spacing: ["error", { "after": true }]*/
        
        if(foo) {
            //...
        } else if(bar) {
            //...
        } else{
            //...
        }

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

        /*eslint keyword-spacing: ["error", { "after": true }]*/
        
        if (foo) {
            //...
        } else if (bar) {
            //...
        } else {
            //...
        }
        
        // Avoid conflict with `array-bracket-spacing`
        let a = [this];
        
        // Avoid conflict with `arrow-spacing`
        let a = ()=> this.foo;
        
        // Avoid conflict with `comma-spacing`
        let a = [100, this.foo, this.bar];
        
        // Avoid conflict with `computed-property-spacing`
        obj[this.foo] = 0;
        
        // Avoid conflict with `generator-star-spacing`
        function* foo() {}
        
        // Avoid conflict with `key-spacing`
        let obj = {
            foo:function() {}
        };
        
        // Avoid conflict with `func-call-spacing`
        class A {
            constructor() {
                super();
            }
        }
        
        // Avoid conflict with `object-curly-spacing`
        let obj = {foo: this};
        
        // Avoid conflict with `semi-spacing`
        let a = this;function foo() {}
        
        // Avoid conflict with `space-before-function-paren`
        function() {}
        
        // Avoid conflict with `space-infix-ops`
        if ("foo"in{foo: 0}) {}
        if (10+this.foo<= this.bar) {}
        
        // Avoid conflict with `space-unary-ops`
        function* foo(a) {
            return yield+a;
        }
        
        // Avoid conflict with `yield-star-spacing`
        function* foo(a) {
            return yield* a;
        }
        
        // Avoid conflict with `jsx-curly-spacing`
        let a = 

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

        /*eslint keyword-spacing: ["error", { "after": false }]*/
        
        if (foo) {
            //...
        } else if (bar) {
            //...
        } else {
            //...
        }

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

        /*eslint keyword-spacing: ["error", { "after": false }]*/
        
        if(foo) {
            //...
        } else if(bar) {
            //...
        } else{
            //...
        }

        overrides

        Examples of correct code for this rule with the { "overrides": { "if": { "after": false }, "for": { "after": false }, "while": { "after": false } } } option:

        /*eslint keyword-spacing: ["error", { "overrides": {
          "if": { "after": false },
          "for": { "after": false },
          "while": { "after": false }
        } }]*/
        
        if(foo) {
            //...
        } else if(bar) {
            //...
        } else {
            //...
        }
        
        for(;;);
        
        while(true) {
          //...
        }

        When Not To Use It

        If you don't want to enforce consistency on keyword spacing, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

        Closing curly brace does not appear on the same line as the subsequent block.
        Open

                            }
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Require Brace Style (brace-style)

        Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

        The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

        if (foo) {
          bar();
        } else {
          baz();
        }

        One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

        if (foo) {
          bar();
        }
        else {
          baz();
        }

        Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

        if (foo)
        {
          bar();
        }
        else
        {
          baz();
        }

        While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

        Rule Details

        This rule enforces consistent brace style for blocks.

        Options

        This rule has a string option:

        • "1tbs" (default) enforces one true brace style
        • "stroustrup" enforces Stroustrup style
        • "allman" enforces Allman style

        This rule has an object option for an exception:

        • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

        1tbs

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

        /*eslint brace-style: "error"*/
        
        function foo()
        {
          return true;
        }
        
        if (foo)
        {
          bar();
        }
        
        try
        {
          somethingRisky();
        } catch(e)
        {
          handleError();
        }
        
        if (foo) {
          bar();
        }
        else {
          baz();
        }

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

        /*eslint brace-style: "error"*/
        
        function foo() {
          return true;
        }
        
        if (foo) {
          bar();
        }
        
        if (foo) {
          bar();
        } else {
          baz();
        }
        
        try {
          somethingRisky();
        } catch(e) {
          handleError();
        }
        
        // when there are no braces, there are no problems
        if (foo) bar();
        else if (baz) boom();

        Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

        /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
        
        function nop() { return; }
        
        if (foo) { bar(); }
        
        if (foo) { bar(); } else { baz(); }
        
        try { somethingRisky(); } catch(e) { handleError(); }
        
        if (foo) { baz(); } else {
          boom();
        }
        
        if (foo) { baz(); } else if (bar) {
          boom();
        }
        
        if (foo) { baz(); } else
        if (bar) {
          boom();
        }
        
        if (foo) { baz(); } else if (bar) {
          boom();
        }
        
        try { somethingRisky(); } catch(e) {
          handleError();
        }

        stroustrup

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

        /*eslint brace-style: ["error", "stroustrup"]*/
        
        function foo()
        {
          return true;
        }
        
        if (foo)
        {
          bar();
        }
        
        try
        {
          somethingRisky();
        } catch(e)
        {
          handleError();
        }
        
        if (foo) {
          bar();
        } else {
          baz();
        }

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

        /*eslint brace-style: ["error", "stroustrup"]*/
        
        function foo() {
          return true;
        }
        
        if (foo) {
          bar();
        }
        
        if (foo) {
          bar();
        }
        else {
          baz();
        }
        
        try {
          somethingRisky();
        }
        catch(e) {
          handleError();
        }
        
        // when there are no braces, there are no problems
        if (foo) bar();
        else if (baz) boom();

        Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

        /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
        
        function nop() { return; }
        
        if (foo) { bar(); }
        
        if (foo) { bar(); }
        else { baz(); }
        
        try { somethingRisky(); }
        catch(e) { handleError(); }

        allman

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

        /*eslint brace-style: ["error", "allman"]*/
        
        function foo() {
          return true;
        }
        
        if (foo)
        {
          bar(); }
        
        try
        {
          somethingRisky();
        } catch(e)
        {
          handleError();
        }
        
        if (foo) {
          bar();
        } else {
          baz();
        }

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

        /*eslint brace-style: ["error", "allman"]*/
        
        function foo()
        {
          return true;
        }
        
        if (foo)
        {
          bar();
        }
        
        if (foo)
        {
          bar();
        }
        else
        {
          baz();
        }
        
        try
        {
          somethingRisky();
        }
        catch(e)
        {
          handleError();
        }
        
        // when there are no braces, there are no problems
        if (foo) bar();
        else if (baz) boom();

        Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

        /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
        
        function nop() { return; }
        
        if (foo) { bar(); }
        
        if (foo) { bar(); }
        else { baz(); }
        
        try { somethingRisky(); }
        catch(e) { handleError(); }

        When Not To Use It

        If you don't want to enforce a particular brace style, don't enable this rule.

        Further Reading

        Missing semicolon.
        Open

            })
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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/

        Missing semicolon.
        Open

            })
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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/

        Missing space before function parentheses.
        Open

            $('#timing-diagram-units').on('change paste keyup', function() {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Require or disallow a space before function parenthesis (space-before-function-paren)

        When formatting a function, whitespace is allowed between the function name or function keyword and the opening paren. Named functions also require a space between the function keyword and the function name, but anonymous functions require no whitespace. For example:

        function withoutSpace(x) {
            // ...
        }
        
        function withSpace (x) {
            // ...
        }
        
        var anonymousWithoutSpace = function() {};
        
        var anonymousWithSpace = function () {};

        Style guides may require a space after the function keyword for anonymous functions, while others specify no whitespace. Similarly, the space after a function name may or may not be required.

        Rule Details

        This rule aims to enforce consistent spacing before function parentheses and as such, will warn whenever whitespace doesn't match the preferences specified.

        Options

        This rule has a string option or an object option:

        {
            "space-before-function-paren": ["error", "always"],
            // or
            "space-before-function-paren": ["error", {
                "anonymous": "always",
                "named": "always",
                "asyncArrow": "always"
            }],
        }
        • always (default) requires a space followed by the ( of arguments.
        • never disallows any space followed by the ( of arguments.

        The string option does not check async arrow function expressions for backward compatibility.

        You can also use a separate option for each type of function. Each of the following options can be set to "always", "never", or "ignore". The default is "always".

        • anonymous is for anonymous function expressions (e.g. function () {}).
        • named is for named function expressions (e.g. function foo () {}).
        • asyncArrow is for async arrow function expressions (e.g. async () => {}).

        "always"

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

        /*eslint space-before-function-paren: "error"*/
        /*eslint-env es6*/
        
        function foo() {
            // ...
        }
        
        var bar = function() {
            // ...
        };
        
        var bar = function foo() {
            // ...
        };
        
        class Foo {
            constructor() {
                // ...
            }
        }
        
        var foo = {
            bar() {
                // ...
            }
        };
        
        var foo = async() => 1

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

        /*eslint space-before-function-paren: "error"*/
        /*eslint-env es6*/
        
        function foo () {
            // ...
        }
        
        var bar = function () {
            // ...
        };
        
        var bar = function foo () {
            // ...
        };
        
        class Foo {
            constructor () {
                // ...
            }
        }
        
        var foo = {
            bar () {
                // ...
            }
        };
        
        var foo = async () => 1

        "never"

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

        /*eslint space-before-function-paren: ["error", "never"]*/
        /*eslint-env es6*/
        
        function foo () {
            // ...
        }
        
        var bar = function () {
            // ...
        };
        
        var bar = function foo () {
            // ...
        };
        
        class Foo {
            constructor () {
                // ...
            }
        }
        
        var foo = {
            bar () {
                // ...
            }
        };
        
        var foo = async () => 1

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

        /*eslint space-before-function-paren: ["error", "never"]*/
        /*eslint-env es6*/
        
        function foo() {
            // ...
        }
        
        var bar = function() {
            // ...
        };
        
        var bar = function foo() {
            // ...
        };
        
        class Foo {
            constructor() {
                // ...
            }
        }
        
        var foo = {
            bar() {
                // ...
            }
        };
        
        var foo = async() => 1

        {"anonymous": "always", "named": "never", "asyncArrow": "always"}

        Examples of incorrect code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

        /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
        /*eslint-env es6*/
        
        function foo () {
            // ...
        }
        
        var bar = function() {
            // ...
        };
        
        class Foo {
            constructor () {
                // ...
            }
        }
        
        var foo = {
            bar () {
                // ...
            }
        };
        
        var foo = async(a) => await a

        Examples of correct code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

        /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
        /*eslint-env es6*/
        
        function foo() {
            // ...
        }
        
        var bar = function () {
            // ...
        };
        
        class Foo {
            constructor() {
                // ...
            }
        }
        
        var foo = {
            bar() {
                // ...
            }
        };
        
        var foo = async (a) => await a

        {"anonymous": "never", "named": "always"}

        Examples of incorrect code for this rule with the {"anonymous": "never", "named": "always"} option:

        /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
        /*eslint-env es6*/
        
        function foo() {
            // ...
        }
        
        var bar = function () {
            // ...
        };
        
        class Foo {
            constructor() {
                // ...
            }
        }
        
        var foo = {
            bar() {
                // ...
            }
        };

        Examples of correct code for this rule with the {"anonymous": "never", "named": "always"} option:

        /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
        /*eslint-env es6*/
        
        function foo () {
            // ...
        }
        
        var bar = function() {
            // ...
        };
        
        class Foo {
            constructor () {
                // ...
            }
        }
        
        var foo = {
            bar () {
                // ...
            }
        };

        {"anonymous": "ignore", "named": "always"}

        Examples of incorrect code for this rule with the {"anonymous": "ignore", "named": "always"} option:

        /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
        /*eslint-env es6*/
        
        function foo() {
            // ...
        }
        
        class Foo {
            constructor() {
                // ...
            }
        }
        
        var foo = {
            bar() {
                // ...
            }
        };

        Examples of correct code for this rule with the {"anonymous": "ignore", "named": "always"} option:

        /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
        /*eslint-env es6*/
        
        var bar = function() {
            // ...
        };
        
        var bar = function () {
            // ...
        };
        
        function foo () {
            // ...
        }
        
        class Foo {
            constructor () {
                // ...
            }
        }
        
        var foo = {
            bar () {
                // ...
            }
        };

        When Not To Use It

        You can turn this rule off if you are not concerned with the consistency of spacing before function parenthesis.

        Related Rules

        Strings must use singlequote.
        Open

                var img = this.canvas.toDataURL(`image/png`);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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/

        Use object destructuring.
        Open

                var ctx = this.ctx;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Prefer destructuring from arrays and objects (prefer-destructuring)

        With JavaScript ES6, a new syntax was added for creating variables from an array index or object property, called destructuring. This rule enforces usage of destructuring instead of accessing a property through a member expression.

        Rule Details

        Options

        This rule takes two sets of configuration objects. The first object parameter determines what types of destructuring the rule applies to.

        The two properties, array and object, can be used to turn on or off the destructuring requirement for each of those types independently. By default, both are true.

        Alternatively, you can use separate configurations for different assignment types. It accepts 2 other keys instead of array and object.

        One key is VariableDeclarator and the other is AssignmentExpression, which can be used to control the destructuring requirement for each of those types independently. Each property accepts an object that accepts two properties, array and object, which can be used to control the destructuring requirement for each of array and object independently for variable declarations and assignment expressions. By default, array and object are set to true for both VariableDeclarator and AssignmentExpression.

        The rule has a second object with a single key, enforceForRenamedProperties, which determines whether the object destructuring applies to renamed variables.

        Note: It is not possible to determine if a variable will be referring to an object or an array at runtime. This rule therefore guesses the assignment type by checking whether the key being accessed is an integer. This can lead to the following possibly confusing situations:

        • Accessing an object property whose key is an integer will fall under the category array destructuring.
        • Accessing an array element through a computed index will fall under the category object destructuring.

        Examples of incorrect code for this rule:

        // With `array` enabled
        var foo = array[0];
        
        // With `object` enabled
        var foo = object.foo;
        var foo = object['foo'];

        Examples of correct code for this rule:

        // With `array` enabled
        var [ foo ] = array;
        var foo = array[someIndex];
        
        // With `object` enabled
        var { foo } = object;
        
        var foo = object.bar;
        
        let foo;
        ({ foo } = object);

        Examples of incorrect code when enforceForRenamedProperties is enabled:

        var foo = object.bar;

        Examples of correct code when enforceForRenamedProperties is enabled:

        var { bar: foo } = object;

        An example configuration, with the defaults array and object filled in, looks like this:

        {
          "rules": {
            "prefer-destructuring": ["error", {
              "array": true,
              "object": true
            }, {
              "enforceForRenamedProperties": false
            }]
          }
        }

        The two properties, array and object, which can be used to turn on or off the destructuring requirement for each of those types independently. By default, both are true.

        For example, the following configuration enforces only object destructuring, but not array destructuring:

        {
          "rules": {
            "prefer-destructuring": ["error", {"object": true, "array": false}]
          }
        }

        An example configuration, with the defaults VariableDeclarator and AssignmentExpression filled in, looks like this:

        {
          "rules": {
            "prefer-destructuring": ["error", {
              "VariableDeclarator": {
                "array": false,
                "object": true
              },
              "AssignmentExpression": {
                "array": true,
                "object": true
              }
            }, {
              "enforceForRenamedProperties": false
            }]
          }
        }

        The two properties, VariableDeclarator and AssignmentExpression, which can be used to turn on or off the destructuring requirement for array and object. By default, all values are true.

        For example, the following configuration enforces object destructuring in variable declarations and enforces array destructuring in assignment expressions.

        {
          "rules": {
            "prefer-destructuring": ["error", {
              "VariableDeclarator": {
                "array": false,
                "object": true
              },
              "AssignmentExpression": {
                "array": true,
                "object": false
              }
            }, {
              "enforceForRenamedProperties": false
            }]
          }
        }

        Examples of correct code when object destructuring in VariableDeclarator is enforced:

        /* eslint prefer-destructuring: ["error", {VariableDeclarator: {object: true}}] */
        var {bar: foo} = object;

        Examples of correct code when array destructuring in AssignmentExpression is enforced:

        /* eslint prefer-destructuring: ["error", {AssignmentExpression: {array: true}}] */
        [bar] = array;

        When Not To Use It

        If you want to be able to access array indices or object properties directly, you can either configure the rule to your tastes or disable the rule entirely.

        Additionally, if you intend to access large array indices directly, like:

        var foo = array[100];

        Then the array part of this rule is not recommended, as destructuring does not match this use case very well.

        Or for non-iterable 'array-like' objects:

        var $ = require('jquery');
        var foo = $('body')[0];
        var [bar] = $('body'); // fails with a TypeError

        Further Reading

        If you want to learn more about destructuring, check out the links below:

        Unexpected whitespace before semicolon.
        Open

                for (var i = Math.floor(plotArea.cycleOffset); getCycleStartX(i) <= width ; i++) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Enforce spacing before and after semicolons (semi-spacing)

        JavaScript allows you to place unnecessary spaces before or after a semicolon.

        Disallowing or enforcing space around a semicolon can improve the readability of your program.

        var a = "b" ;
        
        var c = "d";var e = "f";

        Rule Details

        This rule aims to enforce spacing around a semicolon. This rule prevents the use of spaces before a semicolon in expressions.

        This rule doesn't check spacing in the following cases:

        • The spacing after the semicolon if it is the first token in the line.

        • The spacing before the semicolon if it is after an opening parenthesis (( or {), or the spacing after the semicolon if it is before a closing parenthesis () or }). That spacing is checked by space-in-parens or block-spacing.

        • The spacing around the semicolon in a for loop with an empty condition (for(;;)).

        Options

        The rule takes one option, an object, which has two keys before and after having boolean values true or false. If before is true, space is enforced before semicolons and if it's false, space is disallowed before semicolons. If after is true, space is enforced after semicolons and if it's false, space is disallowed after semicolons. The after option will be only applied if a semicolon is not at the end of line.

        The default is {"before": false, "after": true}.

        "semi-spacing": ["error", {"before": false, "after": true}]

        {"before": false, "after": true}

        This is the default option. It enforces spacing after semicolons and disallows spacing before semicolons.

        Examples of incorrect code for this rule:

        /*eslint semi-spacing: "error"*/
        
        var foo ;
        var foo;var bar;
        throw new Error("error") ;
        while (a) { break ; }
        for (i = 0 ; i < 10 ; i++) {}
        for (i = 0;i < 10;i++) {}

        Examples of correct code for this rule:

        /*eslint semi-spacing: "error"*/
        
        var foo;
        var foo; var bar;
        throw new Error("error");
        while (a) { break; }
        for (i = 0; i < 10; i++) {}
        for (;;) {}
        if (true) {;}
        ;foo();

        {"before": true, "after": false}

        This option enforces spacing before semicolons and disallows spacing after semicolons.

        Examples of incorrect code for this rule with the {"before": true, "after": false} option:

        /*eslint semi-spacing: ["error", { "before": true, "after": false }]*/
        
        var foo;
        var foo ; var bar;
        throw new Error("error");
        while (a) { break; }
        for (i = 0;i < 10;i++) {}
        for (i = 0; i < 10; i++) {}

        Examples of correct code for this rule with the {"before": true, "after": false} option:

        /*eslint semi-spacing: ["error", { "before": true, "after": false }]*/
        
        var foo ;
        var foo ;var bar ;
        throw new Error("error") ;
        while (a) {break ;}
        for (i = 0 ;i < 10 ;i++) {}

        When Not To Use It

        You can turn this rule off if you are not concerned with the consistency of spacing before or after semicolons.

        Related Rules

        • [semi](semi.md)
        • [no-extra-semi](no-extra-semi.md)
        • [comma-spacing](comma-spacing.md)
        • [block-spacing](block-spacing.md)
        • [space-in-parens](space-in-parens.md) Source: http://eslint.org/docs/rules/

        Operator '/' must be spaced.
        Open

                        ctx.fillText(`${i}`, x, timeLineHeight - sh(15)/2);
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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/

        Missing semicolon.
        Open

            })
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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/

        Missing semicolon.
        Open

            })
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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/

        Missing semicolon.
        Open

            })
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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/

        Expected space(s) after "if".
        Open

                            if(j + 1 != plotValues.length) {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        enforce consistent spacing before and after keywords (keyword-spacing)

        Keywords are syntax elements of JavaScript, such as try and if. These keywords have special meaning to the language and so often appear in a different color in code editors. As an important part of the language, style guides often refer to the spacing that should be used around keywords. For example, you might have a style guide that says keywords should be always surrounded by spaces, which would mean if-else statements must look like this:

        if (foo) {
            // ...
        } else {
            // ...
        }

        Of course, you could also have a style guide that disallows spaces around keywords.

        However, if you want to enforce the style of spacing between the function keyword and the following opening parenthesis, please refer to [space-before-function-paren](space-before-function-paren.md).

        Rule Details

        This rule enforces consistent spacing around keywords and keyword-like tokens: as (in module declarations), async (of async functions), await (of await expressions), break, case, catch, class, const, continue, debugger, default, delete, do, else, export, extends, finally, for, from (in module declarations), function, get (of getters), if, import, in, instanceof, let, new, of (in for-of statements), return, set (of setters), static, super, switch, this, throw, try, typeof, var, void, while, with, and yield. This rule is designed carefully not to conflict with other spacing rules: it does not apply to spacing where other rules report problems.

        Options

        This rule has an object option:

        • "before": true (default) requires at least one space before keywords
        • "before": false disallows spaces before keywords
        • "after": true (default) requires at least one space after keywords
        • "after": false disallows spaces after keywords
        • "overrides" allows overriding spacing style for specified keywords

        before

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

        /*eslint keyword-spacing: ["error", { "before": true }]*/
        
        if (foo) {
            //...
        }else if (bar) {
            //...
        }else {
            //...
        }

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

        /*eslint keyword-spacing: ["error", { "before": true }]*/
        /*eslint-env es6*/
        
        if (foo) {
            //...
        } else if (bar) {
            //...
        } else {
            //...
        }
        
        // Avoid conflict with `array-bracket-spacing`
        let a = [this];
        let b = [function() {}];
        
        // Avoid conflict with `arrow-spacing`
        let a = ()=> this.foo;
        
        // Avoid conflict with `block-spacing`
        {function foo() {}}
        
        // Avoid conflict with `comma-spacing`
        let a = [100,this.foo, this.bar];
        
        // Avoid conflict with `computed-property-spacing`
        obj[this.foo] = 0;
        
        // Avoid conflict with `generator-star-spacing`
        function *foo() {}
        
        // Avoid conflict with `key-spacing`
        let obj = {
            foo:function() {}
        };
        
        // Avoid conflict with `object-curly-spacing`
        let obj = {foo: this};
        
        // Avoid conflict with `semi-spacing`
        let a = this;function foo() {}
        
        // Avoid conflict with `space-in-parens`
        (function () {})();
        
        // Avoid conflict with `space-infix-ops`
        if ("foo"in {foo: 0}) {}
        if (10+this.foo<= this.bar) {}
        
        // Avoid conflict with `jsx-curly-spacing`
        let a = 

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

        /*eslint keyword-spacing: ["error", { "before": false }]*/
        
        if (foo) {
            //...
        } else if (bar) {
            //...
        } else {
            //...
        }

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

        /*eslint keyword-spacing: ["error", { "before": false }]*/
        
        if (foo) {
            //...
        }else if (bar) {
            //...
        }else {
            //...
        }

        after

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

        /*eslint keyword-spacing: ["error", { "after": true }]*/
        
        if(foo) {
            //...
        } else if(bar) {
            //...
        } else{
            //...
        }

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

        /*eslint keyword-spacing: ["error", { "after": true }]*/
        
        if (foo) {
            //...
        } else if (bar) {
            //...
        } else {
            //...
        }
        
        // Avoid conflict with `array-bracket-spacing`
        let a = [this];
        
        // Avoid conflict with `arrow-spacing`
        let a = ()=> this.foo;
        
        // Avoid conflict with `comma-spacing`
        let a = [100, this.foo, this.bar];
        
        // Avoid conflict with `computed-property-spacing`
        obj[this.foo] = 0;
        
        // Avoid conflict with `generator-star-spacing`
        function* foo() {}
        
        // Avoid conflict with `key-spacing`
        let obj = {
            foo:function() {}
        };
        
        // Avoid conflict with `func-call-spacing`
        class A {
            constructor() {
                super();
            }
        }
        
        // Avoid conflict with `object-curly-spacing`
        let obj = {foo: this};
        
        // Avoid conflict with `semi-spacing`
        let a = this;function foo() {}
        
        // Avoid conflict with `space-before-function-paren`
        function() {}
        
        // Avoid conflict with `space-infix-ops`
        if ("foo"in{foo: 0}) {}
        if (10+this.foo<= this.bar) {}
        
        // Avoid conflict with `space-unary-ops`
        function* foo(a) {
            return yield+a;
        }
        
        // Avoid conflict with `yield-star-spacing`
        function* foo(a) {
            return yield* a;
        }
        
        // Avoid conflict with `jsx-curly-spacing`
        let a = 

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

        /*eslint keyword-spacing: ["error", { "after": false }]*/
        
        if (foo) {
            //...
        } else if (bar) {
            //...
        } else {
            //...
        }

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

        /*eslint keyword-spacing: ["error", { "after": false }]*/
        
        if(foo) {
            //...
        } else if(bar) {
            //...
        } else{
            //...
        }

        overrides

        Examples of correct code for this rule with the { "overrides": { "if": { "after": false }, "for": { "after": false }, "while": { "after": false } } } option:

        /*eslint keyword-spacing: ["error", { "overrides": {
          "if": { "after": false },
          "for": { "after": false },
          "while": { "after": false }
        } }]*/
        
        if(foo) {
            //...
        } else if(bar) {
            //...
        } else {
            //...
        }
        
        for(;;);
        
        while(true) {
          //...
        }

        When Not To Use It

        If you don't want to enforce consistency on keyword spacing, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

        Missing semicolon.
        Open

            })
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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/

        Unexpected use of 'isNaN'.
        Open

                if (isNaN(timeUnits) || timeUnits < 1) return;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Disallow specific global variables (no-restricted-globals)

        Disallowing usage of specific global variables can be useful if you want to allow a set of global variables by enabling an environment, but still want to disallow some of those.

        For instance, early Internet Explorer versions exposed the current DOM event as a global variable event, but using this variable has been considered as a bad practice for a long time. Restricting this will make sure this variable isn't used in browser code.

        Rule Details

        This rule allows you to specify global variable names that you don't want to use in your application.

        Options

        This rule takes a list of strings, where each string is a global to be restricted:

        {
            "rules": {
                "no-restricted-globals": ["error", "event", "fdescribe"]
            }
        }

        Alternatively, the rule also accepts objects, where the global name and an optional custom message are specified:

        {
            "rules": {
                "no-restricted-globals": [
                    "error",
                    {
                        "name": "event",
                        "message": "Use local parameter instead."
                    },
                    {
                        "name": "fdescribe",
                        "message": "Do not commit fdescribe. Use describe instead."
                    }
                ]
            }
        }

        Examples of incorrect code for sample "event", "fdescribe" global variable names:

        /*global event, fdescribe*/
        /*eslint no-restricted-globals: ["error", "event", "fdescribe"]*/
        
        function onClick() {
            console.log(event);
        }
        
        fdescribe("foo", function() {
        });

        Examples of correct code for a sample "event" global variable name:

        /*global event*/
        /*eslint no-restricted-globals: ["error", "event"]*/
        
        import event from "event-module";
        /*global event*/
        /*eslint no-restricted-globals: ["error", "event"]*/
        
        var event = 1;

        Examples of incorrect code for a sample "event" global variable name, along with a custom error message:

        /*global event*/
        /* eslint no-restricted-globals: ["error", { name: "event", message: "Use local parameter instead." }] */
        
        function onClick() {
            console.log(event);    // Unexpected global variable 'event'. Use local parameter instead.
        }

        Related Rules

        Unexpected use of continue statement.
        Open

                            continue;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        disallow continue statements (no-continue)

        The continue statement terminates execution of the statements in the current iteration of the current or labeled loop, and continues execution of the loop with the next iteration. When used incorrectly it makes code less testable, less readable and less maintainable. Structured control flow statements such as if should be used instead.

        var sum = 0,
            i;
        
        for(i = 0; i < 10; i++) {
            if(i >= 5) {
                continue;
            }
        
            a += i;
        }

        Rule Details

        This rule disallows continue statements.

        Examples of incorrect code for this rule:

        /*eslint no-continue: "error"*/
        
        var sum = 0,
            i;
        
        for(i = 0; i < 10; i++) {
            if(i >= 5) {
                continue;
            }
        
            a += i;
        }
        /*eslint no-continue: "error"*/
        
        var sum = 0,
            i;
        
        labeledLoop: for(i = 0; i < 10; i++) {
            if(i >= 5) {
                continue labeledLoop;
            }
        
            a += i;
        }

        Examples of correct code for this rule:

        /*eslint no-continue: "error"*/
        
        var sum = 0,
            i;
        
        for(i = 0; i < 10; i++) {
            if(i < 5) {
               a += i;
            }
        }

        Compatibility

        Closing curly brace does not appear on the same line as the subsequent block.
        Open

                        }
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Require Brace Style (brace-style)

        Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

        The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

        if (foo) {
          bar();
        } else {
          baz();
        }

        One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

        if (foo) {
          bar();
        }
        else {
          baz();
        }

        Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

        if (foo)
        {
          bar();
        }
        else
        {
          baz();
        }

        While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

        Rule Details

        This rule enforces consistent brace style for blocks.

        Options

        This rule has a string option:

        • "1tbs" (default) enforces one true brace style
        • "stroustrup" enforces Stroustrup style
        • "allman" enforces Allman style

        This rule has an object option for an exception:

        • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

        1tbs

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

        /*eslint brace-style: "error"*/
        
        function foo()
        {
          return true;
        }
        
        if (foo)
        {
          bar();
        }
        
        try
        {
          somethingRisky();
        } catch(e)
        {
          handleError();
        }
        
        if (foo) {
          bar();
        }
        else {
          baz();
        }

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

        /*eslint brace-style: "error"*/
        
        function foo() {
          return true;
        }
        
        if (foo) {
          bar();
        }
        
        if (foo) {
          bar();
        } else {
          baz();
        }
        
        try {
          somethingRisky();
        } catch(e) {
          handleError();
        }
        
        // when there are no braces, there are no problems
        if (foo) bar();
        else if (baz) boom();

        Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

        /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
        
        function nop() { return; }
        
        if (foo) { bar(); }
        
        if (foo) { bar(); } else { baz(); }
        
        try { somethingRisky(); } catch(e) { handleError(); }
        
        if (foo) { baz(); } else {
          boom();
        }
        
        if (foo) { baz(); } else if (bar) {
          boom();
        }
        
        if (foo) { baz(); } else
        if (bar) {
          boom();
        }
        
        if (foo) { baz(); } else if (bar) {
          boom();
        }
        
        try { somethingRisky(); } catch(e) {
          handleError();
        }

        stroustrup

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

        /*eslint brace-style: ["error", "stroustrup"]*/
        
        function foo()
        {
          return true;
        }
        
        if (foo)
        {
          bar();
        }
        
        try
        {
          somethingRisky();
        } catch(e)
        {
          handleError();
        }
        
        if (foo) {
          bar();
        } else {
          baz();
        }

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

        /*eslint brace-style: ["error", "stroustrup"]*/
        
        function foo() {
          return true;
        }
        
        if (foo) {
          bar();
        }
        
        if (foo) {
          bar();
        }
        else {
          baz();
        }
        
        try {
          somethingRisky();
        }
        catch(e) {
          handleError();
        }
        
        // when there are no braces, there are no problems
        if (foo) bar();
        else if (baz) boom();

        Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

        /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
        
        function nop() { return; }
        
        if (foo) { bar(); }
        
        if (foo) { bar(); }
        else { baz(); }
        
        try { somethingRisky(); }
        catch(e) { handleError(); }

        allman

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

        /*eslint brace-style: ["error", "allman"]*/
        
        function foo() {
          return true;
        }
        
        if (foo)
        {
          bar(); }
        
        try
        {
          somethingRisky();
        } catch(e)
        {
          handleError();
        }
        
        if (foo) {
          bar();
        } else {
          baz();
        }

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

        /*eslint brace-style: ["error", "allman"]*/
        
        function foo()
        {
          return true;
        }
        
        if (foo)
        {
          bar();
        }
        
        if (foo)
        {
          bar();
        }
        else
        {
          baz();
        }
        
        try
        {
          somethingRisky();
        }
        catch(e)
        {
          handleError();
        }
        
        // when there are no braces, there are no problems
        if (foo) bar();
        else if (baz) boom();

        Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

        /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
        
        function nop() { return; }
        
        if (foo) { bar(); }
        
        if (foo) { bar(); }
        else { baz(); }
        
        try { somethingRisky(); }
        catch(e) { handleError(); }

        When Not To Use It

        If you don't want to enforce a particular brace style, don't enable this rule.

        Further Reading

        Missing semicolon.
        Open

            })
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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/

        Use object destructuring.
        Open

                    var plotValues = globalScope.Flag[i].plotValues;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Prefer destructuring from arrays and objects (prefer-destructuring)

        With JavaScript ES6, a new syntax was added for creating variables from an array index or object property, called destructuring. This rule enforces usage of destructuring instead of accessing a property through a member expression.

        Rule Details

        Options

        This rule takes two sets of configuration objects. The first object parameter determines what types of destructuring the rule applies to.

        The two properties, array and object, can be used to turn on or off the destructuring requirement for each of those types independently. By default, both are true.

        Alternatively, you can use separate configurations for different assignment types. It accepts 2 other keys instead of array and object.

        One key is VariableDeclarator and the other is AssignmentExpression, which can be used to control the destructuring requirement for each of those types independently. Each property accepts an object that accepts two properties, array and object, which can be used to control the destructuring requirement for each of array and object independently for variable declarations and assignment expressions. By default, array and object are set to true for both VariableDeclarator and AssignmentExpression.

        The rule has a second object with a single key, enforceForRenamedProperties, which determines whether the object destructuring applies to renamed variables.

        Note: It is not possible to determine if a variable will be referring to an object or an array at runtime. This rule therefore guesses the assignment type by checking whether the key being accessed is an integer. This can lead to the following possibly confusing situations:

        • Accessing an object property whose key is an integer will fall under the category array destructuring.
        • Accessing an array element through a computed index will fall under the category object destructuring.

        Examples of incorrect code for this rule:

        // With `array` enabled
        var foo = array[0];
        
        // With `object` enabled
        var foo = object.foo;
        var foo = object['foo'];

        Examples of correct code for this rule:

        // With `array` enabled
        var [ foo ] = array;
        var foo = array[someIndex];
        
        // With `object` enabled
        var { foo } = object;
        
        var foo = object.bar;
        
        let foo;
        ({ foo } = object);

        Examples of incorrect code when enforceForRenamedProperties is enabled:

        var foo = object.bar;

        Examples of correct code when enforceForRenamedProperties is enabled:

        var { bar: foo } = object;

        An example configuration, with the defaults array and object filled in, looks like this:

        {
          "rules": {
            "prefer-destructuring": ["error", {
              "array": true,
              "object": true
            }, {
              "enforceForRenamedProperties": false
            }]
          }
        }

        The two properties, array and object, which can be used to turn on or off the destructuring requirement for each of those types independently. By default, both are true.

        For example, the following configuration enforces only object destructuring, but not array destructuring:

        {
          "rules": {
            "prefer-destructuring": ["error", {"object": true, "array": false}]
          }
        }

        An example configuration, with the defaults VariableDeclarator and AssignmentExpression filled in, looks like this:

        {
          "rules": {
            "prefer-destructuring": ["error", {
              "VariableDeclarator": {
                "array": false,
                "object": true
              },
              "AssignmentExpression": {
                "array": true,
                "object": true
              }
            }, {
              "enforceForRenamedProperties": false
            }]
          }
        }

        The two properties, VariableDeclarator and AssignmentExpression, which can be used to turn on or off the destructuring requirement for array and object. By default, all values are true.

        For example, the following configuration enforces object destructuring in variable declarations and enforces array destructuring in assignment expressions.

        {
          "rules": {
            "prefer-destructuring": ["error", {
              "VariableDeclarator": {
                "array": false,
                "object": true
              },
              "AssignmentExpression": {
                "array": true,
                "object": false
              }
            }, {
              "enforceForRenamedProperties": false
            }]
          }
        }

        Examples of correct code when object destructuring in VariableDeclarator is enforced:

        /* eslint prefer-destructuring: ["error", {VariableDeclarator: {object: true}}] */
        var {bar: foo} = object;

        Examples of correct code when array destructuring in AssignmentExpression is enforced:

        /* eslint prefer-destructuring: ["error", {AssignmentExpression: {array: true}}] */
        [bar] = array;

        When Not To Use It

        If you want to be able to access array indices or object properties directly, you can either configure the rule to your tastes or disable the rule entirely.

        Additionally, if you intend to access large array indices directly, like:

        var foo = array[100];

        Then the array part of this rule is not recommended, as destructuring does not match this use case very well.

        Or for non-iterable 'array-like' objects:

        var $ = require('jquery');
        var foo = $('body')[0];
        var [bar] = $('body'); // fails with a TypeError

        Further Reading

        If you want to learn more about destructuring, check out the links below:

        Missing semicolon.
        Open

            })
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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/

        Closing curly brace does not appear on the same line as the subsequent block.
        Open

                            }
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Require Brace Style (brace-style)

        Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

        The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

        if (foo) {
          bar();
        } else {
          baz();
        }

        One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

        if (foo) {
          bar();
        }
        else {
          baz();
        }

        Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

        if (foo)
        {
          bar();
        }
        else
        {
          baz();
        }

        While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

        Rule Details

        This rule enforces consistent brace style for blocks.

        Options

        This rule has a string option:

        • "1tbs" (default) enforces one true brace style
        • "stroustrup" enforces Stroustrup style
        • "allman" enforces Allman style

        This rule has an object option for an exception:

        • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

        1tbs

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

        /*eslint brace-style: "error"*/
        
        function foo()
        {
          return true;
        }
        
        if (foo)
        {
          bar();
        }
        
        try
        {
          somethingRisky();
        } catch(e)
        {
          handleError();
        }
        
        if (foo) {
          bar();
        }
        else {
          baz();
        }

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

        /*eslint brace-style: "error"*/
        
        function foo() {
          return true;
        }
        
        if (foo) {
          bar();
        }
        
        if (foo) {
          bar();
        } else {
          baz();
        }
        
        try {
          somethingRisky();
        } catch(e) {
          handleError();
        }
        
        // when there are no braces, there are no problems
        if (foo) bar();
        else if (baz) boom();

        Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

        /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
        
        function nop() { return; }
        
        if (foo) { bar(); }
        
        if (foo) { bar(); } else { baz(); }
        
        try { somethingRisky(); } catch(e) { handleError(); }
        
        if (foo) { baz(); } else {
          boom();
        }
        
        if (foo) { baz(); } else if (bar) {
          boom();
        }
        
        if (foo) { baz(); } else
        if (bar) {
          boom();
        }
        
        if (foo) { baz(); } else if (bar) {
          boom();
        }
        
        try { somethingRisky(); } catch(e) {
          handleError();
        }

        stroustrup

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

        /*eslint brace-style: ["error", "stroustrup"]*/
        
        function foo()
        {
          return true;
        }
        
        if (foo)
        {
          bar();
        }
        
        try
        {
          somethingRisky();
        } catch(e)
        {
          handleError();
        }
        
        if (foo) {
          bar();
        } else {
          baz();
        }

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

        /*eslint brace-style: ["error", "stroustrup"]*/
        
        function foo() {
          return true;
        }
        
        if (foo) {
          bar();
        }
        
        if (foo) {
          bar();
        }
        else {
          baz();
        }
        
        try {
          somethingRisky();
        }
        catch(e) {
          handleError();
        }
        
        // when there are no braces, there are no problems
        if (foo) bar();
        else if (baz) boom();

        Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

        /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
        
        function nop() { return; }
        
        if (foo) { bar(); }
        
        if (foo) { bar(); }
        else { baz(); }
        
        try { somethingRisky(); }
        catch(e) { handleError(); }

        allman

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

        /*eslint brace-style: ["error", "allman"]*/
        
        function foo() {
          return true;
        }
        
        if (foo)
        {
          bar(); }
        
        try
        {
          somethingRisky();
        } catch(e)
        {
          handleError();
        }
        
        if (foo) {
          bar();
        } else {
          baz();
        }

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

        /*eslint brace-style: ["error", "allman"]*/
        
        function foo()
        {
          return true;
        }
        
        if (foo)
        {
          bar();
        }
        
        if (foo)
        {
          bar();
        }
        else
        {
          baz();
        }
        
        try
        {
          somethingRisky();
        }
        catch(e)
        {
          handleError();
        }
        
        // when there are no braces, there are no problems
        if (foo) bar();
        else if (baz) boom();

        Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

        /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
        
        function nop() { return; }
        
        if (foo) { bar(); }
        
        if (foo) { bar(); }
        else { baz(); }
        
        try { somethingRisky(); }
        catch(e) { handleError(); }

        When Not To Use It

        If you don't want to enforce a particular brace style, don't enable this rule.

        Further Reading

        Missing semicolon.
        Open

                $('#plot').width($('#plot').width() + 20)
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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/

        Missing semicolon.
        Open

            })
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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/

        Unexpected unnamed function.
        Open

            $('#timing-diagram-units').on('change paste keyup', function() {
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        Missing semicolon.
        Open

            })
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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/

        Expected no linebreak before this statement.
        Open

                                    continue;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        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

        'plotArea' was used before it was defined.
        Open

            return timeLineStartX + (cycleNumber - plotArea.cycleOffset) * cycleWidth;
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Disallow Early Use (no-use-before-define)

        In JavaScript, prior to ES6, variable and function declarations are hoisted to the top of a scope, so it's possible to use identifiers before their formal declarations in code. This can be confusing and some believe it is best to always declare variables and functions before using them.

        In ES6, block-level bindings (let and const) introduce a "temporal dead zone" where a ReferenceError will be thrown with any attempt to access the variable before its declaration.

        Rule Details

        This rule will warn when it encounters a reference to an identifier that has not yet been declared.

        Examples of incorrect code for this rule:

        /*eslint no-use-before-define: "error"*/
        /*eslint-env es6*/
        
        alert(a);
        var a = 10;
        
        f();
        function f() {}
        
        function g() {
            return b;
        }
        var b = 1;
        
        {
            alert(c);
            let c = 1;
        }

        Examples of correct code for this rule:

        /*eslint no-use-before-define: "error"*/
        /*eslint-env es6*/
        
        var a;
        a = 10;
        alert(a);
        
        function f() {}
        f(1);
        
        var b = 1;
        function g() {
            return b;
        }
        
        {
            let c;
            c++;
        }

        Options

        {
            "no-use-before-define": ["error", { "functions": true, "classes": true }]
        }
        • functions (boolean) - The flag which shows whether or not this rule checks function declarations. If this is true, this rule warns every reference to a function before the function declaration. Otherwise, ignores those references. Function declarations are hoisted, so it's safe. Default is true.
        • classes (boolean) - The flag which shows whether or not this rule checks class declarations of upper scopes. If this is true, this rule warns every reference to a class before the class declaration. Otherwise, ignores those references if the declaration is in upper function scopes. Class declarations are not hoisted, so it might be danger. Default is true.
        • variables (boolean) - This flag determines whether or not the rule checks variable declarations in upper scopes. If this is true, the rule warns every reference to a variable before the variable declaration. Otherwise, the rule ignores a reference if the declaration is in an upper scope, while still reporting the reference if it's in the same scope as the declaration. Default is true.

        This rule accepts "nofunc" string as an option. "nofunc" is the same as { "functions": false, "classes": true, "variables": true }.

        functions

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

        /*eslint no-use-before-define: ["error", { "functions": false }]*/
        
        f();
        function f() {}

        This option allows references to function declarations. For function expressions and arrow functions, please see the variables option.

        classes

        Examples of incorrect code for the { "classes": false } option:

        /*eslint no-use-before-define: ["error", { "classes": false }]*/
        /*eslint-env es6*/
        
        new A();
        class A {
        }

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

        /*eslint no-use-before-define: ["error", { "classes": false }]*/
        /*eslint-env es6*/
        
        function foo() {
            return new A();
        }
        
        class A {
        }

        variables

        Examples of incorrect code for the { "variables": false } option:

        /*eslint no-use-before-define: ["error", { "variables": false }]*/
        
        console.log(foo);
        var foo = 1;
        
        f();
        const f = () => {};
        
        g();
        const g = function() {};

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

        /*eslint no-use-before-define: ["error", { "variables": false }]*/
        
        function baz() {
            console.log(foo);
        }
        var foo = 1;
        
        const a = () => f();
        function b() { return f(); }
        const c = function() { return f(); }
        const f = () => {};
        
        const e = function() { return g(); }
        const g = function() {}

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

        'plotArea' was used before it was defined.
        Open

            plotArea.resize();
        Severity: Minor
        Found in simulator/src/plotArea.js by eslint

        Disallow Early Use (no-use-before-define)

        In JavaScript, prior to ES6, variable and function declarations are hoisted to the top of a scope, so it's possible to use identifiers before their formal declarations in code. This can be confusing and some believe it is best to always declare variables and functions before using them.

        In ES6, block-level bindings (let and const) introduce a "temporal dead zone" where a ReferenceError will be thrown with any attempt to access the variable before its declaration.

        Rule Details

        This rule will warn when it encounters a reference to an identifier that has not yet been declared.

        Examples of incorrect code for this rule:

        /*eslint no-use-before-define: "error"*/
        /*eslint-env es6*/
        
        alert(a);
        var a = 10;
        
        f();
        function f() {}
        
        function g() {
            return b;
        }
        var b = 1;
        
        {
            alert(c);
            let c = 1;
        }

        Examples of correct code for this rule:

        /*eslint no-use-before-define: "error"*/
        /*eslint-env es6*/
        
        var a;
        a = 10;
        alert(a);
        
        function f() {}
        f(1);
        
        var b = 1;
        function g() {
            return b;
        }
        
        {
            let c;
            c++;
        }

        Options

        {
            "no-use-before-define": ["error", { "functions": true, "classes": true }]
        }
        • functions (boolean) - The flag which shows whether or not this rule checks function declarations. If this is true, this rule warns every reference to a function before the function declaration. Otherwise, ignores those references. Function declarations are hoisted, so it's safe. Default is true.
        • classes (boolean) - The flag which shows whether or not this rule checks class declarations of upper scopes. If this is true, this rule warns every reference to a class before the class declaration. Otherwise, ignores those references if the declaration is in upper function scopes. Class declarations are not hoisted, so it might be danger. Default is true.
        • variables (boolean) - This flag determines whether or not the rule checks variable declarations in upper scopes. If this is true, the rule warns every reference to a variable before the variable declaration. Otherwise, the rule ignores a reference if the declaration is in an upper scope, while still reporting the reference if it's in the same scope as the declaration. Default is true.

        This rule accepts "nofunc" string as an option. "nofunc" is the same as { "functions": false, "classes": true, "variables": true }.

        functions

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

        /*eslint no-use-before-define: ["error", { "functions": false }]*/
        
        f();
        function f() {}

        This option allows references to function declarations. For function expressions and arrow functions, please see the variables option.

        classes

        Examples of incorrect code for the { "classes": false } option:

        /*eslint no-use-before-define: ["error", { "classes": false }]*/
        /*eslint-env es6*/
        
        new A();
        class A {
        }

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

        /*eslint no-use-before-define: ["error", { "classes": false }]*/
        /*eslint-env es6*/
        
        function foo() {
            return new A();
        }
        
        class A {
        }

        variables

        Examples of incorrect code for the { "variables": false } option:

        /*eslint no-use-before-define: ["error", { "variables": false }]*/
        
        console.log(foo);
        var foo = 1;
        
        f();
        const f = () => {};
        
        g();
        const g = function() {};

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

        /*eslint no-use-before-define: ["error", { "variables": false }]*/
        
        function baz() {
            console.log(foo);
        }
        var foo = 1;
        
        const a = () => f();
        function b() { return f(); }
        const c = function() { return f(); }
        const f = () => {};
        
        const e = function() { return g(); }
        const g = function() {}

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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            document.getElementById(ptA.PlotAreaId).addEventListener('touchend', (e) => {
                plotArea.mouseDown = false;
                var time = new Date().getTime() - plotArea.mouseDownTime;
                var offset = (plotArea.mouseX - plotArea.mouseDownX) / cycleWidth;
                plotArea.scrollAcc = offset * frameInterval / time;
        Severity: Major
        Found in simulator/src/plotArea.js and 1 other location - About 3 hrs to fix
        simulator/src/plotArea.js on lines 461..466

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

        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

            document.getElementById(ptA.PlotAreaId).addEventListener('mouseup', (e) => {
                plotArea.mouseDown = false;
                var time = new Date().getTime() - plotArea.mouseDownTime;
                var offset = (plotArea.mouseX - plotArea.mouseDownX) / cycleWidth;
                plotArea.scrollAcc = offset * frameInterval / time;
        Severity: Major
        Found in simulator/src/plotArea.js and 1 other location - About 3 hrs to fix
        simulator/src/plotArea.js on lines 490..495

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

        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

                if (plotArea.mouseDown) {
                    plotArea.cycleOffset -= (x - plotArea.mouseX) / cycleWidth;
                    plotArea.mouseX = x;
                } else {
                    plotArea.mouseDown = false;
        Severity: Major
        Found in simulator/src/plotArea.js and 1 other location - About 1 hr to fix
        simulator/src/plotArea.js on lines 500..505

        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 2 locations. Consider refactoring.
        Open

                if (plotArea.mouseDown) {
                    plotArea.cycleOffset -= (x - plotArea.mouseX) / cycleWidth;
                    plotArea.mouseX = x;
                } else {
                    plotArea.mouseDown = false;
        Severity: Major
        Found in simulator/src/plotArea.js and 1 other location - About 1 hr to fix
        simulator/src/plotArea.js on lines 471..476

        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

        There are no issues that match your filters.

        Category
        Status