Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(stylelint-config): allow zero units for css props #817

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/stylelint-config/__tests__/valid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ $media-query-width: 300px;

:root {
--brand-red: rgb(112, 94, 92);
--zero-unit: 0px;
}

#id-selector {
Expand Down
12 changes: 12 additions & 0 deletions packages/stylelint-config/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ module.exports = {
},
],

// Allows zero length units when defined by custom CSS properties. There are
// cases where we often use the "calc" function to perform operations on CSS
// properties, e.g. `calc(100% - var(--sponge) - var(--bob))`. Those always
// require units to work properly, including 0 values.
// https://stylelint.io/user-guide/rules/length-zero-no-unit
'length-zero-no-unit': [
true,
{
ignore: ['custom-properties'],
},
],

// ReadMe breaks this rule in many places.
'max-nesting-depth': null,

Expand Down