How to use the jshint/groomer.groom function in jshint

To help you get started, we’ve selected a few jshint examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MiguelCastillo / Brackets-InteractiveLinter / plugins / default / threaded / jshint / main.js View on Github external
options = utils.mixin({}, defaultOptions, options);

        try {
          // Get document as a string to be passed into JSHint
          if (!JSHINT(text, options, options.globals)) {
              var errors = JSHINT.errors.slice(0);

              // If JSHINT.errors is false, then JSHint has some errors it needs to report
              for (i = 0, length = errors.length; i < length; i++) {

                  // If an error is empty, it should be the last error in the array which
                  // means that the max number of errors was exceeded or there was a fatal
                  // error while linting the file
                  if (errors[i]) {
                      delete errors[i].scope; // Some errors have scope, which breaks workers (cannot clone objects)
                      groomer.groom(errors[i], options);
                  }
              }

              return errors;
          }
        }
        catch(ex) {
            console.log(ex.message);
        }
    }