简体   繁体   English

'prettier/vue' 和 '@vue/prettier' 之间的区别

[英]Difference eslint between 'prettier/vue' and '@vue/prettier'

Lately I was working on a vue3/vite + ts project and wanted to add eslint and prettier, but I'm getting confused what settings I should use in the eslint file(section "extends") and/or how to spell them.最近我在做一个 vue3/vite + ts 项目,想添加 eslint 和更漂亮,但我很困惑我应该在 eslint 文件中使用哪些设置(“扩展”部分)和/或如何拼写它们。 If I look at the official eslint vue homepage , they write the prettier stuff like the not commented out lines(picture below).But if I look at the official eslint-config-typescript page they write it like the commented out lines(picture below).如果我查看官方 eslint vue 主页,他们会写更漂亮的东西,例如未注释掉的行(下图)。但是如果我查看官方 eslint-config-typescript 页面,他们会像注释掉的行一样写(下图) )。 And if I google I find both examples in projects.如果我用谷歌搜索,我会在项目中找到这两个例子。 So my question is:所以我的问题是:

Is there any difference between the writing?写的有区别吗? Or do they do the same and it doesn't matter which one I take?还是他们做同样的事情,我拿哪一个都没关系?

在此处输入图像描述

I don't know much about vue3/vite + ts, but I see here 2 moments:我对 vue3/vite + ts 了解不多,但我在这里看到了 2 个时刻:

  1. Usage of @ . @的用法。 It is likely to be related to webpack (I believe you use vue-cli).很可能和webpack有关(相信你用vue-cli)。 It usually means something like that: resolve: {alias: {'@': path.resolve('src')}}, So, @ is just an alias for some path in your system, usually root/source folder for your project.它通常的意思是这样的: resolve: {alias: {'@': path.resolve('src')}},所以, @只是系统中某个路径的别名,通常是项目的根/源文件夹. You can find the exact path in webpack.config.js .您可以在webpack.config.js中找到确切的路径。
  2. vue/prettier vs prettier/vue . vue/prettierprettier/vue的对比。 Just location of the package.只是 package 的位置。 You either take prettier bundled with vue or a standalone prettier package that contains some custom/adopted version for vue.您可以使用与 vue 捆绑的更prettier的软件,也可以使用包含一些自定义/采用 vue 版本的独立prettier的 package。 They are likely to be pretty much the same, check their package.json files for versions.它们可能几乎相同,请查看 package.json 文件的版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM