Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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
}
// 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];
}
}
}
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);
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);