Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function lintFiles (input, options) {
const config = createConfig(options)
const patterns = input.length === 0 ? ['**/*.md'] : input
const engine = options.fix
? new textlint.TextFixEngine(config)
: new textlint.TextLintEngine(config)
return globby(patterns, {gitignore: true})
.then(paths => engine.executeOnFiles(paths))
.then(results => {
if (!options.fix) {
return results
}
const fixer = new TextLintFixer()
return fixer.write(results).then(() => results)
})
}
module.exports = function fixFiles (paths, options) {
const engine = new TextFixEngine(options)
return engine.executeOnFiles(paths).then(results => {
const fixer = new TextLintFixer()
return fixer.write(results).then(() => results)
})
}
get fixEngine() {
if (this._textFixEngine) {
return this._textFixEngine;
}
const textFixEngine = new textlint.TextFixEngine({
configFile: this.configFile,
rulesBaseDirectory: this.rulesBaseDirectory
});
this._textFixEngine = textFixEngine;
return textFixEngine;
}