Skip to content

Commit

Permalink
build(stylelint): improve empty line rules (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelodelain authored Jan 8, 2025
1 parent 7525cd4 commit 4df8d5e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions assets/scss/functions/_breakpoint.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
@function breakpoint($key, $strip-unit: false) {
@if meta.type-of($breakpoints) != map {
@warn "$breakpoints is not defined";

@return null;
}

Expand All @@ -23,5 +24,6 @@
}

@warn "Unkown '#{$key}' in $breakpoints.";

@return null;
}
1 change: 1 addition & 0 deletions assets/scss/functions/_color.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
}

@warn "Unkown '#{$key}' in $colors.";

@return null;
}
4 changes: 4 additions & 0 deletions assets/scss/functions/_decimal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@
// $number must be a number
@if meta.type-of($number) != number {
@warn '#{ $number } is not a number.';

@return $number;
}

// $digits must be a unitless number
@if meta.type-of($digits) != number {
@warn '#{ $digits } is not a number.';

@return $number;
} @else if not math.is-unitless($digits) {
@warn '#{ $digits } has a unit.';

@return $number;
}

Expand All @@ -47,6 +50,7 @@
@return math.div(math.floor($number * $n), $n);
} @else {
@warn '#{ $mode } is undefined keyword.';

@return $number;
}
}
Expand Down
2 changes: 1 addition & 1 deletion assets/scss/functions/_ease.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
}

@warn "Unkown '#{$key}' in $ease-curves.";
@return null;

@return null;
}
8 changes: 8 additions & 0 deletions stylelint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ export default {
'scss/comment-no-empty': null,
'color-function-notation': null, // do not change rgba() to rgb()
'no-duplicate-selectors': null, // The & selector is considering as duplicate. See https://github.com/stylelint/stylelint/issues/7893
'at-rule-empty-line-before': [
'always',
{
except: ['blockless-after-same-name-blockless', 'first-nested'],
ignore: ['after-comment', 'blockless-after-same-name-blockless'],
ignoreAtRules: ['else'],
},
],
},
defaultSeverity: 'warning',
ignoreFiles: ['./assets/scss/vendors/_tarteaucitron.scss', './assets/scss/vendors/_orejime.scss', './dist/**/*.css'],
Expand Down

0 comments on commit 4df8d5e

Please sign in to comment.