chore: Enforce import order via @ianvs/prettier-plugin-sort-imports (#2542)
This commit is contained in:
committed by
dermotduffy
parent
95f35bd326
commit
a96dc2e863
@@ -11,6 +11,22 @@ const config = {
|
||||
printWidth: 89,
|
||||
tabWidth: 2,
|
||||
embeddedLanguageFormatting: 'auto',
|
||||
|
||||
// Sort imports as part of formatting so editor-on-save and CI agree. Three groups
|
||||
// separated by a blank line: node built-ins, then non-relative (third-party), then
|
||||
// relative. Empty strings insert the blank line between groups; sort is
|
||||
// case-insensitive. Side-effect imports are left in place as sort barriers to
|
||||
// preserve their evaluation order. Setting the TypeScript version lets same-module
|
||||
// type and value imports combine into a single statement with an inline `type`.
|
||||
plugins: ['@ianvs/prettier-plugin-sort-imports'],
|
||||
importOrder: ['<BUILTIN_MODULES>', '', '<THIRD_PARTY_MODULES>', '', '^[.]'],
|
||||
importOrderTypeScriptVersion: '5.8.3',
|
||||
|
||||
// The codebase compiles with tsconfig `experimentalDecorators` (Lit's
|
||||
// `@customElement`/`@property`/etc.), so babel must parse the legacy decorator
|
||||
// proposal; without this it throws on decorated classes and silently skips sorting
|
||||
// those files.
|
||||
importOrderParserPlugins: ['typescript', 'decorators-legacy'],
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
||||
Reference in New Issue
Block a user