TTLabs/EvaporateJS

View on GitHub

Showing 51 of 51 total issues

Function progessStats has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  FileUpload.prototype.progessStats = function () {
    // Adapted from https://github.com/fkjaekel
    // https://github.com/TTLabs/EvaporateJS/issues/13
    if (this.fileTotalBytesUploaded === 0) {
      return {
Severity: Minor
Found in evaporate.js - About 1 hr to fix

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

        AwsSignatureV4.prototype.canonicalQueryString = function () {
          var qs = awsRequest.request.query_string || '',
              search = uri([awsRequest.awsUrl, this.request.path, qs].join("")).search,
              searchParts = search.length ? search.split('&') : [],
              encoded = [],
    Severity: Minor
    Found in evaporate.js - About 1 hr to fix

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

        Evaporate.getLocalTimeOffset = function (config) {
          return new Promise(function (resolve, reject) {
            if (typeof config.localTimeOffset === 'number') {
              return resolve(config.localTimeOffset);
            }
      Severity: Minor
      Found in evaporate.js - About 1 hr to fix

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        app.use(function(req, res, next) {
          console.log(req.method + ' ' + req.originalUrl);
          next();
        });
        Severity: Minor
        Found in example/awsv4_signing_example.js and 1 other location - About 40 mins to fix
        example/SigningExample.js on lines 11..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 54.

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

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

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

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

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        app.use(function(req, res, next) {
          console.log(req.method + ' ' + req.originalUrl);
          next();
        });
        Severity: Minor
        Found in example/SigningExample.js and 1 other location - About 40 mins to fix
        example/awsv4_signing_example.js on lines 11..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 54.

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

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

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

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

        Refactorings

        Further Reading

        Method getSignatureKey has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            static byte[] getSignatureKey(String secretKey, String dateStamp, String regionName, String serviceName, String toSign) throws Exception {
        Severity: Minor
        Found in example/SignerV4Example.java - About 35 mins to fix

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

            Evaporate.prototype.cancel = function (id) {
              return typeof id === 'undefined' ? this._cancelAll() : this._cancelOne(id);
            };
          Severity: Minor
          Found in evaporate.js and 1 other location - About 35 mins to fix
          evaporate.js on lines 346..348

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

          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

            Evaporate.prototype.resume = function (id) {
              return typeof id === 'undefined' ? this._resumeAll() : this._resumeOne(id);
            };
          Severity: Minor
          Found in evaporate.js and 1 other location - About 35 mins to fix
          evaporate.js on lines 282..284

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

          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

          Avoid too many return statements within this function.
          Open

                    return 'Option awsSignatureVersion is 4 but cryptoHexEncodedHash256 is not defined.';
          Severity: Major
          Found in evaporate.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return 'Option awsSignatureVersion is 4 but computeContentMd5 is not enabled.';
            Severity: Major
            Found in evaporate.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return true;
              Severity: Major
              Found in evaporate.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return 'The browser\'s FileReader object does not support readAsArrayBuffer';
                Severity: Major
                Found in evaporate.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return "The AWS 'bucket' option must be present.";
                  Severity: Major
                  Found in evaporate.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return 'Option computeContentMd5 has been set but cryptoMd5Method is not defined.'
                    Severity: Major
                    Found in evaporate.js - About 30 mins to fix

                      Use path.join() or path.resolve() instead of + to create paths.
                      Open

                      app.use(express.static(require('path').join( __dirname + '/../')));
                      Severity: Minor
                      Found in example/SigningExample.js by eslint

                      Disallow string concatenation when using __dirname and __filename (no-path-concat)

                      In Node.js, the __dirname and __filename global variables contain the directory path and the file path of the currently executing script file, respectively. Sometimes, developers try to use these variables to create paths to other files, such as:

                      var fullPath = __dirname + "/foo.js";

                      However, there are a few problems with this. First, you can't be sure what type of system the script is running on. Node.js can be run on any computer, including Windows, which uses a different path separator. It's very easy, therefore, to create an invalid path using string concatenation and assuming Unix-style separators. There's also the possibility of having double separators, or otherwise ending up with an invalid path.

                      In order to avoid any confusion as to how to create the correct path, Node.js provides the path module. This module uses system-specific information to always return the correct value. So you can rewrite the previous example as:

                      var fullPath = path.join(__dirname, "foo.js");

                      This example doesn't need to include separators as path.join() will do it in the most appropriate manner. Alternately, you can use path.resolve() to retrieve the fully-qualified path:

                      var fullPath = path.resolve(__dirname, "foo.js");

                      Both path.join() and path.resolve() are suitable replacements for string concatenation wherever file or directory paths are being created.

                      Rule Details

                      This rule aims to prevent string concatenation of directory paths in Node.js

                      Examples of incorrect code for this rule:

                      /*eslint no-path-concat: "error"*/
                      
                      var fullPath = __dirname + "/foo.js";
                      
                      var fullPath = __filename + "/foo.js";

                      Examples of correct code for this rule:

                      /*eslint no-path-concat: "error"*/
                      
                      var fullPath = dirname + "/foo.js";

                      When Not To Use It

                      If you want to allow string concatenation of path names. Source: http://eslint.org/docs/rules/

                      Unexpected trailing comma.
                      Open

                                fileSize: this.sizeBytes,
                      Severity: Minor
                      Found in evaporate.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/

                      The function binding is unnecessary.
                      Open

                            }.bind(this), reject);
                      Severity: Minor
                      Found in evaporate.js by eslint

                      Disallow unnecessary function binding (no-extra-bind)

                      The bind() method is used to create functions with specific this values and, optionally, binds arguments to specific values. When used to specify the value of this, it's important that the function actually use this in its function body. For example:

                      var boundGetName = (function getName() {
                          return this.name;
                      }).bind({ name: "ESLint" });
                      
                      console.log(boundGetName());      // "ESLint"

                      This code is an example of a good use of bind() for setting the value of this.

                      Sometimes during the course of code maintenance, the this value is removed from the function body. In that case, you can end up with a call to bind() that doesn't accomplish anything:

                      // useless bind
                      var boundGetName = (function getName() {
                          return "ESLint";
                      }).bind({ name: "ESLint" });
                      
                      console.log(boundGetName());      // "ESLint"

                      In this code, the reference to this has been removed but bind() is still used. In this case, the bind() is unnecessary overhead (and a performance hit) and can be safely removed.

                      Rule Details

                      This rule is aimed at avoiding the unnecessary use of bind() and as such will warn whenever an immediately-invoked function expression (IIFE) is using bind() and doesn't have an appropriate this value. This rule won't flag usage of bind() that includes function argument binding.

                      Note: Arrow functions can never have their this value set using bind(). This rule flags all uses of bind() with arrow functions as a problem

                      Examples of incorrect code for this rule:

                      /*eslint no-extra-bind: "error"*/
                      /*eslint-env es6*/
                      
                      var x = function () {
                          foo();
                      }.bind(bar);
                      
                      var x = (() => {
                          foo();
                      }).bind(bar);
                      
                      var x = (() => {
                          this.foo();
                      }).bind(bar);
                      
                      var x = function () {
                          (function () {
                            this.foo();
                          }());
                      }.bind(bar);
                      
                      var x = function () {
                          function foo() {
                            this.bar();
                          }
                      }.bind(baz);

                      Examples of correct code for this rule:

                      /*eslint no-extra-bind: "error"*/
                      
                      var x = function () {
                          this.foo();
                      }.bind(bar);
                      
                      var x = function (a) {
                          return a + 1;
                      }.bind(foo, bar);

                      When Not To Use It

                      If you are not concerned about unnecessary calls to bind(), you can safely disable this rule.

                      Further Reading

                      Unexpected trailing comma.
                      Open

                              fileSize: this.sizeBytes,
                      Severity: Minor
                      Found in evaporate.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/

                      Use path.join() or path.resolve() instead of + to create paths.
                      Open

                      app.use(express.static(require('path').join( __dirname + '/../')));
                      Severity: Minor
                      Found in example/SigningExample-awsv4.js by eslint

                      Disallow string concatenation when using __dirname and __filename (no-path-concat)

                      In Node.js, the __dirname and __filename global variables contain the directory path and the file path of the currently executing script file, respectively. Sometimes, developers try to use these variables to create paths to other files, such as:

                      var fullPath = __dirname + "/foo.js";

                      However, there are a few problems with this. First, you can't be sure what type of system the script is running on. Node.js can be run on any computer, including Windows, which uses a different path separator. It's very easy, therefore, to create an invalid path using string concatenation and assuming Unix-style separators. There's also the possibility of having double separators, or otherwise ending up with an invalid path.

                      In order to avoid any confusion as to how to create the correct path, Node.js provides the path module. This module uses system-specific information to always return the correct value. So you can rewrite the previous example as:

                      var fullPath = path.join(__dirname, "foo.js");

                      This example doesn't need to include separators as path.join() will do it in the most appropriate manner. Alternately, you can use path.resolve() to retrieve the fully-qualified path:

                      var fullPath = path.resolve(__dirname, "foo.js");

                      Both path.join() and path.resolve() are suitable replacements for string concatenation wherever file or directory paths are being created.

                      Rule Details

                      This rule aims to prevent string concatenation of directory paths in Node.js

                      Examples of incorrect code for this rule:

                      /*eslint no-path-concat: "error"*/
                      
                      var fullPath = __dirname + "/foo.js";
                      
                      var fullPath = __filename + "/foo.js";

                      Examples of correct code for this rule:

                      /*eslint no-path-concat: "error"*/
                      
                      var fullPath = dirname + "/foo.js";

                      When Not To Use It

                      If you want to allow string concatenation of path names. Source: http://eslint.org/docs/rules/

                      Use path.join() or path.resolve() instead of + to create paths.
                      Open

                      app.use(express.static(require('path').join( __dirname + '/../')));
                      Severity: Minor
                      Found in example/awsv4_signing_example.js by eslint

                      Disallow string concatenation when using __dirname and __filename (no-path-concat)

                      In Node.js, the __dirname and __filename global variables contain the directory path and the file path of the currently executing script file, respectively. Sometimes, developers try to use these variables to create paths to other files, such as:

                      var fullPath = __dirname + "/foo.js";

                      However, there are a few problems with this. First, you can't be sure what type of system the script is running on. Node.js can be run on any computer, including Windows, which uses a different path separator. It's very easy, therefore, to create an invalid path using string concatenation and assuming Unix-style separators. There's also the possibility of having double separators, or otherwise ending up with an invalid path.

                      In order to avoid any confusion as to how to create the correct path, Node.js provides the path module. This module uses system-specific information to always return the correct value. So you can rewrite the previous example as:

                      var fullPath = path.join(__dirname, "foo.js");

                      This example doesn't need to include separators as path.join() will do it in the most appropriate manner. Alternately, you can use path.resolve() to retrieve the fully-qualified path:

                      var fullPath = path.resolve(__dirname, "foo.js");

                      Both path.join() and path.resolve() are suitable replacements for string concatenation wherever file or directory paths are being created.

                      Rule Details

                      This rule aims to prevent string concatenation of directory paths in Node.js

                      Examples of incorrect code for this rule:

                      /*eslint no-path-concat: "error"*/
                      
                      var fullPath = __dirname + "/foo.js";
                      
                      var fullPath = __filename + "/foo.js";

                      Examples of correct code for this rule:

                      /*eslint no-path-concat: "error"*/
                      
                      var fullPath = dirname + "/foo.js";

                      When Not To Use It

                      If you want to allow string concatenation of path names. Source: http://eslint.org/docs/rules/

                      Severity
                      Category
                      Status
                      Source
                      Language