mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-21 09:06:46 +09:00
chore(lint): apply the main eslint config to vue files (#39545)
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.
This commit is contained in:
1 parent
986b0bcae0
commit
99573bde0e
12 files changed
+115
-112
No files matched your search
@@ -13,18 +13,13 @@ import {toggleFullScreen} from '../utils.ts';
|
||||
import {localUserSettings} from '../modules/user-settings.ts';
|
||||
import type {ActionsArtifact, ActionsJob, ActionsRun, ActionsStatus} from '../modules/gitea-actions.ts';
|
||||
import {AnsiLineRenderer} from '../render/ansi.ts';
|
||||
import {
|
||||
type ActionRunViewStore,
|
||||
createLogLineMessage,
|
||||
type LogLine,
|
||||
type LogLineCommand,
|
||||
parseLogLineCommand,
|
||||
} from './ActionRunView.ts';
|
||||
import {createLogLineMessage, parseLogLineCommand} from './ActionRunView.ts';
|
||||
import type {ActionRunViewStore, LogLine, LogLineCommand} from './ActionRunView.ts';
|
||||
|
||||
function isLogElementInViewport(el: Element, {extraViewPortHeight}={extraViewPortHeight: 0}): boolean {
|
||||
function isLogElementInViewport(el: Element, {extraViewPortHeight} = {extraViewPortHeight: 0}): boolean {
|
||||
const rect = el.getBoundingClientRect();
|
||||
// only check whether bottom is in viewport, because the log element can be a log group which is usually tall
|
||||
return 0 <= rect.bottom && rect.bottom <= window.innerHeight + extraViewPortHeight;
|
||||
return rect.bottom >= 0 && rect.bottom <= window.innerHeight + extraViewPortHeight;
|
||||
}
|
||||
|
||||
export type ActionRunJobViewLocale = {
|
||||
@@ -42,14 +37,14 @@ type Step = {
|
||||
summary: string,
|
||||
duration: string,
|
||||
status: ActionsStatus,
|
||||
}
|
||||
};
|
||||
|
||||
type JobStepState = {
|
||||
cursor: string|null,
|
||||
cursor: string | null,
|
||||
expanded: boolean,
|
||||
manuallyCollapsed: boolean, // whether the user manually collapsed the step, used to avoid auto-expanding it again
|
||||
firstLogTime?: number, // the step's first log line time, what "Show seconds" counts from
|
||||
}
|
||||
};
|
||||
|
||||
// one ANSI renderer per step, so an unterminated color carries between that step's lines only
|
||||
const stepAnsiRenderers: AnsiLineRenderer[] = [];
|
||||
@@ -59,7 +54,7 @@ type StepContainerElement = HTMLElement & {
|
||||
// then the following batches of logs should still use the same group (active logs container).
|
||||
// maybe it can be refactored to decouple from the HTML element in the future.
|
||||
_stepLogsActiveContainer?: HTMLElement;
|
||||
}
|
||||
};
|
||||
|
||||
type LocaleStorageOptions = {
|
||||
autoScroll: boolean;
|
||||
@@ -176,8 +171,8 @@ onMounted(async () => {
|
||||
}, 0);
|
||||
});
|
||||
|
||||
intervalID = setInterval(() => void loadJob(), 1000);
|
||||
void hashChangeListener();
|
||||
intervalID = setInterval(() => loadJob(), 1000);
|
||||
hashChangeListener();
|
||||
window.addEventListener('hashchange', hashChangeListener);
|
||||
});
|
||||
|
||||
@@ -256,7 +251,7 @@ async function copyStepOutput(event: MouseEvent, stepIndex: number) {
|
||||
function toggleStepLogs(idx: number) {
|
||||
currentJobStepsStates.value[idx].expanded = !currentJobStepsStates.value[idx].expanded;
|
||||
if (currentJobStepsStates.value[idx].expanded) {
|
||||
void loadJobForce(); // try to load the data immediately instead of waiting for next timer interval
|
||||
loadJobForce(); // try to load the data immediately instead of waiting for next timer interval
|
||||
} else if (currentJob.value.steps[idx].status === 'running') {
|
||||
currentJobStepsStates.value[idx].manuallyCollapsed = true;
|
||||
}
|
||||
@@ -293,19 +288,14 @@ function shouldAutoScroll(stepIndex: number): boolean {
|
||||
function appendLogs(stepIndex: number, startTime: number, logLines: LogLine[]) {
|
||||
for (const line of logLines) {
|
||||
const cmd = parseLogLineCommand(line);
|
||||
switch (cmd?.name) {
|
||||
case 'hidden':
|
||||
continue;
|
||||
case 'group':
|
||||
beginLogGroup(stepIndex, startTime, line, cmd);
|
||||
continue;
|
||||
case 'endgroup':
|
||||
endLogGroup(stepIndex);
|
||||
continue;
|
||||
if (cmd?.name === 'group') {
|
||||
beginLogGroup(stepIndex, startTime, line, cmd);
|
||||
} else if (cmd?.name === 'endgroup') {
|
||||
endLogGroup(stepIndex);
|
||||
} else if (cmd?.name !== 'hidden') {
|
||||
// the active logs container may change during the loop, for example: entering and leaving a group
|
||||
getActiveLogsContainer(stepIndex).append(createLogLine(stepIndex, startTime, line, cmd));
|
||||
}
|
||||
// the active logs container may change during the loop, for example: entering and leaving a group
|
||||
const el = getActiveLogsContainer(stepIndex);
|
||||
el.append(createLogLine(stepIndex, startTime, line, cmd));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user