-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprettier.config.js
71 lines (65 loc) · 2.08 KB
/
prettier.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// prettier.config.js, .prettierrc.js, prettier.config.mjs, or .prettierrc.mjs
/**
* @see https://prettier.io/docs/en/configuration.html
* @type {import('prettier').Config}
*/
const config = {
// max 80 characters per line
printWidth: 80,
// use 2 spaces for indentation
tabWidth: 2,
// use spaces instead of indentations
useTabs: false,
// semicolon at the end of the line
semi: true,
// use single quotes
singleQuote: true,
// object's key is quoted only when necessary
quoteProps: 'as-needed',
// use double quotes instead of single quotes in jsx
jsxSingleQuote: false,
// no comma at the end
trailingComma: 'all',
// spaces are required at the beginning and end of the braces
bracketSpacing: true,
// brackets are not required for arrow function parameter, when there is only one parameter
arrowParens: 'avoid',
// format the entire contents of the file
rangeStart: 0,
rangeEnd: Infinity,
// no need to write the beginning @prettier of the file
requirePragma: false,
// No need to automatically insert @prettier at the beginning of the file
insertPragma: false,
// use default break criteria
proseWrap: 'always',
// decide whether to break the html according to the display style
htmlWhitespaceSensitivity: 'css',
// vue files script and style tags indentation
vueIndentScriptAndStyle: false,
// lf for newline
endOfLine: 'lf',
// formats quoted code embedded
embeddedLanguageFormatting: 'auto',
// Plugins
plugins: ['prettier-plugin-pkg', '@ianvs/prettier-plugin-sort-imports'],
// @ianvs/prettier-plugin-sort-imports
importOrder: [
// Packages.
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
'^@?\\w',
'',
// Absolute imports and other imports such as Vue-style `@/foo`.
// Anything that does not start with a dot.
'^../',
'',
'^./',
'',
// Relative imports.
// Anything that starts with two dots.
// Style imports.
'^.+\\.s?css$',
],
importOrderParserPlugins: ['typescript', 'jsx', 'decorators-legacy'],
};
export default config;