handsontable/formula-parser

View on GitHub

Showing 20 of 20 total issues

File supported-formulas.js has 388 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const SUPPORTED_FORMULAS = [
  'ABS',
  'ACCRINT',
  'ACOS',
  'ACOSH',
Severity: Minor
Found in src/supported-formulas.js - About 5 hrs to fix

    Function func has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function func(symbol) {
      return function __formulaFunction(...params) {
        symbol = symbol.toUpperCase();
    
        const symbolParts = symbol.split('.');
    Severity: Minor
    Found in src/evaluate-by-operator/operator/formula-function.js - About 2 hrs 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

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    export default function func(first, ...rest) {
      const result = rest.reduce((acc, value) => acc * toNumber(value), toNumber(first));
    
      if (isNaN(result)) {
        throw Error(ERROR_VALUE);
    Severity: Major
    Found in src/evaluate-by-operator/operator/multiply.js and 2 other locations - About 1 hr to fix
    src/evaluate-by-operator/operator/add.js on lines 6..14
    src/evaluate-by-operator/operator/minus.js on lines 6..14

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    export default function func(first, ...rest) {
      const result = rest.reduce((acc, value) => acc + toNumber(value), toNumber(first));
    
      if (isNaN(result)) {
        throw Error(ERROR_VALUE);
    Severity: Major
    Found in src/evaluate-by-operator/operator/add.js and 2 other locations - About 1 hr to fix
    src/evaluate-by-operator/operator/minus.js on lines 6..14
    src/evaluate-by-operator/operator/multiply.js on lines 6..14

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    export default function func(first, ...rest) {
      const result = rest.reduce((acc, value) => acc - toNumber(value), toNumber(first));
    
      if (isNaN(result)) {
        throw Error(ERROR_VALUE);
    Severity: Major
    Found in src/evaluate-by-operator/operator/minus.js and 2 other locations - About 1 hr to fix
    src/evaluate-by-operator/operator/add.js on lines 6..14
    src/evaluate-by-operator/operator/multiply.js on lines 6..14

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

    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 (startRow.index <= endRow.index) {
          startCell.row = startRow;
          endCell.row = endRow;
        } else {
          startCell.row = endRow;
    Severity: Major
    Found in src/parser.js and 1 other location - About 1 hr to fix
    src/parser.js on lines 212..218

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

    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 (startColumn.index <= endColumn.index) {
          startCell.column = startColumn;
          endCell.column = endColumn;
        } else {
          startCell.column = endColumn;
    Severity: Major
    Found in src/parser.js and 1 other location - About 1 hr to fix
    src/parser.js on lines 204..210

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

    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

    Function func has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function func(symbol) {
      return function __formulaFunction(...params) {
        symbol = symbol.toUpperCase();
    
        const symbolParts = symbol.split('.');
    Severity: Minor
    Found in src/evaluate-by-operator/operator/formula-function.js - About 1 hr to fix

      Function __formulaFunction has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        return function __formulaFunction(...params) {
          symbol = symbol.toUpperCase();
      
          const symbolParts = symbol.split('.');
          let foundFormula = false;
      Severity: Minor
      Found in src/evaluate-by-operator/operator/formula-function.js - About 1 hr to fix

        Function _callRangeValue has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _callRangeValue(startLabel, endLabel) {
            startLabel = startLabel.toUpperCase();
            endLabel = endLabel.toUpperCase();
        
            const [startRow, startColumn] = extractLabel(startLabel);
        Severity: Minor
        Found in src/parser.js - About 1 hr to fix

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

            parse(expression) {
              let result = null;
              let error = null;
          
              try {
          Severity: Minor
          Found in src/parser.js - About 45 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

          Missing trailing comma.
          Open

            ]
          Severity: Minor
          Found in webpack.config.js by eslint

          require or disallow trailing commas (comma-dangle)

          Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

          var foo = {
              bar: "baz",
              qux: "quux",
          };

          Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

          Less clear:

          var foo = {
          -    bar: "baz",
          -    qux: "quux"
          +    bar: "baz"
           };

          More clear:

          var foo = {
               bar: "baz",
          -    qux: "quux",
           };

          Rule Details

          This rule enforces consistent use of trailing commas in object and array literals.

          Options

          This rule has a string option or an object option:

          {
              "comma-dangle": ["error", "never"],
              // or
              "comma-dangle": ["error", {
                  "arrays": "never",
                  "objects": "never",
                  "imports": "never",
                  "exports": "never",
                  "functions": "ignore",
              }]
          }
          • "never" (default) disallows trailing commas
          • "always" requires trailing commas
          • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
          • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

          Trailing commas in function declarations and function calls are valid syntax since ECMAScript 2017; however, the string option does not check these situations for backwards compatibility.

          You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

          • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
          • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
          • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
          • exports is for export declarations of ES Modules. (e.g. export {a,};)
          • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
            functions is set to "ignore" by default for consistency with the string option.

          never

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

          /*eslint comma-dangle: ["error", "never"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux",
          };
          
          var arr = [1,2,];
          
          foo({
            bar: "baz",
            qux: "quux",
          });

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

          /*eslint comma-dangle: ["error", "never"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux"
          };
          
          var arr = [1,2];
          
          foo({
            bar: "baz",
            qux: "quux"
          });

          always

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

          /*eslint comma-dangle: ["error", "always"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux"
          };
          
          var arr = [1,2];
          
          foo({
            bar: "baz",
            qux: "quux"
          });

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

          /*eslint comma-dangle: ["error", "always"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux",
          };
          
          var arr = [1,2,];
          
          foo({
            bar: "baz",
            qux: "quux",
          });

          always-multiline

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

          /*eslint comma-dangle: ["error", "always-multiline"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux"
          };
          
          var foo = { bar: "baz", qux: "quux", };
          
          var arr = [1,2,];
          
          var arr = [1,
              2,];
          
          var arr = [
              1,
              2
          ];
          
          foo({
            bar: "baz",
            qux: "quux"
          });

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

          /*eslint comma-dangle: ["error", "always-multiline"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux",
          };
          
          var foo = {bar: "baz", qux: "quux"};
          var arr = [1,2];
          
          var arr = [1,
              2];
          
          var arr = [
              1,
              2,
          ];
          
          foo({
            bar: "baz",
            qux: "quux",
          });

          only-multiline

          Examples of incorrect code for this rule with the "only-multiline" option:

          /*eslint comma-dangle: ["error", "only-multiline"]*/
          
          var foo = { bar: "baz", qux: "quux", };
          
          var arr = [1,2,];
          
          var arr = [1,
              2,];

          Examples of correct code for this rule with the "only-multiline" option:

          /*eslint comma-dangle: ["error", "only-multiline"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux",
          };
          
          var foo = {
              bar: "baz",
              qux: "quux"
          };
          
          var foo = {bar: "baz", qux: "quux"};
          var arr = [1,2];
          
          var arr = [1,
              2];
          
          var arr = [
              1,
              2,
          ];
          
          var arr = [
              1,
              2
          ];
          
          foo({
            bar: "baz",
            qux: "quux",
          });
          
          foo({
            bar: "baz",
            qux: "quux"
          });

          functions

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

          /*eslint comma-dangle: ["error", {"functions": "never"}]*/
          
          function foo(a, b,) {
          }
          
          foo(a, b,);
          new foo(a, b,);

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

          /*eslint comma-dangle: ["error", {"functions": "never"}]*/
          
          function foo(a, b) {
          }
          
          foo(a, b);
          new foo(a, b);

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

          /*eslint comma-dangle: ["error", {"functions": "always"}]*/
          
          function foo(a, b) {
          }
          
          foo(a, b);
          new foo(a, b);

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

          /*eslint comma-dangle: ["error", {"functions": "always"}]*/
          
          function foo(a, b,) {
          }
          
          foo(a, b,);
          new foo(a, b,);

          When Not To Use It

          You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

          for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.
          Open

            for (const i in errors) {
          Severity: Minor
          Found in src/error.js by eslint

          disallow specified syntax (no-restricted-syntax)

          JavaScript has a lot of language features, and not everyone likes all of them. As a result, some projects choose to disallow the use of certain language features altogether. For instance, you might decide to disallow the use of try-catch or class, or you might decide to disallow the use of the in operator.

          Rather than creating separate rules for every language feature you want to turn off, this rule allows you to configure the syntax elements you want to restrict use of. These elements are represented by their ESTree node types. For example, a function declaration is represented by FunctionDeclaration and the with statement is represented by WithStatement. You may find the full list of AST node names you can use on GitHub and use the online parser to see what type of nodes your code consists of.

          You can also specify [AST selectors](../developer-guide/selectors) to restrict, allowing much more precise control over syntax patterns.

          Rule Details

          This rule disallows specified (that is, user-defined) syntax.

          Options

          This rule takes a list of strings, where each string is an AST selector:

          {
              "rules": {
                  "no-restricted-syntax": ["error", "FunctionExpression", "WithStatement", "BinaryExpression[operator='in']"]
              }
          }

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

          {
              "rules": {
                  "no-restricted-syntax": [
                      "error",
                      {
                          "selector": "FunctionExpression",
                          "message": "Function expressions are not allowed."
                      },
                      {
                          "selector": "CallExpression[callee.name='setTimeout'][arguments.length!=2]",
                          "message": "setTimeout must always be invoked with two arguments."
                      }
                  ]
              }
          }

          If a custom message is specified with the message property, ESLint will use that message when reporting occurrences of the syntax specified in the selector property.

          The string and object formats can be freely mixed in the configuration as needed.

          Examples of incorrect code for this rule with the "FunctionExpression", "WithStatement", BinaryExpression[operator='in'] options:

          /* eslint no-restricted-syntax: ["error", "FunctionExpression", "WithStatement", "BinaryExpression[operator='in']"] */
          
          with (me) {
              dontMess();
          }
          
          var doSomething = function () {};
          
          foo in bar;

          Examples of correct code for this rule with the "FunctionExpression", "WithStatement", BinaryExpression[operator='in'] options:

          /* eslint no-restricted-syntax: ["error", "FunctionExpression", "WithStatement", "BinaryExpression[operator='in']"] */
          
          me.dontMess();
          
          function doSomething() {};
          
          foo instanceof bar;

          When Not To Use It

          If you don't want to restrict your code from using any JavaScript features or syntax, you should not use this rule.

          Related Rules

          • [no-alert](no-alert.md)
          • [no-console](no-console.md)
          • [no-debugger](no-debugger.md)
          • [no-restricted-properties](no-restricted-properties.md) Source: http://eslint.org/docs/rules/

          Missing trailing comma.
          Open

                'process.env.NODE_ENV': JSON.stringify(NODE_ENV)
          Severity: Minor
          Found in webpack.config.js by eslint

          require or disallow trailing commas (comma-dangle)

          Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

          var foo = {
              bar: "baz",
              qux: "quux",
          };

          Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

          Less clear:

          var foo = {
          -    bar: "baz",
          -    qux: "quux"
          +    bar: "baz"
           };

          More clear:

          var foo = {
               bar: "baz",
          -    qux: "quux",
           };

          Rule Details

          This rule enforces consistent use of trailing commas in object and array literals.

          Options

          This rule has a string option or an object option:

          {
              "comma-dangle": ["error", "never"],
              // or
              "comma-dangle": ["error", {
                  "arrays": "never",
                  "objects": "never",
                  "imports": "never",
                  "exports": "never",
                  "functions": "ignore",
              }]
          }
          • "never" (default) disallows trailing commas
          • "always" requires trailing commas
          • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
          • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

          Trailing commas in function declarations and function calls are valid syntax since ECMAScript 2017; however, the string option does not check these situations for backwards compatibility.

          You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

          • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
          • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
          • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
          • exports is for export declarations of ES Modules. (e.g. export {a,};)
          • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
            functions is set to "ignore" by default for consistency with the string option.

          never

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

          /*eslint comma-dangle: ["error", "never"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux",
          };
          
          var arr = [1,2,];
          
          foo({
            bar: "baz",
            qux: "quux",
          });

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

          /*eslint comma-dangle: ["error", "never"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux"
          };
          
          var arr = [1,2];
          
          foo({
            bar: "baz",
            qux: "quux"
          });

          always

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

          /*eslint comma-dangle: ["error", "always"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux"
          };
          
          var arr = [1,2];
          
          foo({
            bar: "baz",
            qux: "quux"
          });

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

          /*eslint comma-dangle: ["error", "always"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux",
          };
          
          var arr = [1,2,];
          
          foo({
            bar: "baz",
            qux: "quux",
          });

          always-multiline

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

          /*eslint comma-dangle: ["error", "always-multiline"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux"
          };
          
          var foo = { bar: "baz", qux: "quux", };
          
          var arr = [1,2,];
          
          var arr = [1,
              2,];
          
          var arr = [
              1,
              2
          ];
          
          foo({
            bar: "baz",
            qux: "quux"
          });

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

          /*eslint comma-dangle: ["error", "always-multiline"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux",
          };
          
          var foo = {bar: "baz", qux: "quux"};
          var arr = [1,2];
          
          var arr = [1,
              2];
          
          var arr = [
              1,
              2,
          ];
          
          foo({
            bar: "baz",
            qux: "quux",
          });

          only-multiline

          Examples of incorrect code for this rule with the "only-multiline" option:

          /*eslint comma-dangle: ["error", "only-multiline"]*/
          
          var foo = { bar: "baz", qux: "quux", };
          
          var arr = [1,2,];
          
          var arr = [1,
              2,];

          Examples of correct code for this rule with the "only-multiline" option:

          /*eslint comma-dangle: ["error", "only-multiline"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux",
          };
          
          var foo = {
              bar: "baz",
              qux: "quux"
          };
          
          var foo = {bar: "baz", qux: "quux"};
          var arr = [1,2];
          
          var arr = [1,
              2];
          
          var arr = [
              1,
              2,
          ];
          
          var arr = [
              1,
              2
          ];
          
          foo({
            bar: "baz",
            qux: "quux",
          });
          
          foo({
            bar: "baz",
            qux: "quux"
          });

          functions

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

          /*eslint comma-dangle: ["error", {"functions": "never"}]*/
          
          function foo(a, b,) {
          }
          
          foo(a, b,);
          new foo(a, b,);

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

          /*eslint comma-dangle: ["error", {"functions": "never"}]*/
          
          function foo(a, b) {
          }
          
          foo(a, b);
          new foo(a, b);

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

          /*eslint comma-dangle: ["error", {"functions": "always"}]*/
          
          function foo(a, b) {
          }
          
          foo(a, b);
          new foo(a, b);

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

          /*eslint comma-dangle: ["error", {"functions": "always"}]*/
          
          function foo(a, b,) {
          }
          
          foo(a, b,);
          new foo(a, b,);

          When Not To Use It

          You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

          Missing trailing comma.
          Open

              ]
          Severity: Minor
          Found in webpack.config.js by eslint

          require or disallow trailing commas (comma-dangle)

          Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

          var foo = {
              bar: "baz",
              qux: "quux",
          };

          Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

          Less clear:

          var foo = {
          -    bar: "baz",
          -    qux: "quux"
          +    bar: "baz"
           };

          More clear:

          var foo = {
               bar: "baz",
          -    qux: "quux",
           };

          Rule Details

          This rule enforces consistent use of trailing commas in object and array literals.

          Options

          This rule has a string option or an object option:

          {
              "comma-dangle": ["error", "never"],
              // or
              "comma-dangle": ["error", {
                  "arrays": "never",
                  "objects": "never",
                  "imports": "never",
                  "exports": "never",
                  "functions": "ignore",
              }]
          }
          • "never" (default) disallows trailing commas
          • "always" requires trailing commas
          • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
          • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

          Trailing commas in function declarations and function calls are valid syntax since ECMAScript 2017; however, the string option does not check these situations for backwards compatibility.

          You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

          • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
          • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
          • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
          • exports is for export declarations of ES Modules. (e.g. export {a,};)
          • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
            functions is set to "ignore" by default for consistency with the string option.

          never

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

          /*eslint comma-dangle: ["error", "never"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux",
          };
          
          var arr = [1,2,];
          
          foo({
            bar: "baz",
            qux: "quux",
          });

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

          /*eslint comma-dangle: ["error", "never"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux"
          };
          
          var arr = [1,2];
          
          foo({
            bar: "baz",
            qux: "quux"
          });

          always

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

          /*eslint comma-dangle: ["error", "always"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux"
          };
          
          var arr = [1,2];
          
          foo({
            bar: "baz",
            qux: "quux"
          });

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

          /*eslint comma-dangle: ["error", "always"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux",
          };
          
          var arr = [1,2,];
          
          foo({
            bar: "baz",
            qux: "quux",
          });

          always-multiline

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

          /*eslint comma-dangle: ["error", "always-multiline"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux"
          };
          
          var foo = { bar: "baz", qux: "quux", };
          
          var arr = [1,2,];
          
          var arr = [1,
              2,];
          
          var arr = [
              1,
              2
          ];
          
          foo({
            bar: "baz",
            qux: "quux"
          });

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

          /*eslint comma-dangle: ["error", "always-multiline"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux",
          };
          
          var foo = {bar: "baz", qux: "quux"};
          var arr = [1,2];
          
          var arr = [1,
              2];
          
          var arr = [
              1,
              2,
          ];
          
          foo({
            bar: "baz",
            qux: "quux",
          });

          only-multiline

          Examples of incorrect code for this rule with the "only-multiline" option:

          /*eslint comma-dangle: ["error", "only-multiline"]*/
          
          var foo = { bar: "baz", qux: "quux", };
          
          var arr = [1,2,];
          
          var arr = [1,
              2,];

          Examples of correct code for this rule with the "only-multiline" option:

          /*eslint comma-dangle: ["error", "only-multiline"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux",
          };
          
          var foo = {
              bar: "baz",
              qux: "quux"
          };
          
          var foo = {bar: "baz", qux: "quux"};
          var arr = [1,2];
          
          var arr = [1,
              2];
          
          var arr = [
              1,
              2,
          ];
          
          var arr = [
              1,
              2
          ];
          
          foo({
            bar: "baz",
            qux: "quux",
          });
          
          foo({
            bar: "baz",
            qux: "quux"
          });

          functions

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

          /*eslint comma-dangle: ["error", {"functions": "never"}]*/
          
          function foo(a, b,) {
          }
          
          foo(a, b,);
          new foo(a, b,);

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

          /*eslint comma-dangle: ["error", {"functions": "never"}]*/
          
          function foo(a, b) {
          }
          
          foo(a, b);
          new foo(a, b);

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

          /*eslint comma-dangle: ["error", {"functions": "always"}]*/
          
          function foo(a, b) {
          }
          
          foo(a, b);
          new foo(a, b);

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

          /*eslint comma-dangle: ["error", {"functions": "always"}]*/
          
          function foo(a, b,) {
          }
          
          foo(a, b,);
          new foo(a, b,);

          When Not To Use It

          You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

          Missing trailing comma.
          Open

              })
          Severity: Minor
          Found in webpack.config.js by eslint

          require or disallow trailing commas (comma-dangle)

          Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

          var foo = {
              bar: "baz",
              qux: "quux",
          };

          Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

          Less clear:

          var foo = {
          -    bar: "baz",
          -    qux: "quux"
          +    bar: "baz"
           };

          More clear:

          var foo = {
               bar: "baz",
          -    qux: "quux",
           };

          Rule Details

          This rule enforces consistent use of trailing commas in object and array literals.

          Options

          This rule has a string option or an object option:

          {
              "comma-dangle": ["error", "never"],
              // or
              "comma-dangle": ["error", {
                  "arrays": "never",
                  "objects": "never",
                  "imports": "never",
                  "exports": "never",
                  "functions": "ignore",
              }]
          }
          • "never" (default) disallows trailing commas
          • "always" requires trailing commas
          • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
          • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

          Trailing commas in function declarations and function calls are valid syntax since ECMAScript 2017; however, the string option does not check these situations for backwards compatibility.

          You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

          • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
          • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
          • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
          • exports is for export declarations of ES Modules. (e.g. export {a,};)
          • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
            functions is set to "ignore" by default for consistency with the string option.

          never

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

          /*eslint comma-dangle: ["error", "never"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux",
          };
          
          var arr = [1,2,];
          
          foo({
            bar: "baz",
            qux: "quux",
          });

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

          /*eslint comma-dangle: ["error", "never"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux"
          };
          
          var arr = [1,2];
          
          foo({
            bar: "baz",
            qux: "quux"
          });

          always

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

          /*eslint comma-dangle: ["error", "always"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux"
          };
          
          var arr = [1,2];
          
          foo({
            bar: "baz",
            qux: "quux"
          });

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

          /*eslint comma-dangle: ["error", "always"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux",
          };
          
          var arr = [1,2,];
          
          foo({
            bar: "baz",
            qux: "quux",
          });

          always-multiline

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

          /*eslint comma-dangle: ["error", "always-multiline"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux"
          };
          
          var foo = { bar: "baz", qux: "quux", };
          
          var arr = [1,2,];
          
          var arr = [1,
              2,];
          
          var arr = [
              1,
              2
          ];
          
          foo({
            bar: "baz",
            qux: "quux"
          });

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

          /*eslint comma-dangle: ["error", "always-multiline"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux",
          };
          
          var foo = {bar: "baz", qux: "quux"};
          var arr = [1,2];
          
          var arr = [1,
              2];
          
          var arr = [
              1,
              2,
          ];
          
          foo({
            bar: "baz",
            qux: "quux",
          });

          only-multiline

          Examples of incorrect code for this rule with the "only-multiline" option:

          /*eslint comma-dangle: ["error", "only-multiline"]*/
          
          var foo = { bar: "baz", qux: "quux", };
          
          var arr = [1,2,];
          
          var arr = [1,
              2,];

          Examples of correct code for this rule with the "only-multiline" option:

          /*eslint comma-dangle: ["error", "only-multiline"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux",
          };
          
          var foo = {
              bar: "baz",
              qux: "quux"
          };
          
          var foo = {bar: "baz", qux: "quux"};
          var arr = [1,2];
          
          var arr = [1,
              2];
          
          var arr = [
              1,
              2,
          ];
          
          var arr = [
              1,
              2
          ];
          
          foo({
            bar: "baz",
            qux: "quux",
          });
          
          foo({
            bar: "baz",
            qux: "quux"
          });

          functions

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

          /*eslint comma-dangle: ["error", {"functions": "never"}]*/
          
          function foo(a, b,) {
          }
          
          foo(a, b,);
          new foo(a, b,);

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

          /*eslint comma-dangle: ["error", {"functions": "never"}]*/
          
          function foo(a, b) {
          }
          
          foo(a, b);
          new foo(a, b);

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

          /*eslint comma-dangle: ["error", {"functions": "always"}]*/
          
          function foo(a, b) {
          }
          
          foo(a, b);
          new foo(a, b);

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

          /*eslint comma-dangle: ["error", {"functions": "always"}]*/
          
          function foo(a, b,) {
          }
          
          foo(a, b,);
          new foo(a, b,);

          When Not To Use It

          You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

          Unnecessary escape character: -.
          Open

                  exclude: /node_modules|grammar\-parser\.js$/
          Severity: Minor
          Found in webpack.config.js by eslint

          Disallow unnecessary escape usage (no-useless-escape)

          Escaping non-special characters in strings, template literals, and regular expressions doesn't have any effect, as demonstrated in the following example:

          let foo = "hol\a"; // > foo = "hola"
          let bar = `${foo}\!`; // > bar = "hola!"
          let baz = /\:/ // same functionality with /:/

          Rule Details

          This rule flags escapes that can be safely removed without changing behavior.

          Examples of incorrect code for this rule:

          /*eslint no-useless-escape: "error"*/
          
          "\'";
          '\"';
          "\#";
          "\e";
          `\"`;
          `\"${foo}\"`;
          `\#{foo}`;
          /\!/;
          /\@/;

          Examples of correct code for this rule:

          /*eslint no-useless-escape: "error"*/
          
          "\"";
          '\'';
          "\x12";
          "\u00a9";
          "\371";
          "xs\u2111";
          `\``;
          `\${${foo}\}`;
          `$\{${foo}\}`;
          /\\/g;
          /\t/g;
          /\w\$\*\^\./;

          When Not To Use It

          If you don't want to be notified about unnecessary escapes, you can safely disable this rule. Source: http://eslint.org/docs/rules/

          'use strict' is unnecessary inside of modules.
          Open

          'use strict';
          Severity: Minor
          Found in webpack.config.js by eslint

          require or disallow strict mode directives (strict)

          A strict mode directive is a "use strict" literal at the beginning of a script or function body. It enables strict mode semantics.

          When a directive occurs in global scope, strict mode applies to the entire script:

          "use strict";
          
          // strict mode
          
          function foo() {
              // strict mode
          }

          When a directive occurs at the beginning of a function body, strict mode applies only to that function, including all contained functions:

          function foo() {
              "use strict";
              // strict mode
          }
          
          function foo2() {
              // not strict mode
          };
          
          (function() {
              "use strict";
              function bar() {
                  // strict mode
              }
          }());

          In the CommonJS module system, a hidden function wraps each module and limits the scope of a "global" strict mode directive.

          In ECMAScript modules, which always have strict mode semantics, the directives are unnecessary.

          Rule Details

          This rule requires or disallows strict mode directives.

          This rule disallows strict mode directives, no matter which option is specified, if ESLint configuration specifies either of the following as [parser options](../user-guide/configuring#specifying-parser-options):

          • "sourceType": "module" that is, files are ECMAScript modules
          • "impliedStrict": true property in the ecmaFeatures object

          This rule disallows strict mode directives, no matter which option is specified, in functions with non-simple parameter lists (for example, parameter lists with default parameter values) because that is a syntax error in ECMAScript 2016 and later. See the examples of the function option.

          Options

          This rule has a string option:

          • "safe" (default) corresponds either of the following options:
            • "global" if ESLint considers a file to be a CommonJS module
            • "function" otherwise
          • "global" requires one strict mode directive in the global scope (and disallows any other strict mode directives)
          • "function" requires one strict mode directive in each top-level function declaration or expression (and disallows any other strict mode directives)
          • "never" disallows strict mode directives

          safe

          The "safe" option corresponds to the "global" option if ESLint considers a file to be a Node.js or CommonJS module because the configuration specifies either of the following:

          • node or commonjs [environments](../user-guide/configuring#specifying-environments)
          • "globalReturn": true property in the ecmaFeatures object of [parser options](../user-guide/configuring#specifying-parser-options)

          Otherwise the "safe" option corresponds to the "function" option.

          global

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

          /*eslint strict: ["error", "global"]*/
          
          function foo() {
          }
          /*eslint strict: ["error", "global"]*/
          
          function foo() {
              "use strict";
          }
          /*eslint strict: ["error", "global"]*/
          
          "use strict";
          
          function foo() {
              "use strict";
          }

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

          /*eslint strict: ["error", "global"]*/
          
          "use strict";
          
          function foo() {
          }

          function

          This option ensures that all function bodies are strict mode code, while global code is not. Particularly if a build step concatenates multiple scripts, a strict mode directive in global code of one script could unintentionally enable strict mode in another script that was not intended to be strict code.

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

          /*eslint strict: ["error", "function"]*/
          
          "use strict";
          
          function foo() {
          }
          /*eslint strict: ["error", "function"]*/
          
          function foo() {
          }
          
          (function() {
              function bar() {
                  "use strict";
              }
          }());
          /*eslint strict: ["error", "function"]*/
          /*eslint-env es6*/
          
          // Illegal "use strict" directive in function with non-simple parameter list.
          // This is a syntax error since ES2016.
          function foo(a = 1) {
              "use strict";
          }
          
          // We cannot write "use strict" directive in this function.
          // So we have to wrap this function with a function with "use strict" directive.
          function foo(a = 1) {
          }

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

          /*eslint strict: ["error", "function"]*/
          
          function foo() {
              "use strict";
          }
          
          (function() {
              "use strict";
          
              function bar() {
              }
          
              function baz(a = 1) {
              }
          }());
          
          var foo = (function() {
              "use strict";
          
              return function foo(a = 1) {
              };
          }());

          never

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

          /*eslint strict: ["error", "never"]*/
          
          "use strict";
          
          function foo() {
          }
          /*eslint strict: ["error", "never"]*/
          
          function foo() {
              "use strict";
          }

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

          /*eslint strict: ["error", "never"]*/
          
          function foo() {
          }

          earlier default (removed)

          (removed) The default option (that is, no string option specified) for this rule was removed in ESLint v1.0. The "function" option is most similar to the removed option.

          This option ensures that all functions are executed in strict mode. A strict mode directive must be present in global code or in every top-level function declaration or expression. It does not concern itself with unnecessary strict mode directives in nested functions that are already strict, nor with multiple strict mode directives at the same level.

          Examples of incorrect code for this rule with the earlier default option which has been removed:

          // "strict": "error"
          
          function foo() {
          }
          // "strict": "error"
          
          (function() {
              function bar() {
                  "use strict";
              }
          }());

          Examples of correct code for this rule with the earlier default option which has been removed:

          // "strict": "error"
          
          "use strict";
          
          function foo() {
          }
          // "strict": "error"
          
          function foo() {
              "use strict";
          }
          // "strict": "error"
          
          (function() {
              "use strict";
              function bar() {
                  "use strict";
              }
          }());

          When Not To Use It

          In a codebase that has both strict and non-strict code, either turn this rule off, or selectively disable it where necessary. For example, functions referencing arguments.callee are invalid in strict mode. A full list of strict mode differences is available on MDN. Source: http://eslint.org/docs/rules/

          Missing trailing comma.
          Open

                  exclude: /node_modules|grammar\-parser\.js$/
          Severity: Minor
          Found in webpack.config.js by eslint

          require or disallow trailing commas (comma-dangle)

          Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

          var foo = {
              bar: "baz",
              qux: "quux",
          };

          Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

          Less clear:

          var foo = {
          -    bar: "baz",
          -    qux: "quux"
          +    bar: "baz"
           };

          More clear:

          var foo = {
               bar: "baz",
          -    qux: "quux",
           };

          Rule Details

          This rule enforces consistent use of trailing commas in object and array literals.

          Options

          This rule has a string option or an object option:

          {
              "comma-dangle": ["error", "never"],
              // or
              "comma-dangle": ["error", {
                  "arrays": "never",
                  "objects": "never",
                  "imports": "never",
                  "exports": "never",
                  "functions": "ignore",
              }]
          }
          • "never" (default) disallows trailing commas
          • "always" requires trailing commas
          • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
          • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

          Trailing commas in function declarations and function calls are valid syntax since ECMAScript 2017; however, the string option does not check these situations for backwards compatibility.

          You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

          • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
          • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
          • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
          • exports is for export declarations of ES Modules. (e.g. export {a,};)
          • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
            functions is set to "ignore" by default for consistency with the string option.

          never

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

          /*eslint comma-dangle: ["error", "never"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux",
          };
          
          var arr = [1,2,];
          
          foo({
            bar: "baz",
            qux: "quux",
          });

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

          /*eslint comma-dangle: ["error", "never"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux"
          };
          
          var arr = [1,2];
          
          foo({
            bar: "baz",
            qux: "quux"
          });

          always

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

          /*eslint comma-dangle: ["error", "always"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux"
          };
          
          var arr = [1,2];
          
          foo({
            bar: "baz",
            qux: "quux"
          });

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

          /*eslint comma-dangle: ["error", "always"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux",
          };
          
          var arr = [1,2,];
          
          foo({
            bar: "baz",
            qux: "quux",
          });

          always-multiline

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

          /*eslint comma-dangle: ["error", "always-multiline"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux"
          };
          
          var foo = { bar: "baz", qux: "quux", };
          
          var arr = [1,2,];
          
          var arr = [1,
              2,];
          
          var arr = [
              1,
              2
          ];
          
          foo({
            bar: "baz",
            qux: "quux"
          });

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

          /*eslint comma-dangle: ["error", "always-multiline"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux",
          };
          
          var foo = {bar: "baz", qux: "quux"};
          var arr = [1,2];
          
          var arr = [1,
              2];
          
          var arr = [
              1,
              2,
          ];
          
          foo({
            bar: "baz",
            qux: "quux",
          });

          only-multiline

          Examples of incorrect code for this rule with the "only-multiline" option:

          /*eslint comma-dangle: ["error", "only-multiline"]*/
          
          var foo = { bar: "baz", qux: "quux", };
          
          var arr = [1,2,];
          
          var arr = [1,
              2,];

          Examples of correct code for this rule with the "only-multiline" option:

          /*eslint comma-dangle: ["error", "only-multiline"]*/
          
          var foo = {
              bar: "baz",
              qux: "quux",
          };
          
          var foo = {
              bar: "baz",
              qux: "quux"
          };
          
          var foo = {bar: "baz", qux: "quux"};
          var arr = [1,2];
          
          var arr = [1,
              2];
          
          var arr = [
              1,
              2,
          ];
          
          var arr = [
              1,
              2
          ];
          
          foo({
            bar: "baz",
            qux: "quux",
          });
          
          foo({
            bar: "baz",
            qux: "quux"
          });

          functions

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

          /*eslint comma-dangle: ["error", {"functions": "never"}]*/
          
          function foo(a, b,) {
          }
          
          foo(a, b,);
          new foo(a, b,);

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

          /*eslint comma-dangle: ["error", {"functions": "never"}]*/
          
          function foo(a, b) {
          }
          
          foo(a, b);
          new foo(a, b);

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

          /*eslint comma-dangle: ["error", {"functions": "always"}]*/
          
          function foo(a, b) {
          }
          
          foo(a, b);
          new foo(a, b);

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

          /*eslint comma-dangle: ["error", {"functions": "always"}]*/
          
          function foo(a, b,) {
          }
          
          foo(a, b,);
          new foo(a, b,);

          When Not To Use It

          You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

          Unexpected string concatenation.
          Open

            type = (type + '').replace(/#|!|\?/g, '');
          Severity: Minor
          Found in src/error.js by eslint

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

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

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

          Rule Details

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

          Examples

          Examples of incorrect code for this rule:

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

          Examples of correct code for this rule:

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

          When Not To Use It

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

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

          Related Rules

          Severity
          Category
          Status
          Source
          Language