Gathering detailed insights and metrics for stylelint-processor-styled-components
Gathering detailed insights and metrics for stylelint-processor-styled-components
Gathering detailed insights and metrics for stylelint-processor-styled-components
Gathering detailed insights and metrics for stylelint-processor-styled-components
stylelint-config-styled-components
A shareable stylelint config for stylelint-processor-styled-components
stylelint-custom-processor-loader
A Webpack loader for stylelint used with custom processors
postcss-styled-syntax
PostCSS syntax for template literals CSS-in-JS (e. g. styled-components).
jest-preset-kyt-styled
Jest preset for linting styles in CSS-in-JS projects
Lint your styled components with stylelint!
npm install stylelint-processor-styled-components
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
656 Stars
487 Commits
61 Forks
34 Watching
3 Branches
123 Contributors
Updated on 14 Jun 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-8.1%
42,018
Compared to previous day
Last week
-5.9%
212,612
Compared to previous week
Last month
1.5%
950,354
Compared to previous month
Last year
-24.5%
11,876,607
Compared to previous year
stylelint-processor-styled-components
Lint your styled components with stylelint!
You need:
stylelint
(duh)styled-components
stylelint-config-styled-components
config to disable stylelint rules that clash with styled-components
stylelint
config! (for example stylelint-config-recommended
)(npm install --save-dev \
stylelint \
stylelint-processor-styled-components \
stylelint-config-styled-components \
stylelint-config-recommended)
Now use those in your .stylelintrc
and run stylelint with your JavaScript files!
1{ 2 "processors": ["stylelint-processor-styled-components"], 3 "extends": [ 4 "stylelint-config-recommended", 5 "stylelint-config-styled-components" 6 ] 7}
NOTE: The processor works with Flow- and TypeScript-typed files too! (we'll assume TypeScript usage if your files end in
.ts
or.tsx
)
And it also has some options. Their default values are,
1{ 2 "processors": [["stylelint-processor-styled-components", { 3 "moduleName": "styled-components", 4 "importName": "default", 5 "strict": false, 6 "ignoreFiles": [], 7 "parserPlugins": [ 8 "jsx", 9 ["decorators", { "decoratorsBeforeExport": true }], 10 "classProperties", 11 "exportExtensions", 12 "functionBind", 13 "functionSent" 14 ] 15 }]] 16}
moduleName
, importName
and strict
, you can tell the processor what kinds of tagged template literals to lint.import styled, { css, keyframes } from 'styled-components';
// `importName` from `moduleName`, which means where `styled` comes from
styled(Component)``;
styled('div')``;
styled.div``;
// any other imports from `moduleName` (if `strict` is true, they will not be linted)
css``;
keyframes``;
// special extend calls, which have been deprecated in styled-components v4
Component.extend``;
ignoreFiles
is passed to micromatch as the second parameter, which means one or more glob patterns for matching.
parserPlugins
is used to make the processor's parser be able to parse new syntaxes. All available babel parser plugins and related options can be found in Babel's website.
Further documentation for this processor lives on the styled-components website!
Unexpected token
? Even thought the file didn't import styled-components
.You can custom babel plugins by option.parserPlugins
now. An API example is our test. But if someone can implement #231, that will be much better.
If your project includes yarn.lock
or package-lock.json
, an alternative cause can be that babel related dependencies, i.e. @babel/parser
and @babel/traverse
, are outdated, especially when linting files with new TypeScript syntaxes. You can upgrade them by removing their entries in the lockfile and reinstall dependencies.
The processor can not always parse interpolations with right things. But you can use interpolation-tagging to help it. If you have ideas to make it more intelligent, feel free to send a PR or share your solution by an new issue.
What's more, if set syntax: css-in-js
in stylelint@10, it can extract styles from styled-components
without this processor. Even though there are still lots of differences with this processor, we hope this processor's abilities can be migrated to stylelint totally in the future.
css
.You can set option.strict
. More examples are in #258.
Licensed under the MIT License, Copyright © 2017 Maximilian Stoiber. See LICENSE.md for more information!
Based on Mapbox' excellent stylelint-processor-markdown
, thanks to @davidtheclark!
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 3/6 approved changesets -- score normalized to 5
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
40 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
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