Giter VIP home page Giter VIP logo

stylelint's Introduction

stylelint

NPM version Build Status Build status

A mighty, modern CSS linter that helps you enforce consistent conventions and avoid errors in your stylesheets.

Upgrading? Please read our CHANGELOG to learn what changes to expect in the latest version, whether that's new features, bug fixes, renamed rules, or whatever else.

Features

  • Over a hundred rules: From stylistic rules (e.g. checking the spacing around the colon in declarations) to rules that catch subtle coding mistakes (e.g. invalid hex colors or overriding shorthand properties).
  • Support for the latest CSS syntax: Including custom properties, range context for media features, calc() and nesting.
  • Understands CSS-like syntaxes: The linter is powered by PostCSS, so it understands any syntax that PostCSS can parse, including SCSS, SugarSS, and experimental support for Less.
  • Completely unopinionated: Only enable the rules you want, and configure them with options that tailor the linter to your needs.
  • Automatically fix some stylistic warnings: By using stylefmt which supports stylelint configuration files.
  • Shareable configs: If you don't want to craft your own config, you can extend a shareable config.
  • Support for plugins: It's easy to create your own rules and add them to the linter.
  • Options validator: So that you can be confident that your config is valid.

Example output

Example

Quick start

With stylelint, it's easy to start linting your CSS:

  1. Decide how you want to use stylelint:

  2. Create your configuration object (probably as a .stylelintrc file) by either crafting your own config or extending a pre-written, shared config.

    • If you want to use a pre-written config, just find one and extend it. We recommend trying stylelint-config-standard, which includes around 60 of stylelint's rules with sensible defaults. (You can always override specific rules after extending a config.)
    • To craft your own from the ground up, learn about rules. All of the rules are off by default, so you only have to learn about the rules you want to turn on and enforce. That way you can start small, growing your config over time as you have a chance to explore more of the rules. Alternately, copy-paste this example configuration, which lists all of stylelint's rules and their primary options, then remove (or turn off) the rules you don't want and edit the primary option of each rule to your liking.
  3. Lint!

Be sure to specify the syntax if you're using non-standard syntax (e.g. SCSS, SugarSS or Less).

Guides

You'll find more detailed information on using stylelint and tailoring it to your needs in our guides:

  • User guide - Usage, configuration, FAQ and complementary tools.
  • Developer guide - Contributing to stylelint and writing your own plugins & formatters.

Help out

There is always a lot of work to do, and already well over 100 rules to maintain. So please help out in any way that you can:

  • Create, enhance, and debug rules (see our guide to "Working on rules").
  • Improve documentation.
  • Chime in on any open issue or pull request.
  • Open new issues about your ideas for making stylelint better, and pull requests to show us how your idea works.
  • Add new tests to absolutely anything.
  • Work on improving performance of rules.
  • Create or contribute to ecosystem tools, like the plugins for Atom and Sublime Text.
  • Spread the word.

We communicate via issues and pull requests.

There is also stackoverflow, which is our preferred QA forum. Tag your post with "stylelint".

Important documents

stylelint's People

Contributors

alan-agius4 avatar alexander-akait avatar arcanemagus avatar besartbytyqi avatar borodean avatar byodkm avatar chaosexanima avatar dan-gamble avatar davidtheclark avatar gitter-badger avatar jeddy3 avatar juliancwirko avatar kangax avatar kyokutyo avatar larrifax avatar m-allanson avatar madcampos avatar mahtd avatar makotot avatar micada avatar moox avatar ntwb avatar onigoetz avatar philippbaschke avatar rafaelrinaldi avatar s10wen avatar shinnn avatar totora0155 avatar trysound avatar tx44 avatar

Watchers

 avatar

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.