-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.prettierrc.mjs
68 lines (66 loc) · 1.65 KB
/
.prettierrc.mjs
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
// .prettierrc.mjs
/** @type {import("prettier").Config} */
export default {
// Load the Astro plugin for formatting Astro files
plugins: ['prettier-plugin-astro'],
overrides: [
// Astro files
{
files: '*.astro',
options: {
parser: 'astro',
},
},
// JSON and JSONC files
{
files: ['*.json', '*.jsonc'],
options: {
parser: 'json',
useTabs: false, // JSON doesn't support tabs
tabWidth: 4,
},
},
// Markdown files
{
files: '*.md',
options: {
parser: 'markdown',
proseWrap: 'always', // Wrap markdown text at the print width
},
},
// CSS and SCSS files
{
files: ['*.css', '*.scss'],
options: {
parser: 'scss',
},
},
// YAML files (support both .yml and .yaml extensions)
{
files: ['*.yml', '*.yaml'],
options: {
parser: 'yaml',
useTabs: false, // YAML doesn't support tabs
tabWidth: 4,
},
},
// HTML files
{
files: '*.html',
options: {
parser: 'html',
},
},
],
// Global Prettier options
tabWidth: 4, // Set tab width to 4 spaces or equivalent
useTabs: true, // Use tabs for indentation in most files
semi: true, // End statements with a semicolon
singleQuote: true, // Use single quotes instead of double quotes
trailingComma: 'all', // Include trailing commas wherever valid
printWidth: 100, // Wrap lines that exceed 100 characters
bracketSpacing: true, // Add spaces between brackets in object literals
arrowParens: 'always', // Always include parentheses around arrow function arguments
bracketSameLine: false, // Place the closing bracket of JSX elements on a new line
endOfLine: 'lf', // Enforce line feed (\n) as the line ending
};