GithubHelp home page GithubHelp logo

dayton1987 / stylelint-config-uploadcare Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stylelint/stylelint-config-standard

0.0 1.0 0.0 96 KB

The standard shareable config for stylelint

License: MIT License

JavaScript 100.00%

stylelint-config-uploadcare's Introduction

stylelint-config-uploadcare

NPM version Build Status Build status

The standard shareable config for stylelint.

Use it as is or as a foundation for your own config.

It is derived from the common rules found within a handful of CSS styleguides, including: The Idiomatic CSS Principles, Github's PrimerCSS Guidelines, Google's CSS Style Guide, Airbnb's Styleguide, and @mdo's Code Guide.

It favours flexibility over strictness for things like multi-line lists and single-line rulesets, and tries to avoid potentially divisive rules.

Example

@import url(x.css);
@import url(y.css);

/**
 * Multi-line comment
 */

.selector-1,
.selector-2,
.selector-3[type="text"] {
	background: linear-gradient(#fff, rgba(0, 0, 0, 0.8));
	box-sizing: border-box;
	display: block;
	color: #333;
}

.selector-a,
.selector-b:not(:first-child) {
	padding: 10px !important;
	top: calc(calc(1em * 2) / 3);
}

.selector-x { width: 10%; }
.selector-y { width: 20%; }
.selector-z { width: 30%; }

/* Single-line comment */

@media (min-width >= 60em) {
	.selector {
		/* Flush to parent comment */
		transform: translate(1, 1) scale(3);
	}
}

@media (min-orientation: portrait), projection and (color) {
	.selector-i + .selector-ii {
		background: color(rgb(0, 0, 0) lightness(50%));
		font-family: helvetica, "arial black", sans-serif;
	}
}

/* Flush single line comment */
@media
	screen and (min-resolution: 192dpi),
	screen and (min-resolution: 2dppx) {

	.selector {
		background-image:
			repeating-linear-gradient(
				-45deg,
				transparent,
				#fff 25px,
				rgba(255, 255, 255, 1) 50px
			);
		margin: 10px;
		margin-bottom: 5px;
		box-shadow:
			0 1px 1px #000,
			0 1px 0 #fff,
			2px 2px 1px 1px #ccc inset;
		height: 10rem;
	}

	/* Flush nested single line comment */
	.selector::after {
		content: 'โ†’';
		background-image: url(x.svg);
	}
}

Note: the config is tested against this example, as such the example contains plenty of CSS syntax, formatting and features.

Installation

$ npm install stylelint-config-uploadcare

Usage

If you've installed stylelint-config-uploadcare locally within your project, just set your stylelint config to:

{
	"extends": "stylelint-config-uploadcare"
}

If you've globally installed stylelint-config-uploadcare using the -g flag, then you'll need to use the absolute path to stylelint-config-uploadcare in your config e.g.

{
	"extends": "/absolute/path/to/stylelint-config-uploadcare"
}

Extending the config

Simply add a "rules" key to your config, then add your overrides and additions there.

For example, to add the at-rule-no-unknown rule and use its ignoreAtRules option, change the indentation to tabs, turn off the number-leading-zero rule and add the unit-whitelist rule:

{
	"extends": "stylelint-config-uploadcare",
	"rules": {
		"at-rule-no-unknown": [ true, {
			"ignoreAtRules": [
				"include",
				"mixin"
			]
		}],
		"indentation": "tab",
		"number-leading-zero": null,
		"unit-whitelist": ["em", "rem", "s"]
	}
}

Suggested additions

stylelint-config-uploadcare is a great foundation for your own config. You can extend it create a tailored and much stricter config:

Using the config with SugarSS syntax

The config is broadly compatible with SugarSS syntax. You will need to turn off the declaration-block-trailing-semicolon rule, as so:

{
	"extends": "stylelint-config-uploadcare",
	"rules": {
		"declaration-block-trailing-semicolon": null
	}
}

stylelint-config-uploadcare's People

Contributors

jeddy3 avatar akurganow avatar ntwb avatar davidtheclark avatar zmoki avatar arcanemagus avatar

Watchers

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