gruntjs/grunt-contrib-csslint — pull request #35 by dmi3y (2014-04-23 01:20:35+00:00)
Title: Makes task understand native .csslintrc format

Intro:

Currently csslint grunt plugin supports json csshint flavored format for `.csslintrc`, although the csslint itself define own syntax which is plain text with cli flags separated by [whitespace](1) or [newline](2). [Next](3) version of csslint will support [json](4) formatted rc files, but it is not compatible with grunt defined version.

Why:

In case to share same options between csslint (for example to integrate it with sublimelinter, or simply to use it as cli) and grunt plugin we have duplicate them in different files. This could be automated with custom script, but I feel better approach would be to provide multiformat support by either csslint or grunt plugin wrapper. As soon as grunt plugin json format never been part of csslint, I do pr here.

What:

- [Externalized]() parser which makes possible guesses over which format has provided configuration string.
- Parse and normalize provided options into grunt plugin version json.
- As side bonus it striped out comments if any of loose hash formats provided instead (eval instead of json parse).
- Unit tests here as well.

[1]: https://github.com/dmi3y/grunt-contrib-csslint/blob/nativecsslintrc/test/parsecsslintrc/nativeoneline
[2]: https://github.com/dmi3y/grunt-contrib-csslint/blob/nativecsslintrc/test/parsecsslintrc/nativemultiline
[3]: https://github.com/CSSLint/csslint/issues/359#issuecomment-35819236
[4]:https://github.com/dmi3y/grunt-contrib-csslint/blob/nativecsslintrc/test/parsecsslintrc/nativejson
[5]:https://github.com/dmi3y/grunt-contrib-csslint/blob/nativecsslintrc/tasks/utils/parsecsslintrc.js