Skip to content

Make sure we don't explode on Vue and css-in-js solutions#22

Merged
BPScott merged 1 commit intomasterfrom
vue
May 12, 2019
Merged

Make sure we don't explode on Vue and css-in-js solutions#22
BPScott merged 1 commit intomasterfrom
vue

Conversation

@BPScott
Copy link
Member

@BPScott BPScott commented May 11, 2019

Stylelint 9.10.0 uses postcss-jsx to parse css-in-js solutions and postcss-html to parse vue/markdown/html files. These two together mean the embedded languages landscape is a lot cleaner than a few months ago in the days of 9.2.1.

However stylelint 9.9 to 9.10 changed how these embedded languages were passed into rules. In 9.9 the whole file content was available in root.source.input (i.e. a whole html or vue file, including all surrounding html tags tags). In 9.10 only the contents of style language fragments are available (i.e. only the content of each of the <style> tags gets passed to the rule).

This means that we can run stylelint with stylelint-prettier over these embedded language files, but it'll only prettify the style portions. If you're this interested in prettier then you probably want to run prettier over the rest of the file too to get it fully formatted. Thus it seems pointless to duplicate that work of running prettier within stylelint.

So stop running prettier over this handful of languages that can have style languages embedded into them.

This also adds a handful of e2e tests as which allow us to keep testing the embedded language end-to-end.

Fixes #18, #15 and #12.

@BPScott BPScott force-pushed the vue branch 3 times, most recently from ff2a0da to 2c7a214 Compare May 11, 2019 22:44
@BPScott BPScott merged commit d898e1c into master May 12, 2019
@BPScott BPScott deleted the vue branch May 12, 2019 14:51
nevilm-lt referenced this pull request in nevilm-lt/stylelint-prettier Apr 22, 2022
Make sure we don't explode on Vue and css-in-js solutions
nevilm-lt referenced this pull request in nevilm-lt/stylelint-prettier Apr 22, 2022
Make sure we don't explode on Vue and css-in-js solutions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid errors when linting Vue.js SFCs.

1 participant