Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
babel-plugin-transform-react-styled-components-qa
Advanced tools
Add data-qa property to styled-components via .attrs using the component name
This plugin adds data-qa
props to styled-component using .attrs
.
This plugin can be used with babel-plugin-transform-react-qa-classes to provide support for both styled-components and React components.
In
const Component = styled.p`
color: red;
`
Out
const Component = styled.p.attrs({
"data-qa": "Component"
})`
color: red;
`
In
const tagName = 'h1'
const Component = styled[tagName]`
background: 'pink';
`
Out
const tagName = 'h1'
const Component = styled[tagName].attrs({
"data-qa": "Component"
})`
background: 'pink';
`
data-qa
is append after other attributes defined by usersIn
const PasswordInput = styled.input.attrs({
type: 'password'
})`
font-size: 14px;
line-height: 2em;
`
Out
const PasswordInput = styled.input.attrs({
type: 'password',
"data-qa": "PasswordInput"
})`
font-size: 14px;
line-height: 2em;
`
This plugin is intended to be use in pre-production environment.
Using this plugin with SSR could result in larger payload due to the extra attribute.
{
"env": {
"dev": {
plugins: [
["transform-react-styled-components-qa", {
"attribute": "data-qa",
"format": "kebab"
}]
]
}
}
}
The attribute name to be used instead of data-qa
.
Support values: kebab
, camel
, snake
, pascal
Default value: kebab
FAQs
Add data-qa property to styled-components via .attrs using the component name
We found that babel-plugin-transform-react-styled-components-qa 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
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.