GithubHelp home page GithubHelp logo

ptzagk / stylelint-use-nesting Goto Github PK

View Code? Open in Web Editor NEW

This project forked from csstools/stylelint-use-nesting

0.0 0.0 0.0 11 KB

Enforce nesting when it is possible in CSS

License: Creative Commons Zero v1.0 Universal

JavaScript 100.00%

stylelint-use-nesting's Introduction

Stylelint Use Nesting stylelint

NPM Version Build Status Support Chat

Stylelint Use Nesting is a stylelint rule to enforce nesting when it is possible in CSS.

Usage

Add stylelint and Stylelint Use Nesting to your project.

npm install stylelint stylelint-use-nesting --save-dev

Add Stylelint Use Nesting to your stylelint configuration.

{
  "plugins": [
    "stylelint-use-nesting"
  ],
  "rules": {
    "csstools/use-nesting": "always" || "ignore"
  }
}

Options

always

If the first option is "always" or true, then Stylelint Use Nesting requires all nodes to be linted, and the following patterns are not considered violations:

.example {
  color: blue;

  &:hover {
    color: rebeccapurple;
  }
}

While the following patterns are considered violations:

.example {
  color: blue;
}

.example:hover {
  color: rebeccapurple;
}

ignore

If the first option is "ignore" or null, then Stylelint Use Nesting does nothing.

Secondary Options

except

The except option ignores reporting or autofixing rules where the potentially nesting portion of the selector matches a case-insensitive string or regular expression.

{
  "rules": {
    "csstools/use-nesting": ["always", { "except": [':selection', /^:dir/i] }]
  }
}

only

The except option limits reporting and autofixing to rules where the potentially nesting portion of the selector matches a case-insensitive string or regular expression.

{
  "rules": {
    "csstools/use-nesting": ["always", { "only": ['.js', /^:(hover|focus)/i] }]
  }
}

stylelint-use-nesting's People

Contributors

jonathantneal avatar xhmikosr 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.