Skip to content

Commit

Permalink
Update stylelint disable comments for Stylelint 13.7.0
Browse files Browse the repository at this point in the history
In stylelint 13.7.0 they now treat multiline SCSS comments as a single
comment [1] which means the disabling techniques we previously used no
longer work. By adopting this new syntax the reasons are also understood
to be associated with the rule and can allow switching on the
reportDescriptionlessDisables option [2] which can require the disabling
of rules to always be documented.

For example

```
// comment describing disabling
// stylelint-disable indentation
```

is treated as a comment of:
"comment describing disabling stylelint-disable indentation"

Instead this can be resolved with the following technique:

```
// stylelint-disable indentation -- comment describing
// disabling

```

This therefore updates all of the stylelint disabling of rules to match
this pattern.

[1]: stylelint/stylelint#4886
  • Loading branch information
kevindew committed Sep 2, 2020
1 parent 4e71395 commit 063d80e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/govuk/helpers/_device-pixels.scss
Expand Up @@ -28,8 +28,8 @@
/// @access public

@mixin govuk-device-pixel-ratio($ratio: 2) {
// stylelint and sass-lint have a disagreement over indentation in this file
// stylelint-disable indentation
// stylelint-disable indentation -- stylelint and sass-lint have a
// disagreement over indentation in this file
@media only screen and (-webkit-min-device-pixel-ratio: $ratio),
only screen and (-o-min-device-pixel-ratio: #{($ratio * 10)} / 10),
only screen and (min-resolution: #{($ratio * 96)}dpi),
Expand Down
1 change: 1 addition & 0 deletions src/govuk/helpers/_font-faces.scss
Expand Up @@ -4,6 +4,7 @@

// Disables linting for this file only
// sass-lint:disable no-css-comments, no-duplicate-properties, property-sort-order, indentation

// stylelint-disable scss/comment-no-loud, order/properties-order

@import "../tools/exports";
Expand Down
4 changes: 2 additions & 2 deletions src/govuk/helpers/_spacing.scss
Expand Up @@ -2,8 +2,8 @@
/// @group helpers/spacing
////

// stylelint and sass-lint have a disagreement over indentation in this file
// stylelint-disable indentation
// stylelint-disable indentation -- stylelint and sass-lint have a
// disagreement over indentation in this file

/// Single point spacing
///
Expand Down
4 changes: 2 additions & 2 deletions src/govuk/settings/_colours-palette.scss
@@ -1,7 +1,7 @@
@import "compatibility";

// allow empty lines in lists in this file to allow grouping
// stylelint-disable value-list-max-empty-lines
// stylelint-disable value-list-max-empty-lines -- allow empty lines in lists
// in this file to allow grouping

////
/// @group settings/colours
Expand Down

0 comments on commit 063d80e

Please sign in to comment.