Skip to content

Commit

Permalink
Changes priority order, and fixes naming inconsistency of supported c…
Browse files Browse the repository at this point in the history
…onfig files
  • Loading branch information
Ben Edwards committed Jun 1, 2016
1 parent b70e217 commit 07cfcea
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ If you're using Grunt as your build system, you can use [grunt-puglint](https://

## Configuration file

Options and rules can be specified in a `.pug-lintrc` or `.pug-lint.json` file, or via adding a `"pugLintConfig"` option to `package.json`.
Options and rules can be specified in a `.pug-lintrc`, `.pug-lintrc.js`, or `.pug-lintrc.json` file, or via adding a `"pugLintConfig"` option to `package.json`.

### Options

Expand Down
10 changes: 9 additions & 1 deletion lib/config-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ var fs = require('fs')
, path = require('path')
, stripJSONComments = require('strip-json-comments')

, configs = [ 'package.json', '.pug-lintrc', '.pug-lint.json', '.jade-lintrc', '.jade-lint.json' ]
, configs =
[ '.pug-lintrc'
, '.pug-lintrc.js'
, '.pug-lintrc.json'
, '.pug-lint.json'
, '.jade-lintrc'
, '.jade-lint.json'
, 'package.json'
]

exports.getContent = function (config, directory) {

Expand Down
4 changes: 2 additions & 2 deletions test/config-file.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ describe('configFile', function () {
})

it('should load config file from specified JavaScript file', function () {
config = configFile.load(fixturesPath + 'js/.pug-lint.js')
config = configFile.load(fixturesPath + 'js/.pug-lintrc.js')

assert.equal(config.hasOwnProperty('disallowBlockExpansion'), true, config)
})

it('should load config file from specified JSON file', function () {
config = configFile.load(fixturesPath + 'json/.pug-lint.json')
config = configFile.load(fixturesPath + 'json/.pug-lintrc.json')

assert.equal(config.hasOwnProperty('disallowBlockExpansion'), true, config)
})
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/config-file/dotfile/.jade-lintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Comment
{ "disallowBlockExpansion": null
}
File renamed without changes.
3 changes: 3 additions & 0 deletions test/fixtures/config-file/json/.jade-lint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Comment
{ "disallowBlockExpansion": null
}
2 changes: 1 addition & 1 deletion test/fixtures/config-file/json/.pug-lint.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Comment
{ "disallowBlockExpansion": true
{ "disallowBlockExpansion": null
}
3 changes: 3 additions & 0 deletions test/fixtures/config-file/json/.pug-lintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Comment
{ "disallowBlockExpansion": true
}

0 comments on commit 07cfcea

Please sign in to comment.