csslint icon indicating copy to clipboard operation
csslint copied to clipboard

Count-properties rule

Open jmjsdev opened this issue 12 years ago • 9 comments

@stubbornella #333

This is a new rule for counting properties and pair-values in the CSS. It export and object.

usage :

var result = CSSLint.verify(".foo { float: left; }", { "count-properties": 1});
console.log(result.stats['count-properties'].properties.float.count;)

Output : 1

jmjsdev avatar Jul 10 '13 18:07 jmjsdev

Did you try building it with Grunt?

stubbornella avatar Jul 11 '13 21:07 stubbornella

Overall, the pull request looks good. Can you please write up some documentation for the new rule? https://github.com/stubbornella/csslint/wiki/Rules

stubbornella avatar Jul 11 '13 23:07 stubbornella

@stubbornella Now the vendor-prefix are now manage, the regexp for cleaning is generic, and take car of some vendor prefix that doesn't begin with "-".

This list of vendor prefix is managed.

mso- Microsoft Office
-ms- Microsoft
prince- YesLogic
-<vendor prefix>- : all others vendor prefix (-moz-, -o-, -atsc-, -webkit-, etc..., it's generic)

jmjsdev avatar Jul 12 '13 10:07 jmjsdev

@stubbornella I have prepared the documentation on my computer and commited in but not pushed. Because I think it's not usefull to document something that doesn't exists in the code. I prefer to wait this PR is merge and push my doc. Otherwise I can also put my doc code in a comment in this PR to see if it is okay

jmjsdev avatar Jul 12 '13 13:07 jmjsdev

@arnogues - this PR won't automatically merge, can you update it?

stubbornella avatar Nov 22 '13 05:11 stubbornella

@stubbornella you can manually rebase/merge the PR by following the intructions in the merge box.


@arnogues I'm not sure what makes the most sense for the vendor prefixing.

  1. Count them as the same as the unprefixed (current approach)
  2. Ignore them
  3. Count them separately
  4. Add them as a separate property. result.stats['count-properties']['box-shadow].webkit.count;

nschonni avatar Nov 25 '13 01:11 nschonni

I'd be tempted to ignore vendor prefixes in this rule, just because they aren't really duplication a developer can do anything about...

stubbornella avatar Nov 25 '13 06:11 stubbornella

@arnogues - can you please put your doc code in this thread?

stubbornella avatar Nov 25 '13 06:11 stubbornella

@arnogues: can you rebase your branch?

XhmikosR avatar Aug 23 '14 06:08 XhmikosR