diff --git a/markdownlint.js b/markdownlint.js index 15864cc73..21907011b 100755 --- a/markdownlint.js +++ b/markdownlint.js @@ -34,8 +34,7 @@ const configFileParsers = [jsoncParse, jsYamlSafeLoad]; const fsOptions = {encoding: 'utf8'}; const processCwd = process.cwd(); -function readConfiguration(args) { - const userConfigFile = args.config; +function readConfiguration(userConfigFile) { const jsConfigFile = /\.js$/i.test(userConfigFile); const rcArgv = minimist(process.argv.slice(2)); if (jsConfigFile) { @@ -268,7 +267,7 @@ const diff = differenceWith(files, ignores, function (a, b) { function lintAndPrint(stdin, files) { files = files || []; - const config = readConfiguration(program); + const config = readConfiguration(options.config); const lintOptions = { config, customRules, diff --git a/test/md043-config.js b/test/md043-config.js index ec5e44c9c..3bff5f074 100644 --- a/test/md043-config.js +++ b/test/md043-config.js @@ -4,6 +4,7 @@ // -OR- // via require('some-npm-module-that-exports-config') module.exports = { + MD012: false, MD043: { headers: [ '# First', diff --git a/test/md043-config.json b/test/md043-config.json index 46bb7bca3..d9844a936 100644 --- a/test/md043-config.json +++ b/test/md043-config.json @@ -1,4 +1,5 @@ { + "MD012": false, "MD043": { "headers": [ "# First", diff --git a/test/md043-config.md b/test/md043-config.md index 554aa171b..b7f5729f4 100644 --- a/test/md043-config.md +++ b/test/md043-config.md @@ -7,3 +7,6 @@ Text Text ### Third + +Extra newline at end of file is sentinel to ensure config file is used + diff --git a/test/md043-config.yaml b/test/md043-config.yaml index f55a5c029..6dbf90fd9 100644 --- a/test/md043-config.yaml +++ b/test/md043-config.yaml @@ -1,3 +1,4 @@ +MD012: false MD043: headers: - "# First"