npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@babbel/stylelint-config

v1.0.5

Published

Hierarchical Stylelint configuration collection that intends to be simple to use, layered, and shared with others

Downloads

273

Readme

NPM module @babbel/stylelint-config

Hierarchical Stylelint configuration collection that intends to be simple to use, layered, and shared with others [maintainers]

Stylelint Configurations

If you're unfamiliar with Stylelint, it works similarly to ESLint with some minor but unique changes in configuration syntax. You can read more about those differences here.

There are multiple configurations you can use in your projects listed below. Please note that the base configuration is used by all the others, so there's no need to include that in your configuration unless it's the only one you're using.

The configuration names specified below should be used as items in the extends array in your Stylelint configuration file. Each configuration string is clickable to bring you to the configuration details.

Configuration Assumptions

  • Similar to Prettier, these configurations are highly-opinionated, but unlike Prettier they are all customizable
    • This is meant to minimize decision paralysis and promote a common baseline
  • Modern, performant features are enforced
  • Browser incompatibilities are proactively avoided if you use browserslist with your project

Example Usage

Here are a few common use cases to get you familiar with using this collection. The following examples should be added to the .stylelintrc.json file at the root of your repository.

CSS-based Stylesheets

{ "extends": "@babbel/stylelint-config/css" }

Yep. That's it. 😀

Or if you want to add some custom rules:

{
  "extends": "@babbel/stylelint-config/css",
  "rules": {
    /* add your custom rules here */
  },
}

CSS Module-based Stylesheets

{ "extends": "@babbel/stylelint-config/css-modules" }

I think you're getting the hang of it now...

SCSS-based Stylesheets and a Custom Rule

{
  "extends": "@babbel/stylelint-config/scss",
  "rules": {
    "custom-property-pattern": "[a-z]+[a-zA-Z]*",
  },
}

Making Your Own Config From the Base Config 🎓

{
  "extends": "@babbel/stylelint-config",
  "rules": {
    /* add all your custom rules here */
  },
}

The config export @babbel/stylelint-config maps to the base config file lib/stylelintBaseConfig.json. You can see how this works by looking for the "." entry in the exports section of package.json; that section defines all the config exports rather than using proxy files such as index.js at the root of the repository.

For example, if you want to add an export called @babbel/stylelint-config/example, you would do the following:

  • Create a new Stylelint configuration file called ./lib/stylelintExampleConfig.json and set your preferred settings within.
  • For the /example package export to work, add a new entry in the "exports" section in package.json:
{
  "exports": {
    /* ... */
    "example": "./lib/stylelintExampleConfig.json",
    /* ... */
  },
}
  • File a pull request. Be sure to at least extend from lib/stylelintBaseConfig.json or one of the more specific configs, otherwise the addition of your contribution to the project may be delayed.

Final Thoughts

These are just a few examples. Any configuration option in any Stylelint configuration can be overridden, so you can customize these as much as you want. If you find yourself or your team using a configuration set over and over again, consider submitting it to make it part of this collection.

Feedback Encouraged 🙂

If you have any suggestions for improvements, please send them our way. We're interested in your ideas. 📫