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

@ntvr/stylelint-config

v3.0.0

Published

Netvor's shareable config for stylelint

Downloads

51

Readme

@ntvr/stylelint-config

npm version Node version Stylelint version Build status Downloads per month HitCount

Netvor's shareable collection of configs for Stylelint:

ℹ️ Note: This package is heavily based on VisionApps stylelint config

  • extends stylelint-config-standard,
  • adds rules to encourage low specificity and avoid nesting,
  • gives preference to indentation of tab,
  • includes additional configs for SCSS, CSS Modules and Kebab classes,
  • uses stylelint-stylistic plugin to cover some rules that are no longer supported by Stylelint itself.

Installation

Install Stylelint and this config:

$ npm install --save-dev stylelint @ntvr/stylelint-config

Basic Usage

Apply the config in your Stylelint config:

{
	"extends": "@ntvr/stylelint-config"
}

To see the rules that this config uses, please read the main config itself.

Optional: Checking Properties Order

To further extend control over coding style of your stylesheets, you can also check for properties order:

{
	"extends": [
		"@ntvr/stylelint-config",
		"@ntvr/stylelint-config/order"
	]
}

The order config enforces properties order given by following categories:

  1. all properties,
  2. content,
  3. position,
  4. appearance,
  5. box model,
  6. typography,
  7. decorations,
  8. effects and transforms,
  9. interactions,
  10. transitions and animations.

To see the order of individual properties this config prescribes, please read the order config itself.

👉 order config is entirely independent on the main config and thus can be listed anywhere in the extends section of your config. However, that's not the case with our other extending configs.

Usage with SCSS

To lint SCSS files (i.e. *.scss, not *.sass), add the scss config that extends stylelint-config-standard-scss, fixes its incompatibilities with our main config, and overrides some rules to better work with complex stylesheets:

{
	"extends": [
		"@ntvr/stylelint-config",
		"@ntvr/stylelint-config/scss"
	]
}

⚠️ Please mind the order of extended configurations, scss config must come after the main config.

To see the rules that this config uses, please read the scss config itself.

Usage with CSS Modules

To lint CSS files in project that leverages CSS Modules, drop in the cssModules config that fixes key incompatibilities of CSS Modules syntax with the main config:

{
	"extends": [
		"@ntvr/stylelint-config",
		"@ntvr/stylelint-config/cssModules"
	]
}

Or along with SCSS:

{
	"extends": [
		"@ntvr/stylelint-config",
		"@ntvr/stylelint-config/scss",
		"@ntvr/stylelint-config/cssModules"
	]
}

⚠️ Please mind the order of extended configurations, cssModules must come after the main config, or after the scss config, if present.

⚠️ Only essential features of CSS Modules are recognized by this config. Namely, just camelCase notation for class names and :global pseudo selectors are covered. All other features of CSS Modules (like composes, :local, @value, etc.) are considered non-essential as they can be implemented with Sass (which we encourage) and thus are not recognized by this config.

To see the rules that this config uses, please read the cssModules config itself.

ℹ️ There is a popular stylelint-config-css-modules config that recognizes all features of CSS Modules.

Usage with Kebab classes check

To lint classnames if they follow kebab-case convention, add the kebab-classes config. This could be used in for example bootstrap implementation. This config is not to be used in combination with cssModules config.

{
	"extends": [
		"@ntvr/stylelint-config",
		"@ntvr/stylelint-config/kebab-classes"
	]
}
{
	"extends": [
		"@ntvr/stylelint-config",
		"@ntvr/stylelint-config/scss",
		"@ntvr/stylelint-config/kebab-classes"
	]
}

⚠️ Please mind the order of extended configurations, kebab-classes config must come after the main config and/or after the scss config.

To see the rules that this config uses, please read the kebab-classes config itself.

Full Example

Example of all configs combined:

{
	"extends": [
		"@ntvr/stylelint-config",
		"@ntvr/stylelint-config/order",
		"@ntvr/stylelint-config/scss",
		"@ntvr/stylelint-config/cssModules"
	]
}

or

{
	"extends": [
		"@ntvr/stylelint-config",
		"@ntvr/stylelint-config/order",
		"@ntvr/stylelint-config/scss",
		"@ntvr/stylelint-config/kebab-classes"
	]
}