UNPKG

isml-linter

Version:

ISML Linter is a tool for examining if your project's templates follow a specified set of rules defined by your dev team. The available rules can be roughly grouped into:

40 lines (31 loc) 1.15 kB
const IsmlLinter = require('./IsmlLinter'); const Builder = require('./Builder'); const ConsoleUtils = require('./util/ConsoleUtils'); let linterResult = {}; module.exports = { setConfig : json => IsmlLinter.setConfig(json), getConfig : () => IsmlLinter.getConfig(), parse : (path, content, config) => { if (config) { IsmlLinter.setConfig(config); } linterResult = IsmlLinter.run(path, content); return linterResult; }, fix : (path, content, config) => { let autofixConfig = config; if (config) { autofixConfig.autoFix = true; IsmlLinter.setConfig(autofixConfig); } else { autofixConfig = IsmlLinter.getConfig(); autofixConfig.autoFix = true; IsmlLinter.setConfig(autofixConfig); } return IsmlLinter.run(path, content, autofixConfig); }, printResults : () => ConsoleUtils.displayOccurrenceList(linterResult), build : path => Builder.run(path), IsmlLinter, Builder };