mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-03 12:00:51 +00:00
99573bde0e
Vue files only got `eslint-plugin-vue` rules, so stylistic and TypeScript rules never ran on them, and `import-x` could not see cycles between `.ts` and `.vue` files. - Apply the main ESLint config to `.vue` files - Let `import-x` parse `.vue` files, which surfaced a cycle between `repo-findfile.ts` and `RepoFileSearch.vue` - Fix the resulting lint issues `vue-eslint-parser` is added as a direct dependency because `import-x` resolves parsers by package name, see https://github.com/un-ts/eslint-plugin-import-x/issues/381.
39 lines
1.1 KiB
Vue
39 lines
1.1 KiB
Vue
<script lang="ts" setup>
|
|
import ViewFileTreeItem from './ViewFileTreeItem.vue';
|
|
import {onMounted, useTemplateRef, type ShallowRef} from 'vue';
|
|
import {createViewFileTreeStore} from './ViewFileTreeStore.ts';
|
|
|
|
const elRoot = useTemplateRef('elRoot') as Readonly<ShallowRef<HTMLDivElement>>;
|
|
|
|
const props = defineProps({
|
|
repoLink: {type: String, required: true},
|
|
treePath: {type: String, required: true},
|
|
currentRefNameSubURL: {type: String, required: true},
|
|
});
|
|
|
|
const store = createViewFileTreeStore(props);
|
|
onMounted(async () => {
|
|
store.rootFiles = await store.loadChildren('', props.treePath);
|
|
elRoot.value.closest('.is-loading')?.classList?.remove('is-loading');
|
|
window.addEventListener('popstate', (e) => {
|
|
store.selectedItem = e.state?.treePath || '';
|
|
if (e.state?.url) store.loadViewContent(e.state.url);
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<div class="view-file-tree-items" ref="elRoot">
|
|
<ViewFileTreeItem v-for="item in store.rootFiles" :key="item.entryName" :item="item" :store="store"/>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.view-file-tree-items {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 1px;
|
|
margin-right: .5rem;
|
|
}
|
|
</style>
|