Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function fix(source: string) {
const errors = eslintValidate(source);
return fixer.applyFixes(linter.getSourceCode(), errors);
}
var importedAliases = config.importedAliases;
if (importedAliases) {
var newGlobals = _.zipObject(importedAliases, _.times(importedAliases.length, _.stubTrue));
config.globals = _.assign({}, originalGlobals, newGlobals);
}
var results = eslint.linter.verify(contents, config, file);
if (importedAliases) {
config.globals = originalGlobals;
}
if (results.length) {
var fixedContent = SourceCodeFixer.applyFixes(contents, results);
if (fixedContent.fixed) {
contents = fixedContent.output;
}
}
return {
contents,
results
};
};
export function fix(source: string) {
const errors = eslintValidate(source);
return fixer.applyFixes(linter.getSourceCode(), errors);
}
output += `${relativePath}\n`
for (const message of messages) {
output += `${message.line}:${message.column} ${message.ruleId || ''}`
if (message.ruleId) {
const ruleURI = getRuleURI(message.ruleId)
if (ruleURI.found) {
output += ` (${ruleURI.url})`
}
}
output += `\n\t${message.message}\n`
}
if (messages.some(msg => msg.fix)) {
const fixResult = SourceCodeFixer.applyFixes(result.source, messages)
output += `\n\n$ eslint --fix ${relativePath}\n`
output += diff(result.source, fixResult.output)
}
output += '\n\n'
}
const total = errors + warnings
if (total > 0) {
output += [
'\u2716 ',
total,
pluralize(' problem', total),
' (',
errors,