Skip to content
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,13 @@ lint-backend-fix: lint-go-fix lint-go-gitea-vet lint-editorconfig ## lint backen
lint-js: node_modules ## lint js files
$(NODE_VARS) pnpm exec eslint --color --max-warnings=0 --flag unstable_native_nodejs_ts_config $(ESLINT_FILES)
$(NODE_VARS) pnpm exec vue-tsc
$(NODE_VARS) pnpm exec tsgo

.PHONY: lint-js-fix
lint-js-fix: node_modules ## lint js files and fix issues
$(NODE_VARS) pnpm exec eslint --color --max-warnings=0 --flag unstable_native_nodejs_ts_config $(ESLINT_FILES) --fix
$(NODE_VARS) pnpm exec vue-tsc
$(NODE_VARS) pnpm exec tsgo

.PHONY: lint-css
lint-css: node_modules ## lint css files
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"@types/tinycolor2": "1.4.6",
"@types/toastify-js": "1.12.4",
"@typescript-eslint/parser": "8.48.1",
"@typescript/native-preview": "7.0.0-dev.20251212.1",
"@vitejs/plugin-vue": "6.0.2",
"@vitest/eslint-plugin": "1.5.1",
"eslint": "9.39.1",
Expand Down
73 changes: 73 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 2 additions & 12 deletions web_src/js/components/ViewFileTreeItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,10 @@
import {SvgIcon} from '../svg.ts';
import {isPlainClick} from '../utils/dom.ts';
import {shallowRef} from 'vue';
import {type createViewFileTreeStore} from './ViewFileTreeStore.ts';

export type Item = {
entryName: string;
entryMode: 'blob' | 'exec' | 'tree' | 'commit' | 'symlink' | 'unknown';
entryIcon: string;
entryIconOpen: string;
fullPath: string;
submoduleUrl?: string;
children?: Item[];
};
import type {createViewFileTreeStore, FileTreeItem} from './ViewFileTreeStore.ts';

const props = defineProps<{
item: Item,
item: FileTreeItem,
store: ReturnType<typeof createViewFileTreeStore>
}>();

Expand Down
13 changes: 11 additions & 2 deletions web_src/js/components/ViewFileTreeStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@ import {GET} from '../modules/fetch.ts';
import {pathEscapeSegments} from '../utils/url.ts';
import {createElementFromHTML} from '../utils/dom.ts';
import {html} from '../utils/html.ts';
import type {Item} from './ViewFileTreeItem.vue';

export type FileTreeItem = {
entryName: string;
entryMode: 'blob' | 'exec' | 'tree' | 'commit' | 'symlink' | 'unknown';
entryIcon: string;
entryIconOpen: string;
fullPath: string;
submoduleUrl?: string;
children?: Array<FileTreeItem>;
};

export function createViewFileTreeStore(props: {repoLink: string, treePath: string, currentRefNameSubURL: string}) {
const store = reactive({
rootFiles: [] as Array<Item>,
rootFiles: [] as Array<FileTreeItem>,
selectedItem: props.treePath,

async loadChildren(treePath: string, subPath: string = '') {
Expand Down
4 changes: 2 additions & 2 deletions web_src/js/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ declare module '*.vue' {
import type {DefineComponent} from 'vue';
const component: DefineComponent<unknown, unknown, any>;
export default component;
// List of named exports from vue components, used to make `tsc` output clean.
// To actually lint .vue files, `vue-tsc` is used because `tsc` can not parse them.
// Here we declare all exports from vue files so that `tsgo` can work and be used for
// non-vue files. To lint .vue files, `vue-tsc` must be used.
export function initDashboardRepoList(): void;
export function initRepositoryActionView(): void;
}
Expand Down