Skip to content
This repository was archived by the owner on May 14, 2021. It is now read-only.

Expected empty line between multiple components #9

Closed
geniusgordon opened this issue Nov 22, 2016 · 14 comments
Closed

Expected empty line between multiple components #9

geniusgordon opened this issue Nov 22, 2016 · 14 comments

Comments

@geniusgordon
Copy link
Contributor

I'm getting a rule-non-nested-empty-line-before error when I have multiple components in one file

I've got a file like this

import styled from 'styled-component';

const TextA = styled.span`
  color: blue;
`

const TextB = styled.span`
  color: red;
`

and got this error

7:1  ✖  Expected empty line before non-nested rule   rule-non-nested-empty-line-before

I've console.log the extractedCSS and it looks like this

.selector {
  color: blue;
}  /* <----- missing a newline here */
.selector {
  color: red;
}

I'm using:

@joggienl
Copy link

joggienl commented Dec 27, 2016

As a workaround it could help to add an additional rule to your .stylelintrc file:

"rules": {
    "rule-non-nested-empty-line-before": "never-multi-line"
  }

There are more options for this available. See here: http://stylelint.io/user-guide/rules/rule-non-nested-empty-line-before/

The default (which is enforced by using the stylelint-config-standard package) is as follows:

"rule-non-nested-empty-line-before": [ "always-multi-line", {
      ignore: ["after-comment"],
} ]

@ghost
Copy link

ghost commented Mar 6, 2017

@joggienl That doesn't fix it for me. Only way of getting rid of it for me is to turn it off completely:

{
  "processors": ["stylelint-processor-styled-components"],
  "extends": "stylelint-config-standard",
  "syntax": "scss",
  "rules": {
    "rule-empty-line-before": 0
  }
}

@chaucerbao
Copy link

Maybe rule-empty-line-before should be added to the list of ignored rules.

@ghost
Copy link

ghost commented Apr 27, 2017

@chaucerbao Actually the list of ignored rules should be removed completely. See this pr: #23. As I understand it, this lib modifies the Result passed to stylelint, which can lead to swallowed errors that still cause stylelint to exit with an error code: #22

A better approach would be to just list the rules that should be ignored for this lib in the readme, so people can add it to their config. Or just create a preconfigured ruleset that people can extend, if you want to make it easy.

@ghost
Copy link

ghost commented Apr 27, 2017

@mxstbr If you need help with this repo I'd be happy to. Let me know if I can do anything!

@rajkuldip
Copy link

rajkuldip commented May 9, 2017

Below doesn't seems working

"rules": {
    "rule-empty-line-before": 0
  }

It gives this error:

Invalid Option: Invalid option value "0" for rule "rule-empty-line-before"

@ismay Does it works for you? I am using

"stylelint": "^7.10.1",
"stylelint-config-standard": "^16.0.0",
"stylelint-processor-styled-components": "^0.1.0"

@ghost
Copy link

ghost commented May 9, 2017

@rajkuldip This is the way I'm using it: https://github.com/ismay/ismaywolff.nl/blob/develop/.stylelintrc I'm also on 7.10.1

@NameFILIP
Copy link

"rules": {
  "rule-empty-line-before": null
}

@rajkuldip
Copy link

@ismay - Thank you for your response.

@NameFILIP: Thanks, mate. This solution just works fine.

@ghost
Copy link

ghost commented May 22, 2017

@mxstbr Thanks for the add 👍 I'll try to help fix some issues this week 🎉 🎉

This was referenced Jun 14, 2017
@ghost ghost added the help welcome label Jun 29, 2017
@emilgoldsmith
Copy link
Member

@ismay since we merged in your config PR #49 this should be closeable right? :).

I can actually even see that you put in a closes #9 in the PR so I'll just close this now. Don't know why it didn't happen automatically.

@ghost
Copy link

ghost commented Aug 28, 2017

@emilgoldsmith Yeah weird, but yes, this should be fixed 👍

@emilgoldsmith
Copy link
Member

I think I actually realized it's probably because we don't merge into master, and I think maybe it only closes issues if you merge into master, but since we were merging into 1.0 it doesn't see it as "integrated" (which I guess is also correct :))

@ghost
Copy link

ghost commented Aug 28, 2017

Ah yeah of course

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants