GithubHelp home page GithubHelp logo

jamesarosen / stylelint-order Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hudochenkov/stylelint-order

0.0 2.0 0.0 272 KB

A plugin pack of order related linting rules for stylelint.

License: MIT License

JavaScript 100.00%

stylelint-order's Introduction

stylelint-order Build Status npm version npm downloads last month

A plugin pack of order related linting rules for stylelint. Every rule support autofixing (stylelint --fix).

Installation

First, install stylelint:

npm install stylelint --save-dev

Then install plugin:

npm install stylelint-order --save-dev

Usage

Add stylelint-order to your stylelint config plugins array, then add rules you need to the rules list. All rules from stylelint-order need to be namespaced with order.

Like so:

// .stylelintrc
{
	"plugins": [
		"stylelint-order"
	],
	"rules": {
		// ...
		"order/order": [
			"custom-properties",
			"declarations"
		],
		"order/properties-alphabetical-order": true
		// ...
	}
}

List of rules

Autofixing

Every rule support autofixing (stylelint --fix). postcss-sorting is using internally for order autofixing.

Automatic sortings has some limitation, which are described for every rule if any. Please, take a look at how comments are handled by postcss-sorting.

CSS-in-JS styles with template interpolation could be ignored by autofixing to avoid styles corruption.

Autofixing is enabled by default if it's enabled in stylelint configuration. Autofixing can be disabled on per rule basis using disableFix: true secondary option. E. g.:

{
	"rules": {
		"order/order": [
			[
				"custom-properties",
				"declarations"
			],
			{
				"disableFix": true
			}
		]
	}
}

Less isn't supported. It might work, but haven't tested.

Thanks

properties-order and properties-alphabetical-order code and readme are based on declaration-block-properties-order rule which was a stylelint's core rule prior stylelint 8.0.0.

stylelint-order's People

Contributors

hudochenkov avatar doochik avatar chemoish avatar cascornelissen avatar erikvold avatar mbrowne avatar njbraun avatar jeddy3 avatar

Watchers

James Cloos avatar  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.