create-vue icon indicating copy to clipboard operation
create-vue copied to clipboard

Whether eslint and prettier add a single quote support

Open qcyblm opened this issue 2 years ago • 5 comments

image

qcyblm avatar Apr 28 '22 03:04 qcyblm

Single and double quotes are supported in the JS/ES spec. This doesn't have anything to do with Vue, Create Vue, Vite, ESLint, or Prettier.

nickmccurdy avatar Jun 23 '22 18:06 nickmccurdy

It's prettiers default config to prefer double quotes. It can be configured but this project doesn't do that ATM.

segevfiner avatar Jul 24 '22 14:07 segevfiner

Please refer to https://github.com/vuejs/core/blob/main/.prettierrc#L2 https://github.com/vuejs/create-vue/blob/main/.prettierrc#L4

prettier options https://prettier.io/docs/en/options.html prettier Configuration File https://prettier.io/docs/en/configuration.html

my config .prettierrc.yaml

semi: false
singleQuote: true
endOfLine: auto

Eunknight avatar Jul 27 '22 09:07 Eunknight

We might want to include this in the template should the generated code keep following this style, to avoid formatting errors. Although it is kind of opinionated.

segevfiner avatar Jul 27 '22 09:07 segevfiner

Please refer to https://github.com/vuejs/core/blob/main/.prettierrc#L2 https://github.com/vuejs/create-vue/blob/main/.prettierrc#L4

prettier options https://prettier.io/docs/en/options.html prettier Configuration File https://prettier.io/docs/en/configuration.html

my config .prettierrc.yaml

semi: false
singleQuote: true
endOfLine: auto

This can be solved by adding a Prettier configuration file to the root of the Vue project, which you want to include when you create a Vue project and select Prettier

.prettierrc

{
  "singleQuote": true,
  "semi": false,
  "trailingComma": "none"
}

qcyblm avatar Jul 27 '22 10:07 qcyblm