/csslint-cli

Node based CLI tool for CSSLint

Primary LanguageJavaScript

CSSLint-CLI Build Status Coverage Status Code Climate

Alternative CLI for CSSLint.

Get it

npm install csslint-cli -g

or

git clone git@github.com:dmi3y/csslint-cli.git
cd csslint-cli && grunt

Usage

CLI
    csslint-cli [options]* [file|dir [file|dir]]*
From scripts
    var csslintCli = require('csslint-cli');

    csslintCli.init(options/*object*/, targets/*array*/);

Features:

  • Looks up directory (till the top or user home) for first available .csslintrc file.

  • Checks every target directory for .csslintrc and accordingly applying it to all child targets.

  • Multiply targets csslint-cli --errors=ids styles/a.css styles/b.css styles/c.css legacy/styles/.

  • Improved visual feedback.
    Screenshot

  • Additional parameters:

    • --squash - merging warnings|errors|ignores provided via CLI into `.csslintrc' rules instead of overriding.
    • --config - path to arbitrary .csslintrc file, it will block looking up and checking targets directories for rc file, that's most likely usecase for this option.
    • --threshold=0|1|2|ignore|warnings|errors - setup report level for rules which are not explicitly set, default is 1 (warnings).
  • Backward compatability with original CLI.

  • .csslintrc multiformat support, with comments in json.

    Original CLI inspired format:

        --errors=ids,zero-units
        --warnings=shorthand,text-indent
        --ignore=star-property-hack,floats
    

    Reads the same as its json represintation:

        {
            "errors": [
                "ids",
                "zero-units"
            ],
            "warnings": [
                "shorthand", /* cleanup */
                "text-indent"
            ],
            "ignore": [
                "star-property-hack", // legacy
                "floats"
            ]
        }

    And same as block style rules json:

        {
            "ids": 2, // errors
            "zero-units": true, // errors
            "shorthand": 0, /* warnings */
            "text-indent": "", /* warnings */
            "star-property-hack": 1, // ignore
            "floats": false // ignore
        }
  • Custom reporters hook ups.

Credits

License

Copyright (c) 2014 Dmitry Lapshukov. Licensed under the MIT license.