fix(sdk): remove @/ alias from tsconfig#165
Conversation
Unit Tests
Mutation Tests
|
…m MenuConfig file
There was a problem hiding this comment.
Pull request overview
Removes the @/ TypeScript path alias from the SDK build so emitted dist imports don’t rely on TS-only path mapping (addressing #164 / ts-jest consuming dist).
Changes:
- Removed
pathsalias configuration frompackages/sdk/tsconfig.json. - Rewrote SDK source imports to use relative paths / barrel exports instead of
@/…. - Adjusted SDK entity exports and some UI inline-toolbar code cleanup.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/ui/src/InlineToolbar/InlineToolbar.ts | Removes an ESLint suppression around inline toolbar item mapping. |
| packages/sdk/tsconfig.json | Drops paths mapping for @/* alias. |
| packages/sdk/src/tools/facades/BaseToolFacade.ts | Updates imports away from @/ and adjusts entity imports/re-exports. |
| packages/sdk/src/tools/facades/BaseToolFacade.spec.ts | Updates test imports away from @/. |
| packages/sdk/src/entities/InlineTool.ts | Converts @/ type imports to relative imports. |
| packages/sdk/src/entities/index.ts | Changes barrel exports to include runtime exports from BaseTool/BlockTool. |
| packages/sdk/src/entities/EventBus/events/core/ToolLoadedCoreEvent.ts | Replaces @/tools/... import with relative tools import. |
| packages/sdk/src/entities/EventBus/events/core/SelectionChangedCoreEvent.ts | Replaces @/tools import with relative tools import. |
| packages/sdk/src/entities/EditorjsPlugin.ts | Replaces @/ imports with relative imports. |
| packages/sdk/src/entities/EditorjsAdapterPlugin.ts | Replaces @/ imports with relative imports. |
| packages/sdk/src/entities/BlockTune.ts | Replaces @/ imports with relative imports. |
| packages/sdk/src/entities/BlockToolAdapter.ts | Replaces @/ imports with relative imports. |
| packages/sdk/src/entities/BlockTool.ts | Replaces @/ imports with relative imports. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return [toolbarConfig] | ||
| .flat() | ||
| .map((item): PopoverItemParams[] => { | ||
| switch (item.type) { | ||
| case PopoverItemType.Html: |
There was a problem hiding this comment.
Verified both claims: removing the disable doesn't reintroduce no-unsafe-return (flagged as unused when re-added). Also checked the type concern — .flat() already infers MenuConfigItem[] correctly, same as an Array.isArray rewrite would. No type-safety loss, not necessary to change.
| import { ToolType, BaseToolOptionKey } from '../../entities'; | ||
| import { type BlockTuneFacade } from './BlockTuneFacade.js'; | ||
| import type { | ||
| BlockTool, BlockToolConstructor, InlineTool, InlineToolConstructor, BlockTuneConstructor, | ||
| ToolTypeToOptions | ||
| ToolTypeToOptions, ToolStaticOptions, BlockToolOptions, InlineToolOptions, BlockTuneOptions | ||
| } from '../../entities'; | ||
| import type { ToolStaticOptions, BlockToolOptions, InlineToolOptions, BlockTuneOptions } from '../../entities/BaseTool.js'; | ||
| import { BaseToolOptionKey } from '../../entities/BaseTool.js'; | ||
| import type { EditorAPI } from '@/api'; | ||
| import type { EditorAPI } from '../../api'; |
| import type { BlockToolConstructor, BlockToolData } from '../../entities'; | ||
| import { BlockToolOptionKey, ToolType } from '../../entities'; | ||
| import type { ToolOptions } from './BaseToolFacade.js'; | ||
| import { UserToolOptions } from './BaseToolFacade.js'; | ||
| import { BlockToolFacade } from './BlockToolFacade.js'; | ||
| import type { InlineFragment } from '@editorjs/model-types'; | ||
| import { BlockChildType, NODE_TYPE_HIDDEN_PROP } from '@editorjs/model-types'; | ||
| import type { EditorAPI } from '@/api'; | ||
| import type { EditorAPI } from '../../api'; |
There was a problem hiding this comment.
Same value-import issue as here. One correction: it doesn't actually break yarn test — ts-jest's resolver is CommonJS-like and masks it, so green tests aren't a safety signal here.
| import type { ToolType } from './EntityType.js'; | ||
| import type { BaseToolConstructor, BaseToolOptions } from './BaseTool'; | ||
| import type { EditorAPI } from '../api'; | ||
| import type { MenuConfig } from './MenuConfig.js'; |
| import type { BlockToolAdapter } from './BlockToolAdapter.js'; | ||
| import type { ToolType } from '@/entities/EntityType.js'; | ||
| import type { BaseToolConstructor, BaseToolOptions } from '@/entities/BaseTool'; | ||
| import type { EditorAPI } from '@/api'; | ||
| import type { ToolType } from './EntityType.js'; | ||
| import type { BaseToolConstructor, BaseToolOptions } from './BaseTool'; | ||
| import type { EditorAPI } from '../api'; |
| import type { EventBus } from './EventBus/EventBus.js'; | ||
| import type { CoreConfigValidated } from './Config.js'; | ||
| import type { EditorAPI } from '../api'; | ||
| import type { EntityType } from './EntityType.js'; |
| import type { EditorjsPlugin, EditorjsPluginConstructor } from './EditorjsPlugin'; | ||
| import type { BlockId } from '@editorjs/model-types'; | ||
| import type { PluginType } from '@/entities/EntityType'; | ||
| import type { BlockToolAdapter } from '@/entities/BlockToolAdapter'; | ||
| import type { PluginType } from './EntityType'; | ||
| import type { BlockToolAdapter } from './BlockToolAdapter'; |
| BlockChildType | ||
| } from '@editorjs/model-types'; | ||
| import type { CoreConfig } from '@/entities/Config'; | ||
| import type { CoreConfig } from './Config'; |
| @@ -1,4 +1,4 @@ | |||
| import type { ToolFacadeClass } from '@/tools/facades/index.js'; | |||
| import type { ToolFacadeClass } from '../../../../tools'; | |||
| import { CoreEventType } from './CoreEventType.js'; | ||
| import type { InlineFragment, Index } from '@editorjs/model-types'; | ||
| import type { InlineToolFacade } from '@/tools'; | ||
| import type { InlineToolFacade } from '../../../../tools'; |
Reversean
left a comment
There was a problem hiding this comment.
One more spot the alias cleanup missed: packages/sdk/jest.config.ts still has '^@/(.*)$': '<rootDir>/src/$1' in moduleNameMapper (this file isn't touched by the PR). It's dead now that nothing imports @/, but worth removing for a complete cleanup.
Closes #164
I don't want to bring another dependency to the project, if we don't fully use aliases. I think aliases are not great for library like SDK, but it works fine in the playground app though.