Skip to content

Commit

Permalink
Merge pull request #14 from taiga-family/unescape-quotes
Browse files Browse the repository at this point in the history
fix(backticks): fix dynamic type imports
  • Loading branch information
MillerSvt authored Apr 3, 2024
2 parents a51192c + 5916cba commit 4a7ad49
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/is-allowed-literal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { AstPath } from 'prettier';

import isAngularComponentSelector from './is-angular-component-selector.js';
import isDynamicImport from './is-dynamic-import.js';
import isDynamicTypeImport from './is-dynamic-type-import.js';
import isImportExport from './is-import-export.js';
import isProperty from './is-property.js';

Expand All @@ -10,6 +11,7 @@ export default function (path: AstPath): boolean {
!isImportExport(path) &&
!isProperty(path) &&
!isDynamicImport(path) &&
!isDynamicTypeImport(path) &&
!isAngularComponentSelector(path)
);
}
5 changes: 5 additions & 0 deletions src/is-dynamic-type-import.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { AstPath } from 'prettier';

export default function (path: AstPath): boolean {
return path.getParentNode(1)?.type === 'TSImportType';
}
5 changes: 5 additions & 0 deletions test/fixtures/type-imports.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type A = typeof import('a');
type B = typeof import("b");

import type C from 'c';
import { type D } from 'd';
5 changes: 5 additions & 0 deletions test/snapshots/fixture.type-imports.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type A = typeof import("a");
type B = typeof import("b");

import type C from "c";
import { type D } from "d";

0 comments on commit 4a7ad49

Please sign in to comment.