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

Styleint Treats Multiple Components As Same Component #215

Open
Undistraction opened this issue Sep 10, 2018 · 3 comments
Open

Styleint Treats Multiple Components As Same Component #215

Undistraction opened this issue Sep 10, 2018 · 3 comments

Comments

@Undistraction
Copy link

Undistraction commented Sep 10, 2018

The following two components defined in the same file results in an error:

Components

const Layout = styled(HSpreadLayout)`
  > *:first-child {
    padding: 1.25rem;
  }
`

const NavList = styled(HList)`
  > * + * {
    border-left: 1px solid #bbb;
  }
`

Error

Expected selector ".selector6 > * + *" to come before selector ".selector5 > *:first-child" no-descending-specificity

Expected
Each component should be evaluated separately.

  • Node 8.11.3
  • "stylelint": "^9.5.0",
  • "stylelint-config-recommended": "^2.1.0",
  • "stylelint-config-styled-components": "^0.1.1",
  • "stylelint-processor-styled-components": "^1.3.2"
@chinesedfan
Copy link
Member

@Undistraction You're right. But I am afraid that stylelint doesn't give a processor the possibility to do that. Because a processor can only extract codes from user's input file and ask stylelint to lint together, which is a string, instead of array.

@Undistraction
Copy link
Author

@chinesedfan That seems like a pretty big issue to me because it forces you to define your components in an order just to satisfy the processor. It could also potentially lead to cases that cannot be satisfied by changing component order.

@sergio-toro
Copy link

We have the same issue, turning off no-descending-specificity linting rule until this gets fixed.
Big issue :(

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

3 participants