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

@bitfactory/stylelint-config

v2.7.0

Published

Stylelint sharable config for Bitfactory projects

Downloads

660

Readme

@bitfactory/stylelint-config

This is a shareable config for Stylelint. All the rules and configurations are already set. Rules can be overridden if needed.

:package: Installing

Include the config into your project:

npm install @bitfactory/stylelint-config --save-dev --save-exact

Then install the dependencies that the config needs:

npx install-peerdeps --dev --extra-args="-E" @bitfactory/stylelint-config

In your project, create a .stylelintrc.js file with the following contents:

// NOTE: for now this does not work with ESM style modules, somehow `export default` gives errors.
// NOTE: it looks like this file is not checked by eslint with .cjs extension. For now keep it at .js.

/* eslint-disable-next-line unicorn/prefer-module */
module.exports = {
    extends: ['@bitfactory/stylelint-config'],
};

PostCSS projects

To use this config with a PostCSS project, also install the following package:

npm install postcss-html --save-dev --save-exact

And set extends to the following config:

module.exports = {
    extends: ['@bitfactory/stylelint-config/postcss'],
};

The project does not have to use the customSyntax and overrides for postcss anymore. This is included in the config.


PostCSS+SCSS projects

To use this config with a PostCSS with SCSS/SASS project, also install the following packages:

npm install postcss-html postcss-scss --save-dev --save-exact

And set extends to the following config:

module.exports = {
    extends: ['@bitfactory/stylelint-config/scss'],
};

SASS projects

To use this config with a SASS project, also install the following package:

npm install stylelint-scss --save-dev --save-exact

And set extends to the following config:

module.exports = {
    extends: ['@bitfactory/stylelint-config/sass'],
};

:firecracker: Turning off rules

To turn off a rule, you can set the value of the rule to null in your .stylelintrc.js file:

module.exports = {
    extends: ['@bitfactory/stylelint-config'],
    rules: {
        'declaration-no-important': null,
    },
};

Or when you only need to turn off a rule for a specific line, use the /* stylelint-disable-line */ comment, followed by the rule:

.selector {
    color: #fff !important; /* stylelint-disable-line declaration-no-important */
}

More about disabling Stylelint rules can be found here.

:rocket: CLI usage

To use Stylelint in the command-line, add the following scripts to your projects package.json:

{
  "scripts": {
    "stylelint": "stylelint '**/*.css'",
    "stylelint:fix": "npm run stylelint -- --fix"
  }
}

You can run the commands with:

$ npm run stylelint
$ npm run stylelint:fix

With SCSS use:

{
  "scripts": {
    "stylelint": "stylelint '**/*.scss'",
    "stylelint:fix": "npm run stylelint -- --fix"
  }
}

With Vue add:

{
  "scripts": {
      "stylelint:vue": "stylelint '**/*.vue'",
      "stylelint:vue:fix": "npm run stylelint:vue -- --fix"
  }
}

You can run the commands with:

$ npm run stylelint:vue
$ npm run stylelint:vue:fix

:pencil2: Editor / IDE integration

For Stylelint to work, you need to set up your editor / IDE.

Visual Studio Code

  1. Install the Stylelint extension
  2. Get linting :rocket:

Additional Extensions

:warning: If you have the Prettier extension enabled, make sure to disable the extension for your project's workspace. This is because Prettier's rules will conflict with ours.


PhpStorm

Todo…

Stylelint 15 & upcoming version 16

Stylelint is fixed on version 15.x.x because in version 16.x.x all the deprecated rules are removed and can not be used at all.

See the issue Stylelint v16 + Prettier config needed on this repository in GitHub.