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

stylelint-config-torchbox

v3.0.0

Published

Shareable stylelint config for CSS and SCSS, following Torchbox’s code style.

Downloads

2,813

Readme

stylelint-config-torchbox

stylelint-config-torchbox on npm Build status

Shareable stylelint config for CSS and SCSS, following Torchbox’s code style.

Usage

Install stylelint, and the config:

npm install --save-dev stylelint@13 [email protected]

Then configure stylelint to use this config. As a stylelint.config.js in the root of your project:

module.exports = {
  // See https://github.com/torchbox/stylelint-config-torchbox for rules.
  extends: 'stylelint-config-torchbox',
};

Tips

Linting setup for ongoing projects

Review our CHANGELOG for guidance on how to upgrade a project’s linting to a specific version.

More generally, when retrofitting stricter linting onto an existing project, consider a gradual approach to linting strictness, so you can start using linting without having to change significant portions of the project’s code. Here is an example, disabling commonly hard-to-retrofit rules:

// Rules which we ideally would want to enforce but are reporting too many issues currently.
const legacyRules = {
  'max-nesting-depth': null,
  'selector-max-specificity': null,
};

module.exports = {
  // See https://github.com/torchbox/stylelint-config-torchbox for rules.
  extends: 'stylelint-config-torchbox',
  rules: {
    ...legacyRules,
  },
};

Common CLI flags

We recommend the following run script to add to your package.json:

"lint:css": "stylelint --report-needless-disables 'src/sass' 'src/vue'"
  • Use --report-needless-disables flag to ensure you do not use more stylelint-disable comments than needed.
  • Target specific folders so Stylelint doesn’t attempt to lint e.g. JS or HTML files.

.stylelintignore

Stylelint supports ignore patterns in a .stylelintignore file, however we tend not to use this since we lint all files within a given folder.

Prettier

This config is Prettier-compatible, there isn’t anything extra needed.

Tailwind

This config should work with Tailwind with no adjustments needed. Please submit an issue if that’s not the case.

pre-commit

Here is a sample setup with our recommended configuration for the pre-commit pre-commit hook framework:

default_language_version:
  node: system
repos:
  - repo: https://github.com/thibaudcolas/pre-commit-stylelint
    rev: v13.13.1
    hooks:
      - id: stylelint
        files: \.(scss|vue)$
        additional_dependencies:
          - [email protected]
          - [email protected]

Vue

Stylelint supports Vue, and our configuration is usable in .vue single-file components with no changes. Do make sure linting is configured to check .vue files:

  • Wherever stylelint is manually invoked, make sure to point it both at stylesheets, and Vue components: stylelint --report-needless-disables './src/sass' './src/vue_components'.
  • With stylelint-webpack-plugin, use extensions: ['scss', 'vue'],.
  • With pre-commit, use files: \.(scss|vue)$.

Related tools

To get the most out of this config, it is assumed that projects have the following tools set up:

What’s included

See config.js for the config definition. This package includes configuration from:

Rules

For the full list of enabled, disabled, and unused rules, view src/rules.md.

Custom rules

Inherited rules

Contributing

See the contribution guidelines for guidance and setup instructions.