sfn
stylelint-find-new-rules
npm i stylelint-find-new-rules
sfn

stylelint-find-new-rules

Find stylelint rules that you don't have in your custom config.

by Donovan

4.0.0 (see all)License:MITTypeScript:Not Found
npm i stylelint-find-new-rules
Readme

stylelint-find-new-rules

Find stylelint rules that are not configured in your stylelint config.

Use this for your own Stylelint shareable configuration to list current configured rules,
all-available rules unused rules, and invalid / deprecated rules.

Acknowledgment

This module is an extended version of stylelint-find-rules, created by Alex Ilyaev.

Installation

Install as a dev dependency of your project:

# - Yarn
yarn add stylelint-find-new-rules --dev

# - NPM
npm install --save-dev stylelint-find-new-rules

Usage

It is expected to be used as local utility, as it needs stylelint and the stylelint-plugins being referred by the stylelint-config file, to be installed. Using it as a global utility, will error out, if stylelint and the stylelint-plugins being referred by the stylelint-config file, are not installed globally.

The intended usage is as an npm script:

{
  ...
  "scripts": {
    "stylelint-find-rules": "stylelint-find-new-rules [options] <file>"
  }
  ...
}

Note: If the <file> argument is not passed, this module will use the same resolution mechanism as Stylelint (cosmiconfig) to find your config data.

Then run it with:

# - Yarn
yarn stylelint-find-rules

# - NPM
npm run --silent stylelint-find-rules

Options

-u, --unused      Find available rules that are not configured.         [default: true]
                  To disable, set to false or use --no-u
                  
-d, --deprecated  Find deprecated configured rules.                     [default: true]
                  To disable, set to false or use --no-d
                  
-i, --invalid     Find configured rules that are no longer available.   [default: true]
                  To disable, set to false or use --no-i
                  
-c, --current     Find all currently configured rules.
-a, --available   Find all available stylelint rules.

API Usage

const stylelintRules = require('stylelint-find-new-rules');

stylelintRules('./my-config-file.js').then((rules) => {
    // `rules` format:
    // {
    //     used       : [[RULE], [RULE], ...],
    //     all        : [[RULE], [RULE], ...],
    //     unused     : [[RULE], [RULE], ...],
    //     deprecated : [[RULE], [RULE], ...],
    //     invalid    : [[RULE], [RULE], ...]
    // }
    // 
    // `[RULE]` format:
    // {
    //     name         : '[Rule name]',
    //     url          : '[URL of the rule's documentation if available or `null`]',
    //     isDeprecated : [boolean]
    // }
});

Downloads/wk

1K

GitHub Stars

10

LAST COMMIT

3mos ago

MAINTAINERS

1

CONTRIBUTORS

7

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
4.0.0
latest
3mos ago
No alternatives found
No tutorials found
Add a tutorial