Gathering detailed insights and metrics for eslint-plugin-postcss-modules
Gathering detailed insights and metrics for eslint-plugin-postcss-modules
Gathering detailed insights and metrics for eslint-plugin-postcss-modules
Gathering detailed insights and metrics for eslint-plugin-postcss-modules
@taktikorg/unde-animi-omnis
<p align="center"> <a href="https://www.npmjs.com/package/@taktikorg/unde-animi-omnis"><img src="https://img.shields.io/npm/v/@taktikorg/unde-animi-omnis"></a> <a href=""><img src="https://img.shields.io/github/actions/workflow/status/RemiMyrset/@taktikor
@teamteanpm2024/pariatur-fugit-atque
<img align="right" width="135" height="95" src="http://postcss.github.io/postcss/logo-leftp.png" title="Philosopher’s stone, logo of PostCSS">
@diotoborg/ad-tenetur-eveniet
* Convert a tilde path to an absolute path: `~/dev` → `/Users/john/dev` * Inspired by [untilify](https://github.com/sindresorhus/untildify) by [Sindre Sorhus](https://github.com/sindresorhus) * Since untildify uses ES6 syntax, I created this package to fo
@teamteanpm2024/vitae-suscipit-quidem
<h1 align="center">typescript-eslint</h1>
npm install eslint-plugin-postcss-modules
Typescript
Module System
64.4
Supply Chain
93
Quality
73.4
Maintenance
100
Vulnerability
98.9
License
TypeScript (96.5%)
JavaScript (2.81%)
CSS (0.69%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
1,271,497
Last Day
322
Last Week
25,705
Last Month
84,207
Last Year
411,247
MIT License
21 Stars
22 Commits
7 Forks
2 Watchers
15 Branches
3 Contributors
Updated on Feb 14, 2024
Latest Version
2.0.0
Package Id
eslint-plugin-postcss-modules@2.0.0
Unpacked Size
38.18 kB
Size
10.08 kB
File Count
34
Cumulative downloads
Total Downloads
Last Day
34.7%
322
Compared to previous day
Last Week
69.2%
25,705
Compared to previous week
Last Month
167.1%
84,207
Compared to previous month
Last Year
53.6%
411,247
Compared to previous year
10
1
27
Like eslint-plugin-css-modules, this plugin helps you lint your css modules. It adds a new eslint rule that detects if you are trying to use a class that is not exported by your css module.
The major difference between this plugin and the aforementioned plugin is that this plugin uses postcss to parse the css files and determine what classes are exported. There are a couple of benefits to this:
The downside is that, while postcss is very battle-tested and fast for building css, it may be slower than eslint-plugin-css-modules for linting purposes. I don't have benchmarks, but welcome them.
1yarn add -D eslint-plugin-postcss-modules 2npm install -D eslint-plugin-postcss-modules
In your eslint config:
1{ 2 "extends": [ 3 "plugin:postcss-modules/recommended" 4 ], 5}
The recommended configuration will set no-undef-class
to errors and
no-unused-class
to warnings. The recommended configuration is equivalent to:
1{ 2 "plugins": ["postcss-modules"], 3 "rules": { 4 "postcss-modules/no-undef-class": "error", 5 "postcss-modules/no-unused-class": "warn" 6 } 7}
There are a couple settings you can tweak in your eslint config. Below are examples of the options and their default values:
1{ 2 "settings": { 3 "postcss-modules": { 4 "postcssConfigDir": "cwd", 5 "baseDir": "cwd", 6 "camelCase": false, 7 "defaultScope": "local", 8 "include": "**/*.css", 9 "exclude": "**/node_modules/**/*" 10 } 11 } 12}
postcssConfigDir (default: cwd)
postcssConfigDir sets the starting point to search for the postcss config file, as determined by postcss-load-config. Searching will start with this directory and work its way up recursively until it finds a config file or hits your home directory. See cosmiconfig for more info.
I recommend that you create a pared down version of your postcss config that only includes plugins that could affect the structure of the file and the class names that might be exported in order to reduce the amount of time linting takes. For example, postcss-preset-env is really a collection of plugins under the hood. The only plugins that affect the structure and classes that would be exported are probably postcss-custom-selectors and postcss-nesting.
baseDir (default: cwd)
baseDir is used to resolve imports to your css files. If the import is relative (ie, starts with
./
), the path of the current file will be used to resolve the import. However, if the import is not relative, this baseDir will be used to resolve the path.
camelCase (default: false
)
The camelCase option should match the camelCase option or localsConvention option that you have set for css-loader, depending on which version you are using. Here's a description of the options and what they do:
option | description |
---|---|
false or "asIs" | Do not camelCase exported classes |
true or "camelCase" | Export both the original class name and the camelCased version |
"camelCaseOnly" or "only" | Export only the camelCased class names |
"dashes" | Convert dashed-names to camelCase and export both |
"dashesOnly" | Convert dashed-names to camelCase and only export the camelCased version |
defaultScope (default: "local"
)
The defaultScope option determines scope (global or local) of any css classes which are not explicitly declared as being global or local using
:global
or:local
. The default is"local"
.
include (default: "**/*.css"
)
An anymatch matcher to determine what files should be parsed for css-module exports. Any file which matches include but does not match exclude will be parsed. Note that due to the way eslint combines settings, you cannot use a regex here.
exclude (default: "**/node_modules/**/*"
)
An anymatch matcher to determine what files should not be parsed for css-module exports. Any file which matches include but does not match exclude will be parsed. Note that due to the way eslint combines settings, you cannot use a regex here.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 2/20 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
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
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
34 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-02-10
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