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

Missing semicolon not detected #204

Closed
rylek90 opened this issue Jul 19, 2018 · 8 comments
Closed

Missing semicolon not detected #204

rylek90 opened this issue Jul 19, 2018 · 8 comments
Labels

Comments

@rylek90
Copy link

rylek90 commented Jul 19, 2018

I use stylelint-processor-styled-components with Emotion. With current update Emotion doesn't automatically add semicolons at the end of expression. However missing semicolons are not detected by plugin

My stylelint config:

module.exports = {
  processors: ['stylelint-processor-styled-components'],
  extends: [
    'stylelint-config-recommended',
    'stylelint-config-styled-components'
  ],
  rules: {
    'no-descending-specificity': null
    'property-no-vendor-prefix': null,
    'value-no-vendor-prefix': null,
    'no-invalid-double-slash-comments': null,
    'comment-empty-line-before': null,
    'declaration-block-trailing-semicolon': 'always',
    'no-duplicate-selectors': null,
    'property-no-unknown': null,
    'color-named': 'never',
    'color-no-hex': true,
    'function-blacklist': ['rgb', 'rgba']
  }
}

Linted code (with missing semicolons):

import styled from 'react-emotion'

export const MyFancyButton = styled(Button)`
 padding: none
 color: inherit
 border: none
`

I use stylelint --syntax scss

@chinesedfan
Copy link
Member

Hi @rylek90, which stylelint rule do you think will be violated if semicolons are missing?

@rylek90
Copy link
Author

rylek90 commented Jul 21, 2018

Hmm, that would be a simple CssSyntaxError I believe 🤔

@chinesedfan
Copy link
Member

Yes, I tested with a simple code snippet and got CssSyntaxError. Can you give detailed versions of your stylelint and related packages? Or the link of the problem project directly?

@rylek90
Copy link
Author

rylek90 commented Jul 23, 2018

@chinesedfan versions are following:

"stylelint": "9.3.0",
"stylelint-config-standard": "18.2.0",
"stylelint-config-styled-components": "0.1.1",
"stylelint-processor-styled-components": "1.3.1"

@chinesedfan
Copy link
Member

@rylek90 I still got CssSyntaxError. What is your expectation?

By the way, you set stylelint-config-recommended in stylelint configuration, but why is stylelint-config-standard used?

@rylek90
Copy link
Author

rylek90 commented Jul 23, 2018

@chinesedfan oops, my mistake, I use stylelint-config-recommended 2.1.0
Yeah, I expect CssSyntaxError which I don't get, shouldn't Stylelint produce it too?

@rylek90
Copy link
Author

rylek90 commented Jul 23, 2018

@chinesedfan my apologise, I've spot the error finally. It seems like it has problems with js decorators. Here is a minimal repo to reproduce https://github.com/rylek90/StyledComponentsBug

@chinesedfan
Copy link
Member

@rylek90 I see. It is due to the babylon error isn't be thrown by our processor. #163 has tried to handle it but not finished yet.

SyntaxError: Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead (8:0)
    at _class.raise (/Users/zhong/Desktop/test/linttest/node_modules/babylon/lib/index.js:776:15)
    at _class.parseDecorators (/Users/zhong/Desktop/test/linttest/node_modules/babylon/lib/index.js:4123:14)
    at _class.parseStatement (/Users/zhong/Desktop/test/linttest/node_modules/babylon/lib/index.js:3959:12)
    at _class.parseStatement (/Users/zhong/Desktop/test/linttest/node_modules/babylon/lib/index.js:6676:53)
    at _class.parseBlockOrModuleBlockBody (/Users/zhong/Desktop/test/linttest/node_modules/babylon/lib/index.js:4513:23)
    at _class.parseBlockBody (/Users/zhong/Desktop/test/linttest/node_modules/babylon/lib/index.js:4500:10)
    at _class.parseTopLevel (/Users/zhong/Desktop/test/linttest/node_modules/babylon/lib/index.js:3938:10)
    at _class.parse (/Users/zhong/Desktop/test/linttest/node_modules/babylon/lib/index.js:5304:17)
    at Object.parse (/Users/zhong/Desktop/test/linttest/node_modules/babylon/lib/index.js:10095:38)
    at /Users/zhong/Desktop/test/linttest/node_modules/stylelint-processor-styled-components/lib/parsers/babylon-parser.js:7:20

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

No branches or pull requests

2 participants