
Security News
Open Source Maintainers Demand Ability to Block Copilot-Generated Issues and PRs
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
stylelint-no-px
Advanced tools
A stylelint custom rule to ensure rem instead of px.
If you are using rem
(instead of px
) as 1px solution or for other purposes, you should need a stylelint rule to enforce using rem. Thats it.
width: 10px; // error
border: 1px solid #eee; // ok
npm install stylelint-no-px --save-dev
Add it to your stylelint config
// .stylelintrc
{
"plugins": [
"stylelint-no-px"
],
"rules": {
// ...
"meowtec/no-px": [true, { "ignore": ["1px"] }],
// or just:
"meowtec/no-px": true,
// ...
}
}
ignore value check.
Valid value of Item: propertyName
| '1px'
| '${propertyName} 1px'
Ignore check for functions.
Specify a base size for converting px to rem. If this option is provided, the plugin will automatically convert pixel values to rem using the provided base size.
// all 1px is ok
"meowtec/no-px": [true, { "ignore": ["1px"] }],
@padding-base: 20px; // error
.foo {
border-top: 1px solid #ccc; // ok
padding: 10px; // error
height: 1px; // ok
padding: @padding-base * 2;
}
// - all `1px` or `font` is ok
// - rem(Npx) is ok
"meowtec/no-px": [true, { "ignore": ["1px", "font"], "ignoreFunctions": ["rem"] }],
.foo {
border-top: 1px solid #ccc; // ok
height: 1px; // ok
font-size: 24px; // ok
padding: 10px; // error
width: calc(100% - 10px); // error
font-size: rem(10px); // ok
}
// only `border + 1px` is ok
"meowtec/no-px": [true, { "ignore": ["border 1px"] }],
.foo {
border-top: 1px solid #ccc; // ok
height: 1px; // error
}
// only `border + 1px` is ok
"meowtec/no-px": [true, { "ignore": ["1px"], "remSize": 16 }],
.foo {
height: 16px; // error, auto converts to 1rem
}
FAQs
A stylelint custom rule to ensure using rem instead of px
The npm package stylelint-no-px receives a total of 5,059 weekly downloads. As such, stylelint-no-px popularity was classified as popular.
We found that stylelint-no-px demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
Research
Security News
Malicious Koishi plugin silently exfiltrates messages with hex strings to a hardcoded QQ account, exposing secrets in chatbots across platforms.
Research
Security News
Malicious PyPI checkers validate stolen emails against TikTok and Instagram APIs, enabling targeted account attacks and dark web credential sales.