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-sds

v0.0.1

Published

## Overview This repository provides custom Stylelint rules for Salesforce Lightning Design System (SLDS) styling. Follow the setup instructions to contribute or integrate these rules into your project.

Downloads

72

Readme

Stylelint for SLDS

Overview

This repository provides custom Stylelint rules for Salesforce Lightning Design System (SLDS) styling. Follow the setup instructions to contribute or integrate these rules into your project.

Setup Instructions

To contribute to this repository, please follow these steps:

  1. Clone the Repository
    git clone [email protected]:salesforce-ux/stylelint-sds.git
    cd stylelint-sds
    
  2. Install Dependencies Run the following command to install the necessary packages:
npm install
  1. Build the Rules To compile the rules into a single file, execute:
npm run build

After this step, you should see a new build directory containing all required files, including package.json, index.js, and README.js.

Linking the Repository

Since this package is not yet distributed via npm, you can link it locally for testing purposes:

  1. Change to the build directory:
cd build
npm link

This command prepares your local npm package for linking to other projects.

Usage in a Project

After linking the package, you can use it in your project:

  1. Link the package in your project directory:
npm link @salesforce-ux/stylelint-sds
  1. Verify the link by checking the node_modules directory.
  2. Install the required dependencies:
npm install stylelint postcss-html --save-dev
  1. Create a Stylelint configuration file named .stylelintrc.yml. Below is an example configuration: Here is an example
plugins:
  - @salesforce-ux/sf-sds-linter

overrides:
  - files:
      - "**/*.css"
    customSyntax: postcss
    rules:
      slds-css/no-slds-class-overrides:
        - true
        - severity: warning
      slds-css/no-important:
        - true
        - severity: warning
      slds-css/no-hardcoded-values:
        - true
        - severity: error
      # slds-css/enforce-use-of-utility-classes:
      #   - true
      slds-css/no-aura-tokens:
        - true
      slds-css/lwc-to-slds-token:
        - true

      slds-css/enforce-bem-usage:
        - true
      slds-css/no-deprecated-slds-classes:
        - true
      slds-css/no-deprecated-slds-hooks:
        - true
      slds-css/no-lwc-custom-properties:
        - true
      slds-css/no-sds-custom-properties:
        - true
      slds-css/no-slds-private-var:
        - true

  - files:
      # Apply this custom syntax only to HTML files
      - "**/*.html"  
    # Parse HTML files to extract CSS
    customSyntax: "postcss-html"  
    # You can define specific rules for HTML files, or leave it empty to ignore
    rules: {}  

report: true

Generating SARIF Reports

Use the below command

stylelint **/*.css --custom-formatter=node_modules/stylelint-sarif-formatter/index.js --output-file report.sarif

Running Stylelint on a Specific Repository

stylelint "path/to/directory/**/*.css" --config path/to/.stylelintrc.json --custom-formatter=node_modules/stylelint-sarif-formatter/index.js --output-file report.sarif