prettier-eslint-code icon indicating copy to clipboard operation
prettier-eslint-code copied to clipboard

Whether can support html or vue script tag

Open jing2si opened this issue 8 years ago • 4 comments

All in title.

jing2si avatar Apr 13 '17 05:04 jing2si

Yeah, I got this Language is not valid as well (for .vue file). And I already put plugin into .eslintrc.js

plugins: [
    'html','vue'
  ],

ryh avatar Apr 13 '17 18:04 ryh

So the extension is .vue are there other extensions? I don't know if .html is a good plan though... 🤔

RobinMalfait avatar Apr 13 '17 18:04 RobinMalfait

there are great variety file extension for users , for example I use .vue (Vue) .blade.php (Laravel Blade) but some may not. I suggest add a config for user to define the VALID_LANG

what I tried

  • copy the js in .vue into a standalone .js file then use the extension , worked well.
  • clone this repo and change const VALID_LANG: DocumentSelector = ['javascript', 'javascriptreact', 'html', 'vue'];, then vsce package and install . worked in selecting the js code and prettier. but reported prettier-eslint [ERROR]: prettier formatting failed due to a prettier error while using the prettier to the .vue document (without selecting)

ryh avatar Apr 14 '17 05:04 ryh

The reason it errors, is because there are multiple 'languages' in the file. So prettier takes in the whole file (or selection) but it sees html tags like

RobinMalfait avatar Apr 15 '17 10:04 RobinMalfait