Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
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: [
["babel-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
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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.