-
Notifications
You must be signed in to change notification settings - Fork 49
/
.prettierrc.js
55 lines (47 loc) · 1.4 KB
/
.prettierrc.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
/** @type {import('prettier').Config} */
const pluginsConfig = {
plugins: ['@ianvs/prettier-plugin-sort-imports', 'prettier-plugin-tailwindcss'],
}
/** @type {import('prettier').Config} */
const importSortConfig = {
importOrder: [
// built-ins like `node:fs`
'<TYPES>^(node:)', // type imports
'<BUILT_IN_MODULES>', // imports
'', // a gap
// anything which doesn't match any other rules
'<TYPES>', // type imports
'<THIRD_PARTY_MODULES>', // imports
'', // a gap
// local aliases / packages starting with one of these prefixes
'<TYPES>^@/.*$', // type imports
'^@/.*$', // imports
'', // a gap
// local `./blah/something` packages
'<TYPES>^[.]', // type imports
'^[.]', // imports
],
// defaults to "1.0.0" - higher versions of typescript unlock more import-sort capabilities
// https://github.com/IanVS/prettier-plugin-sort-imports?tab=readme-ov-file#importordertypescriptversion
importOrderTypeScriptVersion: '5.6.3',
}
/** @type {import('prettier').Config} */
module.exports = {
...pluginsConfig,
...importSortConfig,
arrowParens: 'avoid',
printWidth: 120,
semi: false,
singleQuote: true,
// prettier now defaults to 'all',
// but the files in this project have all been formatted with 'es5'
trailingComma: 'es5',
overrides: [
{
files: ['tsconfig.json'],
options: {
printWidth: 1,
},
},
],
}