-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
.prettierrc.js
39 lines (37 loc) · 1017 Bytes
/
.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
const tsConfigBase = require('./tsconfig.json');
const ourPackages = new Set(
Object.keys(tsConfigBase.compilerOptions.paths).map(
// Remove extra '/*' if present in the package name.
packageName => packageName.split('/')[0]
)
);
const appPackages = ['teleport', 'e-teleport', 'teleterm'].flatMap(pkg => [
pkg,
`@gravitational/${pkg}`,
]);
const libraryPackages = [...ourPackages]
.filter(pkg => !appPackages.includes(pkg))
.flatMap(pkg => [pkg, `@gravitational/${pkg}`]);
module.exports = {
arrowParens: 'avoid',
printWidth: 80,
bracketSpacing: true,
plugins: ['@ianvs/prettier-plugin-sort-imports'],
importOrder: [
'<BUILTIN_MODULES>',
'',
'<THIRD_PARTY_MODULES>',
'',
`^(${libraryPackages.join('|')})`,
'',
`^(${appPackages.join('|')})`,
'',
'^[./]',
],
importOrderParserPlugins: ['typescript', 'jsx', 'decorators-legacy'],
importOrderTypeScriptVersion: '5.0.0',
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
};