
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@aleph/stylelint-config
Advanced tools
Aleph's StyleLint configuration for CSS, SCSS, and styled-components
Aleph's StyleLint configuration for CSS, SCSS, and CSS modules.
npm install @aleph/stylelint-config --save-dev
Create or update your stylelint.config.js
:
module.exports = {
extends: ['@aleph/stylelint-config']
};
Or using the stylelint.config.json
format:
{
"extends": ["@aleph/stylelint-config"]
}
Add to your package.json
:
{
"scripts": {
"lint:css": "stylelint '**/*.{css,scss}'",
"lint:css:fix": "stylelint '**/*.{css,scss}' --fix"
}
}
This configuration extends:
This config follows a minimal override philosophy - we extend proven standard configs and only add rules where Aleph has specific needs. Most formatting and basic rules come from the standard configs.
!important
declarations: Stricter than default - forces proper CSS architectureglobal
and local
pseudo-classesLogical property order enforced:
This configuration works with:
.css
).scss
).sass
)If your project needs specific rules, extend our base config:
// stylelint.config.js
module.exports = {
extends: ['@aleph/stylelint-config'],
rules: {
// Project-specific overrides
'max-line-length': 120, // Longer lines for this project
'selector-max-id': 1, // Allow one ID selector
},
overrides: [
{
files: ['**/*.scss'],
rules: {
// SCSS-specific rules
'scss/dollar-variable-pattern': null, // Disable variable naming pattern
},
},
],
};
Only override rules when you have a specific need:
Install the StyleLint extension and add to .vscode/settings.json
:
{
"stylelint.enable": true,
"editor.codeActionsOnSave": {
"source.fixAll.stylelint": true
},
"css.validate": false,
"scss.validate": false
}
Add linting to your CI pipeline:
# Example GitHub Actions
- name: Lint CSS
run: |
npm ci
npm run lint:css
// ✅ Good: Standard kebab-case (enforced by stylelint-config-standard-scss)
$primary-color: #3498db;
$font-size-large: 1.25rem;
$border-radius-small: 0.25rem;
// ⚠️ Allowed: Flexible naming (Aleph override allows other patterns)
$primaryColor: #3498db; // camelCase allowed
$font_size_large: 1.25rem; // snake_case allowed
$PRIMARY_COLOR: #3498db; // UPPER_CASE allowed
// ✅ Good: Logical property order
.component {
// Custom properties first
--local-color: red;
// Box model
display: flex;
// Positioning
position: relative;
top: 0;
// Flexbox
flex-direction: column;
align-items: center;
// Dimensions
width: 100%;
height: auto;
// Spacing
margin: 1rem;
padding: 0.5rem;
// Borders
border: 1px solid #ccc;
border-radius: 0.25rem;
// Background
background-color: white;
// Typography
color: #333;
font-size: 1rem;
// Other
opacity: 1;
cursor: pointer;
}
// ✅ Good: Simple, specific selectors
.component {
&__element {
// Element styles
}
&--modifier {
// Modifier styles
}
&:hover {
// Pseudo-class styles
}
}
// ❌ Avoid: Overly complex selectors
.page .sidebar .widget .component .element.active {
// Too specific and hard to maintain
}
Error | Cause | Solution |
---|---|---|
Unexpected unknown at-rule | Using SCSS syntax in CSS file | Use .scss extension or configure parser |
Expected single space before "{" | Missing space before opening brace | Add space: .class { |
Unexpected vendor-prefix | Using vendor prefixes | Remove prefixes, use autoprefixer |
Expected newline after "," | Selector list formatting | Put each selector on new line |
For large projects, consider:
.stylelintignore
to exclude build directories--cache
flag for faster subsequent runsFor detailed information about our code style standards and the rationale behind these rules, visit our documentation:
MIT © Aleph Inc.
FAQs
Aleph's StyleLint configuration for CSS, SCSS, and styled-components
The npm package @aleph/stylelint-config receives a total of 0 weekly downloads. As such, @aleph/stylelint-config popularity was classified as not popular.
We found that @aleph/stylelint-config demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.