
Security News
GitHub Actions Supply Chain Attack Puts Thousands of Projects at Risk
A compromised GitHub Action exposed secrets in CI/CD logs, putting thousands of projects at risk and forcing developers to urgently secure their workflows.
eltexsoft-stylelint-config
Advanced tools
The standard shareable config for stylelint.
Extends stylelint-config-standard
.
Turns on additional rules to enforce the common stylistic conventions found within a handful of CSS styleguides, including: The Idiomatic CSS Principles, Google's CSS Style Guide, Airbnb's Styleguide, and @mdo's Code Guide.
It favours flexibility over strictness for things like multi-line lists and single-line rulesets, and tries to avoid potentially divisive rules.
Use it as is or as a foundation for your own config.
To see the rules that this config uses, please read the config itself.
@import url(x.css);
@import url(y.css);
/**
* Multi-line comment
*/
.selector-1,
.selector-2,
.selector-3[type="text"] {
background: linear-gradient(#fff, rgba(0, 0, 0, 0.8));
box-sizing: border-box;
display: block;
color: #333;
}
.selector-a,
.selector-b:not(:first-child) {
padding: 10px !important;
top: calc(calc(1em * 2) / 3);
}
.selector-x { width: 10%; }
.selector-y { width: 20%; }
.selector-z { width: 30%; }
/* Single-line comment */
@media (min-width >= 60em) {
.selector {
/* Flush to parent comment */
transform: translate(1, 1) scale(3);
}
}
@media (orientation: portrait), projection and (color) {
.selector-i + .selector-ii {
background: color(rgb(0, 0, 0) lightness(50%));
font-family: helvetica, "arial black", sans-serif;
}
}
/* Flush single line comment */
@media
screen and (min-resolution: 192dpi),
screen and (min-resolution: 2dppx) {
.selector {
background-image:
repeating-linear-gradient(
-45deg,
transparent,
#fff 25px,
rgba(255, 255, 255, 1) 50px
);
margin: 10px;
margin-bottom: 5px;
box-shadow:
0 1px 1px #000,
0 1px 0 #fff,
2px 2px 1px 1px #ccc inset;
height: 10rem;
}
/* Flush nested single line comment */
.selector::after {
content: '→';
background-image: url(x.svg);
}
}
Note: the config is tested against this example, as such the example contains plenty of CSS syntax, formatting and features.
npm install eltexsoft-stylelint-config --save-dev
If you've installed eltexsoft-stylelint-config
locally within your project, just set your stylelint
config to:
{
"extends": "eltexsoft-stylelint-config"
}
If you've globally installed eltexsoft-stylelint-config
using the -g
flag, then you'll need to use the absolute path to eltexsoft-stylelint-config
in your config e.g.
{
"extends": "/absolute/path/to/eltexsoft-stylelint-config"
}
Since stylelint 9.7.0, you can simply use the globally installed configuration name instead of the absolute path:
{
"extends": "eltexsoft-stylelint-config"
}
Simply add a "rules"
key to your config, then add your overrides and additions there.
For example, to change the at-rule-no-unknown
rule to use its ignoreAtRules
option, change the indentation
to tabs, turn off the number-leading-zero
rule,and add the unit-whitelist
rule:
{
"extends": "eltexsoft-stylelint-config",
"rules": {
"at-rule-no-unknown": [ true, {
"ignoreAtRules": [
"extends",
"ignores"
]
}],
"indentation": "tab",
"number-leading-zero": null,
"unit-whitelist": ["em", "rem", "s"]
}
}
eltexsoft-stylelint-config
is a great foundation for your own config. You can extend it to create a tailored and much stricter config:
autoprefixer
you'll want to disallow vendor prefixes using:
at-rule-blacklist
at-rule-whitelist
color-named
color-no-hex
comment-word-blacklist
declaration-no-important
declaration-property-unit-blacklist
declaration-property-unit-whitelist
declaration-property-value-blacklist
declaration-property-value-whitelist
function-blacklist
function-url-scheme-blacklist
function-url-scheme-whitelist
function-whitelist
media-feature-name-blacklist
media-feature-name-whitelist
property-blacklist
property-whitelist
selector-attribute-operator-blacklist
selector-attribute-operator-whitelist
selector-combinator-blacklist
selector-combinator-whitelist
selector-max-class
selector-max-attribute
selector-max-combinators
selector-max-id
selector-max-pseudo-class
selector-no-qualifying-type
selector-max-type
selector-max-universal
selector-pseudo-class-blacklist
selector-pseudo-class-whitelist
selector-pseudo-element-blacklist
selector-pseudo-element-whitelist
unit-blacklist
unit-whitelist
The config is broadly compatible with SugarSS syntax. You will need to turn off the rules that check braces and semicolons, as so:
{
"extends": "eltexsoft-stylelint-config",
"rules": {
"block-closing-brace-empty-line-before": null,
"block-closing-brace-newline-after": null,
"block-closing-brace-newline-before": null,
"block-closing-brace-space-before": null,
"block-opening-brace-newline-after": null,
"block-opening-brace-space-after": null,
"block-opening-brace-space-before": null,
"declaration-block-semicolon-newline-after": null,
"declaration-block-semicolon-space-after": null,
"declaration-block-semicolon-space-before": null,
"declaration-block-trailing-semicolon": null
}
}
FAQs
Config for stylelint CSS
The npm package eltexsoft-stylelint-config receives a total of 2 weekly downloads. As such, eltexsoft-stylelint-config popularity was classified as not popular.
We found that eltexsoft-stylelint-config demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
A compromised GitHub Action exposed secrets in CI/CD logs, putting thousands of projects at risk and forcing developers to urgently secure their workflows.
Research
Security News
A malicious Maven package typosquatting a popular library is secretly stealing OAuth credentials on the 15th of each month, putting Java developers at risk.
Security News
Socket and Seal Security collaborate to fix a critical npm overrides bug, resolving a three-year security issue in the JavaScript ecosystem's most popular package manager.