styled-components/stylelint-processor-styled-components

block-no-empty false-positive

jsardev opened this issue · 2 comments

Environment

## System:
 - OS: Linux 4.15 Ubuntu 18.04.2 LTS (Bionic Beaver)
 - CPU: (8) x64 Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
 - Memory: 4.68 GB / 15.61 GB
 - Container: Yes
 - Shell: 5.4.2 - /usr/bin/zsh
## Binaries:
 - Node: 10.15.1 - ~/.nvm/versions/node/v10.15.1/bin/node
 - Yarn: 1.13.0 - /usr/bin/yarn
 - npm: 6.4.1 - ~/.nvm/versions/node/v10.15.1/bin/npm
## npmPackages:
 - styled-components: ^4.1.3 => 4.1.3 
 - stylelint: 9.10.1 => 9.10.1 
 - stylelint-config-recommended: 2.1.0 => 2.1.0 
 - stylelint-config-styled-components: 0.1.1 => 0.1.1 
 - stylelint-processor-styled-components: 1.5.2 => 1.5.2
{
  "processors": ["stylelint-processor-styled-components"],
  "extends": [
    "stylelint-config-recommended",
    "stylelint-config-styled-components"
  ]
}

Reproduction

const Button = styled.button`
    padding: 16px;
    background-color: ${props => props.bg || 'blue'};
`

const DangerButton = styled(Button)``; // error: block-no-empty

DangerButton.defaultProps = {
    bg: 'red'
}

Expected Behavior

DangerButton actually has styles, but inherited from Button. That's why I won't expect a block-no-empty error here.

Actual Behavior

Error: block-no-empty.

@sarneeh Can you try #250 locally? If it works well without regressions, I will publish a new release.