diff --git a/eslint.config.mjs b/eslint.config.mjs index b0b6949..33a174e 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -13,6 +13,8 @@ export default [ rules: { "@typescript-eslint/no-empty-object-type": ["error", { allowInterfaces: "with-single-extends" }], "@typescript-eslint/no-namespace": ["error", { allowDeclarations: true }], + "@typescript-eslint/no-import-type-side-effects": "error", + "@typescript-eslint/consistent-type-imports": ["error", { fixStyle: "inline-type-imports" }], "no-empty": ["error", { allowEmptyCatch: true }], "prefer-const": ["error", { destructuring: "all" }], }, diff --git a/src/plugins/nx.ts b/src/plugins/nx.ts index 02b23be..4477226 100644 --- a/src/plugins/nx.ts +++ b/src/plugins/nx.ts @@ -1,7 +1,7 @@ // See nx-transformer-plugin.ts // https://github.com/nrwl/nx/blob/229f71ef1758ee625869aaa6fa6355dc3284fa5b/packages/js/src/utils/typescript/types.ts#L19-L32 // https://github.com/nrwl/nx/blob/master/packages/js/src/utils/typescript/load-ts-transformers.ts -import ts from "typescript"; +import type ts from "typescript"; import transformer from "../transformer.ts"; diff --git a/src/types.ts b/src/types.ts index 10480db..2ac1a93 100755 --- a/src/types.ts +++ b/src/types.ts @@ -1,6 +1,7 @@ -import { Minimatch } from "minimatch"; -import { type PluginConfig } from "ts-patch"; -import ts, { type CompilerOptions, type EmitHost, type Pattern, type SourceFile } from "typescript"; +import type { Minimatch } from "minimatch"; +import type { PluginConfig } from "ts-patch"; +import type ts from "typescript"; +import type { CompilerOptions, EmitHost, Pattern, SourceFile } from "typescript"; /* ****************************************************************************************************************** */ // region: TS Types diff --git a/src/utils/resolve-module-name.ts b/src/utils/resolve-module-name.ts index 1bfc0ed..fb989dc 100755 --- a/src/utils/resolve-module-name.ts +++ b/src/utils/resolve-module-name.ts @@ -2,7 +2,7 @@ import * as path from "node:path"; import { removeFileExtension, removeSuffix, type ResolvedModuleFull, type SourceFile } from "typescript"; -import { type VisitorContext } from "../types.ts"; +import type { VisitorContext } from "../types.ts"; import { isBaseDir, isURL, maybeAddRelativeLocalPrefix } from "./general-utils.ts"; import { getRelativePath } from "./get-relative-path.ts"; import { getOutputDirForSourceFile } from "./ts-helpers.ts"; diff --git a/src/utils/resolve-path-update-node.ts b/src/utils/resolve-path-update-node.ts index 7481492..e6a1dfe 100755 --- a/src/utils/resolve-path-update-node.ts +++ b/src/utils/resolve-path-update-node.ts @@ -1,6 +1,6 @@ -import ts from "typescript"; +import type ts from "typescript"; -import { type VisitorContext } from "../types.ts"; +import type { VisitorContext } from "../types.ts"; import { isURL, maybeAddRelativeLocalPrefix } from "./general-utils.ts"; import { resolveModuleName } from "./resolve-module-name.ts"; import { isModulePathsMatch } from "./ts-helpers.ts"; diff --git a/src/utils/ts-helpers.ts b/src/utils/ts-helpers.ts index 0431270..a1d4251 100755 --- a/src/utils/ts-helpers.ts +++ b/src/utils/ts-helpers.ts @@ -1,9 +1,10 @@ import path from "node:path"; import type { REGISTER_INSTANCE } from "ts-node"; -import ts, { type GetCanonicalFileName, type SourceFile } from "typescript"; +import type ts from "typescript"; +import type { GetCanonicalFileName, SourceFile } from "typescript"; -import { type VisitorContext } from "../types.ts"; +import type { VisitorContext } from "../types.ts"; /* ****************************************************************************************************************** */ // region: TS Helpers diff --git a/src/visitor.ts b/src/visitor.ts index 75b8556..bd4ee4b 100755 --- a/src/visitor.ts +++ b/src/visitor.ts @@ -1,6 +1,6 @@ -import ts from "typescript"; +import type ts from "typescript"; -import { type VisitorContext } from "./types.ts"; +import type { VisitorContext } from "./types.ts"; import { elideImportOrExportDeclaration, resolvePathAndUpdateNode } from "./utils/index.ts"; const isAsyncImport = ({ tsInstance }: VisitorContext, node: ts.Node): node is ts.CallExpression => diff --git a/test/tests/transformer/general.test.ts b/test/tests/transformer/general.test.ts index d5cda02..52a9f59 100755 --- a/test/tests/transformer/general.test.ts +++ b/test/tests/transformer/general.test.ts @@ -2,7 +2,7 @@ import * as path from "node:path"; import { before, describe, test } from "node:test"; -import { projectsPaths, ts, tsModules } from "../../config.ts"; +import { projectsPaths, type ts, tsModules } from "../../config.ts"; import { createTsProgram, getEmitResultFromProgram, type EmittedFiles } from "../../utils/index.ts"; /* ****************************************************************************************************************** * diff --git a/test/tests/transformer/specific.test.ts b/test/tests/transformer/specific.test.ts index ff2128a..0a2e0d8 100755 --- a/test/tests/transformer/specific.test.ts +++ b/test/tests/transformer/specific.test.ts @@ -3,9 +3,9 @@ import assert from "node:assert"; import * as path from "node:path"; import { before, describe, test } from "node:test"; -import TS from "typescript"; +import type TS from "typescript"; -import { type TsTransformPathsConfig } from "typescript-transform-paths"; +import type { TsTransformPathsConfig } from "typescript-transform-paths"; import { projectsPaths, ts, tsModules } from "../../config.ts"; import { diff --git a/test/utils/helpers.ts b/test/utils/helpers.ts index 4905432..c610c17 100755 --- a/test/utils/helpers.ts +++ b/test/utils/helpers.ts @@ -1,6 +1,6 @@ import fs from "node:fs"; -import ts from "typescript"; +import type ts from "typescript"; import { default as tstpTransform, type TsTransformPathsConfig } from "typescript-transform-paths"; import * as config from "../config.ts";