Coder Social home page Coder Social logo

primer / stylelint-selector-no-utility Goto Github PK

View Code? Open in Web Editor NEW
6.0 4.0 5.0 123 KB

Stylelint rule that forbids re-styling Primer CSS utility classes

Home Page: https://primer.style/css/tools/linting

License: MIT License

HCL 19.14% JavaScript 80.86%
stylelint

stylelint-selector-no-utility's Introduction

primer/selector-no-utility

NPM version Build Status

This plugin is specific to Primer CSS. We'll accept pull requests to make it more generic, or feel free to fork and use it for your own needs.

Utilities are single purpose styles that should be treated as immutable CSS. They should not be altered by custom CSS as this can cause unwanted side effects.

    .m-0, #bar .float-left, #hoo { border: 1px solid pink; }
/** ↑          ↑
 * Each of these selectors */

The following patterns are considered warnings:

#bar .float-left { border: 1px solid pink; }
#bar {
  .float-left { border: 1px solid pink; }
}

The following patterns are not considered warnings:

#bar { color: pink; }

Install

This repository is distributed with npm, and can be installed with:

$ npm install --save-dev stylelint-selector-no-utility

Usage

In your stylelint config add this.

{
  "plugins": [
    "stylelint-selector-no-utility"
  ],
  "rules": {
    "primer/selector-no-utility": true
  }
}

Related

License

MIT © GitHub

stylelint-selector-no-utility's People

Contributors

jonrohan avatar shawnbot avatar broccolini avatar greenkeeperio-bot avatar

Stargazers

Sean P. Myrick V19.1.7.2 avatar Sanaf avatar Mu-An Chiou avatar  avatar Stephen Edgar avatar Don Okuda avatar

Watchers

 avatar James Cloos avatar  avatar Sean P. Myrick V19.1.7.2 avatar

stylelint-selector-no-utility's Issues

Send PR to stylelint docs?

This plugin looks great!

Would you consider sending a PR to stylelint adding it to the list of plugins? Or, let me know if you're OK with it being added, and I can do it for you. The list is looking a little sparse at the moment you see, and we're keen to adding some good quality plugins to it to get things going :)

Upgrade stylelint

In order to address primer/stylelint-config#22, we'd need to upgrade to stylelint >=9.8.0. Since the micromatch team confirmed that that vulnerability isn't really an issue & this would take upgrading two breaking versions up, I'd consider this low urgency, but would be nice to do eventually so people don't see that alert on vuln audits.

Forbid all overrides of Primer classnames

We'd like to change this stylelint rule to include all classnames (or more specifically, selectors?) in Primer CSS. So:

  • Update the rule look for classnames in stats/primer.json, rather than stats/utilities.json.
  • Rename this package and repo to something more accurate, e.g. stylelint-no-primer-override

/cc @primer/ds-core

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.