Jamie-Yang / vue3-boilerplate

A Vue 3 Starter Boilerplate with Webpack 5, Vue Router 4, Pinia 2, TypeScript 5, Prettier and More.
MIT License
247 stars 88 forks source link

Conflict between prettier and stylelint while working with @font-face and multiple sources #8

Closed silversonicaxel closed 3 years ago

silversonicaxel commented 3 years ago

Considering an App.vue like this one

<template>
  <div id="app">
    <router-view />
  </div>
</template>

<style lang="scss">
@font-face {
  font-family: 'Share Tech';
  src: url('../src/assets/fonts/ShareTech-Regular.eot');
  src:
    url('../src/assets/fonts/ShareTech-Regular.eot?#iefix') format('embedded-opentype'),
    url('../src/assets/fonts/ShareTech-Regular.woff2') format('woff2'),
    url('../src/assets/fonts/ShareTech-Regular.woff') format('woff'),
    url('../src/assets/fonts/ShareTech-Regular.ttf') format('truetype'),
    url('../src/assets/fonts/ShareTech-Regular.svg#ShareTech-Regular') format('svg');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
</style>

here prettier of complains

<e>      src/App.vue:15:7
<e>      13 |   font-family: 'Share Tech';
<e>      14 |   src: url('../src/assets/fonts/ShareTech-Regular.eot');
<e>    > 15 |   src:
<e>         |       ^
<e>      16 |     url('../src/assets/fonts/ShareTech-Regular.eot?#iefix') format('embedded-opentype'),
<e>      17 |     url('../src/assets/fonts/ShareTech-Regular.woff2') format('woff2'),
<e>      18 |     url('../src/assets/fonts/ShareTech-Regular.woff') format('woff'),
<e>
<e> ✘ 1 problem (1 error, 0 warnings)
<e>
<e>
<e> Errors:
<e>   1  https://google.com/#q=prettier%2Fprettier
<e>

Considering the same App.vue like this one

<template>
  <div id="app">
    <router-view />
  </div>
</template>

<style lang="scss">
@font-face {
  font-family: 'Share Tech';
  src: url('../src/assets/fonts/ShareTech-Regular.eot');
  src: url('../src/assets/fonts/ShareTech-Regular.eot?#iefix') format('embedded-opentype'),
    url('../src/assets/fonts/ShareTech-Regular.woff2') format('woff2'),
    url('../src/assets/fonts/ShareTech-Regular.woff') format('woff'),
    url('../src/assets/fonts/ShareTech-Regular.ttf') format('truetype'),
    url('../src/assets/fonts/ShareTech-Regular.svg#ShareTech-Regular') format('svg');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
</style>

then stylelint complains

$ stylelint "./src/**/*.vue" "./src/**/*.scss"

src/App.vue
 15:6  ✖  Expected newline after ":" with a multi-line declaration   declaration-colon-newline-after
Jamie-Yang commented 3 years ago

Thank you for reporting this issue. It has been fixed. View the changes: a6465ab

silversonicaxel commented 3 years ago

awesome job!