Skip to content

Commit

Permalink
Move import sorting over to prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanclark committed Jan 2, 2025
1 parent e1bdca1 commit 14ffc0d
Show file tree
Hide file tree
Showing 1,225 changed files with 4,411 additions and 4,758 deletions.
9 changes: 0 additions & 9 deletions .prettierrc

This file was deleted.

39 changes: 39 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,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: [require('@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',
};
Loading

0 comments on commit 14ffc0d

Please sign in to comment.