Skip to content

Commit

Permalink
refactor: clean up some import paths
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianWoelki committed Nov 30, 2024
1 parent 6ff732a commit ceb8efa
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 26 deletions.
6 changes: 3 additions & 3 deletions src/editor/icons-suggestion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
it,
vi,
} from 'vitest';
import icon from '../lib/icon';
import * as iconPackManager from '../icon-pack-manager';
import * as util from '../util';
import icon from '@lib/icon';
import * as iconPackManager from '@app/icon-pack-manager';
import * as util from '@app/util';
import SuggestionIcon from './icons-suggestion';

vi.mock('obsidian', () => ({
Expand Down
6 changes: 3 additions & 3 deletions src/editor/icons-suggestion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
EditorSuggestContext,
EditorSuggestTriggerInfo,
} from 'obsidian';
import { getAllLoadedIconNames } from '../icon-pack-manager';
import icon from '../lib/icon';
import emoji from '../emoji';
import { getAllLoadedIconNames } from '@app/icon-pack-manager';
import icon from '@app/lib/icon';
import emoji from '@app/emoji';
import { saveIconToIconPack } from '@app/util';
import IconizePlugin from '@app/main';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { MarkdownView, editorInfoField } from 'obsidian';
import { RangeSetBuilder } from '@codemirror/state';
import { syntaxTree, tokenClassNodeProp } from '@codemirror/language';
import icon from '@lib/icon';
import { IconInLinkWidget } from '../widgets';
import { IconInLinkWidget } from '@app/editor/live-preview/widgets';
import { HeaderToken } from '@app/lib/util/text';

export const buildLinkDecorations = (
Expand Down
4 changes: 2 additions & 2 deletions src/lib/custom-rule.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { vi, it, describe, beforeEach, expect, MockInstance } from 'vitest';
import { Plugin, TAbstractFile } from 'obsidian';
import { CustomRule } from '@app/settings/data';
import config from '@app/config';
import dom from './util/dom';
import { CustomRule } from '../settings/data';
import customRule, { CustomRuleFileType } from './custom-rule';
import config from '../config';

describe('doesMatchFileType', () => {
let rule: CustomRule;
Expand Down
12 changes: 6 additions & 6 deletions src/lib/custom-rule.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Plugin, TAbstractFile } from 'obsidian';
import IconizePlugin from '../main';
import { CustomRule } from '../settings/data';
import dom from './util/dom';
import { getFileItemTitleEl } from '../util';
import config from '../config';
import { FileItem } from '../@types/obsidian';
import IconizePlugin from '@app/main';
import { CustomRule } from '@app/settings/data';
import { getFileItemTitleEl } from '@app/util';
import config from '@app/config';
import { FileItem } from '@app/@types/obsidian';
import { IconCache } from './icon-cache';
import dom from './util/dom';

export type CustomRuleFileType = 'file' | 'folder';

Expand Down
2 changes: 1 addition & 1 deletion src/lib/util/dom.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { beforeEach, it, expect, describe, vi, MockInstance } from 'vitest';
import * as iconPackManager from '../../icon-pack-manager';
import * as iconPackManager from '@app/icon-pack-manager';
import dom from './dom';
import svg from './svg';
import style from './style';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/util/style.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
it,
vi,
} from 'vitest';
import * as util from '../../util';
import * as util from '@app/util';
import svg from './svg';
import style from './style';

Expand Down
6 changes: 3 additions & 3 deletions src/lib/util/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// only include utility functions for setting styles for nodes or icons. The only
// dependency is the `svg` library.

import emoji from '../../emoji';
import IconizePlugin from '../../main';
import emoji from '@app/emoji';
import IconizePlugin from '@app/main';
import { getFileItemTitleEl } from '@app/util';
import svg from './svg';
import { getFileItemTitleEl } from '../../util';

interface Margin {
top: number;
Expand Down
8 changes: 4 additions & 4 deletions src/settings/ui/customIconRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import {
import { CustomRule } from '../data';
import customRule from '@lib/custom-rule';
import iconTabs from '@lib/icon-tabs';
import dom from '../../lib/util/dom';
import svg from '../../lib/util/svg';
import { getNormalizedName } from '../../icon-pack-manager';
import { TabHeaderLeaf } from '../../@types/obsidian';
import dom from '@lib/util/dom';
import svg from '@lib/util/svg';
import { getNormalizedName } from '@app/icon-pack-manager';
import { TabHeaderLeaf } from '@app/@types/obsidian';
import emoji from '@app/emoji';

export default class CustomIconRuleSetting extends IconFolderSetting {
Expand Down
2 changes: 1 addition & 1 deletion src/settings/ui/toggleIconInTabs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Setting } from 'obsidian';
import iconTabs from '@lib/icon-tabs';
import { TabHeaderLeaf } from '@app/@types/obsidian';
import IconFolderSetting from './iconFolderSetting';
import { TabHeaderLeaf } from '../../@types/obsidian';

export default class ToggleIconInTabs extends IconFolderSetting {
public display(): void {
Expand Down
5 changes: 4 additions & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export default defineConfig({
},
},
resolve: {
alias: [{ find: '@app', replacement: resolve(__dirname, './src') }],
alias: [
{ find: '@app', replacement: resolve(__dirname, './src') },
{ find: '@lib', replacement: resolve(__dirname, './src/lib') },
],
},
});

0 comments on commit ceb8efa

Please sign in to comment.