Code Monkey home page Code Monkey logo

csslint-cli's Introduction

CSSLint-CLI Build Status Coverage Status Code Climate

Alternative CLI for CSSLint.

Get it

npm install csslint-cli -g

or

git clone [email protected]: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.

csslint-cli's People

Contributors

dmi3y avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

csslint-cli's Issues

[Feature request] Update csslint-cli

1. Request

It would be nice, if you update csslint-cli. Now last edit in your repository date 3 years ago.

2. Justification

I use your CLI, not default csslint CLI, because I can use one .csslintrc file in root directory of my projects. Yes, I have seen your pull-request for csslint, but I think, that I'll still have problems with TravisCI or AppVeyor csslint integration.

By this reason it would be nice, if csslint-cli will be longer maintained.

3. Actual behavior

For example, I have a file sublime-text.css.

D:\…a\themes\sashapelican\static\css\sections>csslint-cli sublime-text.css

+-.\sublime-text.css: 3 issue(s):
|
|   L84:C5 . . . background: rgba(255, 228, 181, 0.99);
|   WARN: Fallback background (hex or RGB) should precede RGBA background.(fallback-colors)
|
|   L89:C5 . . . background: rgba(255, 228, 181, 0.99);
|   WARN: Fallback background (hex or RGB) should precede RGBA background.(fallback-colors)
|
|   L94:C5 . . . background: rgba(255, 228, 181, 0.99);
|   WARN: Fallback background (hex or RGB) should precede RGBA background.(fallback-colors)
|
+-.\sublime-text.css

4. Expected behavior

I get extra order-alphabetical rule output.

D:\…a\themes\sashapelican\static\css\sections>csslint sublime-text.css


csslint: There are 7 problems in D:\Kristinita\themes\sashapelican\static\css\sections\sublime-text.css.

sublime-text.css
1: warning at line 59, col 1
Rule doesn't have all its properties in alphabetical order.
blockquote {

sublime-text.css
2: warning at line 84, col 5
Fallback background (hex or RGB) should precede RGBA background.
    background: rgba(255, 228, 181, 0.99);

sublime-text.css
3: warning at line 89, col 5
Fallback background (hex or RGB) should precede RGBA background.
    background: rgba(255, 228, 181, 0.99);

sublime-text.css
4: warning at line 94, col 5
Fallback background (hex or RGB) should precede RGBA background.
    background: rgba(255, 228, 181, 0.99);

sublime-text.css
5: warning at line 102, col 1
Rule doesn't have all its properties in alphabetical order.
.tooltipster-punk-purple .tooltipster-box

sublime-text.css
6: warning at line 110, col 1
Rule doesn't have all its properties in alphabetical order.
.tooltipster-punk-aquamarine .tooltipster-box

sublime-text.css
7: warning at line 126, col 1
Rule doesn't have all its properties in alphabetical order.
.SashaEpigraph {

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.