question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with `at-rule-semicolon-space-before:never` when no semicolon in use

See original GitHub issue

What steps are needed to reproduce the bug?

npm install postcss postcss-scss stylelint --save-dev
stylelint test.scss
// test.scss
.padding-bottom-15 { padding-bottom: 15px }

.element { @extend .padding-bottom-15 }

What Stylelint configuration is needed to reproduce the bug?

module.exports = {
    customSyntax: 'postcss-scss',
    rules: {
        'at-rule-semicolon-space-before': 'never',
    },
};

How did you run Stylelint?

CLI with stylelint test.scss

Which version of Stylelint are you using?

14.12.1

What did you expect to happen?

There should be no output from Stylelint as no semicolons are in use.

What actually happened?

The following problem was reported:

test.scss
 3:39  ✖  Unexpected whitespace before ";"  at-rule-semicolon-space-before

I have found that I can stop the error by adding a semicolon but this shouldn’t be necessary.

// test.scss
.padding-bottom-15 { padding-bottom: 15px }

-.element { @extend .padding-bottom-15 }
+.element { @extend .padding-bottom-15; }

Does the bug relate to non-standard syntax?

Yes, it could be related to the use of @extend (SCSS)

Proposal to fix the bug

Unfamiliar with the code but happy to take a look if nobody else can spot what the issue might be

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
CAYdenbergcommented, Sep 27, 2022

I don’t remember writing this code, but it seems pretty clear this is a bug, no? (even if this rule isn’t something Stylelint should still have, this is clearly wrong). I can take a look later today.

0reactions
jeddy3commented, Sep 27, 2022

No problem - are there example instructions/config of using Prettier alongside Stylelint?

Yep, in the getting started guide. There’s a section for setting up Stylelint for SCSS using the community SCSS standard config and the Prettier SCSS one.

(Going forward, the Prettier configs won’t be needed as we’ll remove the stylistic rules from the standard configs. Although, this could be some while down the line.)

Can Prettier omit certain output?

It’s an opinionated pretty printer, e.g. it always uses multi-line blocks and semicolons.

I don’t remember writing this code, but it seems pretty clear this is a bug, no?

Yep, it’s a bug but we’ve frozen the stylistic rules as we’re going to remove them in the next major release. We’re avoiding investing time in fixing, reviewing and releasing changes to them.

@CAYdenberg Thanks for offering to look into it. We understand that some people would prefer to continue using Stylelint for stylistic rules, and we’re hoping they will create a 3rd party plugin pack to offer this (where bugs like this one can be fixed). The built-in rules will then only be for avoiding errors and enforcing non-stylistic conventions, i.e. a linter rather than a formatter as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Semicolon | Effective Writing Practices Tutorial
Use a semicolon to join two related independent clauses in place of a comma and a coordinating conjunction.
Read more >
Using Semicolons - UW-Madison Writing Center
A semicolon is most commonly used to link (in a single sentence) two independent clauses that are closely related in thought. When a...
Read more >
The Colon and the Semicolon - University of Sussex
There is one special circumstance in which a semicolon may be used to separate sequences which are not complete sentences. This occurs when...
Read more >
Punctuation: Semicolons - Academic Guides - Walden University
Use a semicolon when separating two independent clauses that are not joined by a conjunction. Example: Jones (2014) argued that intelligence was fixed; ......
Read more >
Using Semicolons - IUP
A semicolon works here because the sentences are closely related in meaning, and they are not joined by a coordinating conjunction. Rule. Use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found