Coder Social home page Coder Social logo

csslint-custom-rules's Introduction

CSSLint-custom-rules

custom rules for CSSLint.

This repo has a set of custom rules that you can add to csslint. Copy paste them as you see fit.

I'm using the csslint node version. For me adding the rules is done by, navigating to "/usr/local/lib/node_modules/csslint/lib/ and altering the csslint-node.js file. For a video example, see the movie examples folder.

Rules:

Not all the rules below are provided. I do plan to do this in future versions.

  • disallow classes with underscores (should use dash)
  • disallow classes with uppercases
  • properties should be in lowercase
  • color codes should be in lowercase
  • color codes, write full number expl: #ffffff instead of #fff
  • don't use presentational names for class names expl: no .red-link
  • no space between property and the : => border: instead of border :
  • have one space after : and one space between the values => border: 1px solid black;
  • don't use shorthand notation for fonts => bad: font: arial 15px/17px body{font: bold 15px arial;} h1{font: 25px arial} In this case h1 will not be bold, wich is confusing
  • don't use shorthand notation for list items (cause confusion)
  • end vendor prefixes with final recomendation => webkit-border-radius: 20px; border-radius: 20px; More info can be found in the wiki

generating report:

csslint has a cli option to export your results to an xml file: csslint yourcss.css --format=lint-xml > csslint.xml

After exporting, you can transform the output with the xslt file in this repo. Mac users can use xsltproc in the terminal like so:

xsltproc csslint-report.xslt csslint.xml > csslint-report.html

to generate an html file with the results.

For your convenience, I also included a bash script that does all this in one go. just "bash csslint-report.sh path/to/your/cssfile"

Movies

To help you get an idea how all this works, visit the movie section

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.