
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
eslint-plugin-styled
Advanced tools
Plugin to check babel macro import for styled-components CSSProp.
A simple plugin to check if you did not forget to import babel macro when using
css
prop of styled-components
- or to remove such import when css
prop is
not used.
npm install -D eslint-plugin-styled
Add to your .eslintrc
{
"plugins": ["styled"],
"rules": {
"styled/require-macro": [2],
"styled/unused-macro": [2]
}
}
There are additional options available.
prop
defines name of the prop (checks are case-insensitive).
For styled-components
it is css
.
import
defines import path. Maybe you would want to use it with some other lib
or something. It is styled-components/macro
by default.
"rules": {
"styled/require-macro": [2,
{
"prop": "css",
"import": "styled-components/macro"
}
],
"styled/unused-macro": [2,
{
"prop": "css",
"import": "styled-components/macro"
}
]
}
There is no tests here, nor proper meta... Maybe I will add it later. Feel free to pull-request these.
This plugin seeks for import from required file - first import will be used. It
won't check for named imports or whatever - there is an assumption that macro
file is used only for macro import "styled-components/macro
.
I use this to use styled-components with vite and vite-plugin-babel-macros
FAQs
Plugin to check babel macro import for styled-components CSSProp.
We found that eslint-plugin-styled demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.