witcher112 / eslint-plugin-typescript-formatter

TypeScript built-in formatter for ESLint
MIT License
3 stars 2 forks source link

Vue2 single-file components (SFC) support #1

Open snandos opened 1 year ago

snandos commented 1 year ago

First let me thank you for your library to workaround the shortcomings of TypeScript formatting by eslint!

My project uses vue2 with single-file components (*.vue) where this plugin tries to format these files like they were regular typescript files which obviously leads to a syntax desaster in the <template> and <style> sections of those files.

Am I correct, that this eslint plugin is not yet aware of sfc vue files, or am I maybe doing something wrong in my configuration?

I'm quite new to eslint and typescript tooling, so I'm only guessing: might it be possible to use some logic which already is implemented in libraries like vue-tsc?

My workaround for now is a change in this pluginfile to omit typescript compiler formatting on files ending with .vue.

witcher112 commented 1 year ago

Hi,

I'm glad the package works for you!

You can restrict the scope of the plugin by using the overrides field. Here's some information about it: https://stackoverflow.com/questions/34764287/turning-off-eslint-rule-for-a-specific-file/65069069#65069069

Regarding .vue files, can you send me a package example with plugins/rules that support them?

This way I can take a look at the source code and apply the same technique to handle this case :)