How to use the htmlhint.HTMLHint.defaultRuleset function in htmlhint

To help you get started, we’ve selected a few htmlhint 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 bezoerb / gulp-htmlhint / index.js View on Github external
// If necessary check for required param(s), e.g. options hash, etc.
  // read config file for htmlhint if available
  if (options.htmlhintrc) {
    try {
      const externalOptions = fs.readFileSync(options.htmlhintrc, 'utf-8');
      options = JSON.parse(stripJsonComments(externalOptions));
    } catch (error) {
      throw new Error('gulp-htmlhint: Cannot parse .htmlhintrc ' + (error.message || error));
    }
  }

  if (Object.keys(options).length > 0) {
    // Build a list of all available rules
    for (const key in HTMLHint.defaultRuleset) {
      if (HTMLHint.defaultRuleset.hasOwnProperty(key)) { // eslint-disable-line no-prototype-builtins
        ruleset[key] = 1;
      }
    }

    // Normalize htmlhint options
    // htmlhint only checks for rulekey, so remove rule if set to false
    for (const rule in options) {
      if (options[rule]) {
        ruleset[rule] = options[rule];
      } else {
        delete ruleset[rule];
      }
    }
  }

  // Add the defined custom rules
github bezoerb / gulp-htmlhint / index.js View on Github external
}

  // If necessary check for required param(s), e.g. options hash, etc.
  // read config file for htmlhint if available
  if (options.htmlhintrc) {
    try {
      const externalOptions = fs.readFileSync(options.htmlhintrc, 'utf-8');
      options = JSON.parse(stripJsonComments(externalOptions));
    } catch (error) {
      throw new Error('gulp-htmlhint: Cannot parse .htmlhintrc ' + (error.message || error));
    }
  }

  if (Object.keys(options).length > 0) {
    // Build a list of all available rules
    for (const key in HTMLHint.defaultRuleset) {
      if (HTMLHint.defaultRuleset.hasOwnProperty(key)) { // eslint-disable-line no-prototype-builtins
        ruleset[key] = 1;
      }
    }

    // Normalize htmlhint options
    // htmlhint only checks for rulekey, so remove rule if set to false
    for (const rule in options) {
      if (options[rule]) {
        ruleset[rule] = options[rule];
      } else {
        delete ruleset[rule];
      }
    }
  }
github groupe-sii / sonar-web-frontend-reporters / build / reporters / htmlhint.reporter.js View on Github external
value: function launch(done) {
      var _this2 = this;

      var optionsRC = this.getRCFile(this.options.rulesFile);
      this.options.htmlhint = [];
      for (var key in HTMLHint.defaultRuleset) {
        if (HTMLHint.defaultRuleset.hasOwnProperty(key)) {
          this.options.htmlhint[key] = 1;
        }
      }

      for (var rule in optionsRC) {
        if (optionsRC[rule]) {
          this.options.htmlhint[rule] = optionsRC[rule];
        } else {
          delete this.options.htmlhint[rule];
        }
      }

      glob(this.options.src, function (er, files) {
        _this2.processFiles(files, _this2.options);
        _this2.closeReporter(_this2.options.report);
github groupe-sii / sonar-web-frontend-reporters / build / reporters / htmlhint.reporter.js View on Github external
value: function launch(done) {
      var _this2 = this;

      var optionsRC = this.getRCFile(this.options.rulesFile);
      this.options.htmlhint = [];
      for (var key in HTMLHint.defaultRuleset) {
        if (HTMLHint.defaultRuleset.hasOwnProperty(key)) {
          this.options.htmlhint[key] = 1;
        }
      }

      for (var rule in optionsRC) {
        if (optionsRC[rule]) {
          this.options.htmlhint[rule] = optionsRC[rule];
        } else {
          delete this.options.htmlhint[rule];
        }
      }

      glob(this.options.src, function (er, files) {
        _this2.processFiles(files, _this2.options);
        _this2.closeReporter(_this2.options.report);