Skip to content

Conversation

@jawshooah
Copy link
Contributor

Fix the issue of JSON config files not working with more than one option specified (#567).

Also allow JSON config values to be strings rather than arrays, e.g.

{
    "format": "checkstyle-xml",
    "ignore": "important"
}

Finally, and perhaps most significantly, traditionally formatted .csslintrc files may now have arbitrary whitespace! So this also addresses #359. The following is now perfectly valid:

--ignore=
  adjoining-classes,
  box-model,
  compatible-vendor-prefixes,
  duplicate-background-images,
  import,
  important,
  outline-none,
  overqualified-elements,
  text-indent
--warnings=
  gradients,
  font-sizes,
  floats
--errors=
  shorthand,
  universal-selector,
  fallback-colors
--format=checkstyle-xml

Review on Reviewable

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it’s more efficient to use /[\s\n\r]+/g instead of /[\s\n\r]/g, because then the replacement happens only once for each run of whitespace, instead of once for every character of whitespace.

Also, MDN says that \s includes both \n and \r, so you could simplify it further to /\s+/g. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in f7f43e0.

@XhmikosR
Copy link
Member

XhmikosR commented Jan 9, 2016

@jawshooah: please take care of @bwinton's comments.

@frvge frvge changed the title Closes #567, among other things More lenient config files syntax Jan 10, 2016
@jawshooah
Copy link
Contributor Author

@XhmikosR done. Was going to add tests, but I don't really see a natural place to put them...

@XhmikosR
Copy link
Member

@jawshooah: can you squash the patches into one? If not I'll merge it manually another time.

@XhmikosR XhmikosR added this to the 1.0.0 milestone Jan 14, 2016
@jawshooah
Copy link
Contributor Author

Will do. I'm not familiar with the layout of the tests in this repo; can you think of a place where it would make sense to add tests for reading config data?

Fix the issue of JSON config files not working with more than
one option specified.

Also allow JSON config values to be strings, e.g.
{ "format" : "checkstyle-xml" }

Finally, and most significantly, traditionally formatted
.csslintrc files may now have arbitrary whitespace! So this
also addresses #359.
@jawshooah
Copy link
Contributor Author

@XhmikosR squashed.

XhmikosR added a commit that referenced this pull request Jan 17, 2016
More lenient config files syntax
@XhmikosR XhmikosR merged commit 9eefec2 into CSSLint:master Jan 17, 2016
@jawshooah jawshooah deleted the fix-json-options branch April 12, 2016 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants