From c1cb555db50ed712533a81f33e925467d06a2977 Mon Sep 17 00:00:00 2001 From: Yusuke Otsuka Date: Thu, 24 Oct 2019 17:09:28 +0900 Subject: [PATCH] feat: support opts for lint --- run.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/run.js b/run.js index 6db9b5a..ebf271f 100644 --- a/run.js +++ b/run.js @@ -60,13 +60,27 @@ function getHistoryCommits(from, to) { }) } +function getOptsFromConfig(config) { + return { + parserOpts: + config.parserPreset != null && config.parserPreset.parserOpts != null + ? config.parserPreset.parserOpts + : {}, + plugins: config.plugins != null ? config.plugins : {}, + ignores: config.ignores != null ? config.ignores : [], + defaultIgnores: + config.defaultIgnores != null ? config.defaultIgnores : true, + } +} + const showLintResults = async ([from, to]) => { const commits = await getHistoryCommits(from, to) const config = existsSync(configPath) ? await load({}, { file: configPath }) : {} + const opts = getOptsFromConfig(config) const results = await Promise.all( - commits.map(commit => lint(commit, config.rules)), + commits.map(commit => lint(commit, config.rules, opts)), ) const formattedResults = format( { results },