Gathering detailed insights and metrics for stylelint-custom-processor-loader
Gathering detailed insights and metrics for stylelint-custom-processor-loader
Gathering detailed insights and metrics for stylelint-custom-processor-loader
Gathering detailed insights and metrics for stylelint-custom-processor-loader
stylelint-processor-styled-components
A stylelint processor for styled-components
stylelint-config-styled-components
A shareable stylelint config for stylelint-processor-styled-components
stylelint-declaration-strict-value
Specify properties for which a variable, function, keyword or value must be used
stylelint
A mighty CSS linter that helps you avoid errors and enforce conventions.
npm install stylelint-custom-processor-loader
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
24 Stars
97 Commits
3 Forks
1 Watching
197 Branches
9 Contributors
Updated on 28 Jan 2023
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-31%
649
Compared to previous day
Last week
7.3%
4,163
Compared to previous week
Last month
5.1%
16,819
Compared to previous month
Last year
-77.5%
230,863
Compared to previous year
1
22
If you would like to maintain this feel free to reach out, but I'm archiving this for now as I'm not planning on maintaining it any further
A Webpack loader for stylelint used with custom processors
I wrote this Webpack loader when I first encountered Styled Components and wanted to integrate my Styled Components Stylelint linting (using the stylelint-processor-styled-components
processor) into my Webpack setup so I could have it show up in my Hot Reloading (as shown in the gif above) etc. The loader I found was stylelint-loader
though, and it had been deprecated and was referring to postcss-loader
and another loader that both didn't work for javascript, but only css files, and therefore not Styled Components. Actually the deprecated loader itself supports custom processors for Stylelint, but due to it no longer being under development, and also the fact that when I looked at the code I disagreed with quite a few of the choices, I decided to write my own webpack loader for this use case.
If you just want to use normal Stylelint I would definitely suggest using the postcss-loader
instead of this package. This package was mainly written for Styled Components but also aims to support any other custom processor of Stylelint such as stylelint-processor-markdown
and stylelint-processor-html
.
First install the loader and stylelint with your favourite package manager
yarn add -D stylelint-custom-processor-loader
Or with npm
npm i -D stylelint-custom-processor-loader
This package will not work without stylelint as it is a peer dependency in the package.json
and it is just a development tool to connect webpack and stylelint together.
Stylelint config can be added as a file in the default way as seen in Stylelint's documentation. The recommended way is creating a .stylelintrc
file in the root of your project, but if you want to use a custom file path you can also use the configPath option.
This package currently only aims at supporting Webpack 2+.
If you are for example using Styled Components you could simply add the following to your webpack config:
1module: { 2 rules: [ 3 { 4 test: /\.jsx?$/, 5 loader: 'stylelint-custom-processor-loader', 6 exclude: /node_modules/, 7 }, 8 ], 9}
And you should now have linting your Styled Components css integrated with Webpack!
NOTE: You would of course have to install and use
stylelint-processor-styled-components
as your custom processor in this example.
1module: { 2 rules: [ 3 { 4 test: /\.jsx?$/, 5 use: [ 6 'babel-loader', 7 'stylelint-custom-processor-loader', 8 ], 9 exclude: /node_modules/, 10 }, 11 ], 12}
NOTE: As always with Webpack loaders order can be very important, in general this loader should always be the first one loaded (which means the last one in the list) as seen above in the babel-loader example.
Give the path to a non-default named Stylelint config. The recommended way to specify it is in your Webpack config as follows:
1module: { 2 rules: [ 3 { 4 test: /\.jsx?$/, 5 use: [ 6 'babel-loader', 7 { 8 loader: 'stylelint-custom-processor-loader', 9 options: { 10 configPath: './path/to/stylelint/config', 11 }, 12 }, 13 ], 14 exclude: /node_modules/, 15 }, 16 ], 17}
false
)Always return warnings if this option is set to true
. If you're using hot module replacement, you may wish to enable this in development, or else updates will be skipped when there's a stylelint error.
Licensed under the MIT License, Copyright © 2017 Emil Goldsmith Olesen. See LICENSE for more information.
Thank you to MoOx for his eslint-loader
which was often referenced and used for inspiration during development of this project.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 5/19 approved changesets -- score normalized to 2
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
88 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More