Skip to content

Commit 4dc97c0

Browse files
Antreesybackportbot[bot]
authored andcommitted
chore(eslint): functions rules
- antfu/top-level-function Signed-off-by: Maksim Sukharev <[email protected]>
1 parent 0eda72d commit 4dc97c0

File tree

14 files changed

+36
-21
lines changed

14 files changed

+36
-21
lines changed

eslint.config.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export default [
2323
'@typescript-eslint/no-unsafe-function-type': 'off',
2424
'@typescript-eslint/no-unused-vars': 'off',
2525
'@typescript-eslint/no-use-before-define': 'off',
26-
'antfu/top-level-function': 'off',
2726
'curly': 'off',
2827
'jsdoc/tag-lines': 'off',
2928
'import-extensions/extensions': 'off',

src/App.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ const loggingStore = useLogStore()
7474
7575
const entries = computed(() => loggingStore.entries)
7676
77-
const onShowServerLog = () => {
77+
/**
78+
*
79+
*/
80+
function onShowServerLog() {
7881
settingsStore.localFile = undefined
7982
// remove local entries
8083
loggingStore.allEntries = []
@@ -85,7 +88,7 @@ const onShowServerLog = () => {
8588
* Handle paste events with log entries
8689
* @param event The keyboard event
8790
*/
88-
const onHandlePaste = (event: ClipboardEvent) => {
91+
function onHandlePaste(event: ClipboardEvent) {
8992
event.preventDefault()
9093
9194
if (event.clipboardData) {

src/components/LogDetailsModal.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ const cssLevelClass = computed(() => [
133133
/**
134134
* Copy the raw log entry as json
135135
*/
136-
const copyRaw = async () => {
136+
async function copyRaw() {
137137
if (await copyToCipboard(JSON.stringify(props.currentEntry))) {
138138
showSuccess(t('logreader', 'Log entry successfully copied'))
139139
}
@@ -142,7 +142,7 @@ const copyRaw = async () => {
142142
/**
143143
* Copy the log entry formatted to be human readable
144144
*/
145-
const copyFormatted = async () => {
145+
async function copyFormatted() {
146146
if (await copyToCipboard(formatLogEntry(props.currentEntry))) {
147147
showSuccess(t('logreader', 'Log entry successfully copied'))
148148
}

src/components/LogSearch.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const currentQuery = computed(() => logStore.query)
6464
* @param param0 The InputEvent
6565
* @param param0.target The input element
6666
*/
67-
const onSearchInput = ({ target }: InputEvent) => {
67+
function onSearchInput({ target }: InputEvent) {
6868
logStore.searchLogs((target as HTMLInputElement).value)
6969
}
7070
@@ -73,7 +73,7 @@ const onSearchInput = ({ target }: InputEvent) => {
7373
*
7474
* @param event The keydown event
7575
*/
76-
const keyboardListener = (event: KeyboardEvent) => {
76+
function keyboardListener(event: KeyboardEvent) {
7777
if (event.ctrlKey && event.key === 'f') {
7878
isOpen.value = true
7979
event.preventDefault()

src/components/settings/SettingsActions.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const fileinput = ref<HTMLInputElement>()
6464
/**
6565
* Called when an user selected a local file
6666
*/
67-
const onFileSelected = async () => {
67+
async function onFileSelected() {
6868
const file = fileinput.value?.files?.item?.(0)
6969
if (file) {
7070
try {

src/components/settings/SettingsDatetimeFormat.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,18 @@ const isLocalLogfile = computed(() => settingsStore.localFile !== undefined)
7474
*/
7575
const dateTimeFormat = computed(() => settingsStore.dateTimeFormat)
7676
77-
const setDateTimeFormat = (v: IAppSettings['dateTimeFormat']) =>
78-
settingsStore
77+
/**
78+
*
79+
* @param v
80+
*/
81+
function setDateTimeFormat(v: IAppSettings['dateTimeFormat']) {
82+
return settingsStore
7983
.setSetting('dateTimeFormat', v)
8084
.catch((e) => {
8185
logger.debug(e)
8286
showError(t('logreader', 'Could not change date time format.'))
8387
})
88+
}
8489
</script>
8590

8691
<style scoped>

src/components/settings/SettingsSetLogLevel.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ const settingsStore = useSettingsStore()
3636
*/
3737
const logLevel = computed(() => `${settingsStore.logLevel}`)
3838
39-
const setLogLevel = (level: string) => {
39+
/**
40+
*
41+
* @param level
42+
*/
43+
function setLogLevel(level: string) {
4044
const numericLevel = parseInt(level) as IAppSettings['logLevel']
4145
settingsStore.setSetting('logLevel', numericLevel)
4246
.catch(e => {

src/components/table/LogTable.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ const currentRow = ref<ILogEntry>(props.rows[0])
110110
*
111111
* @param row The log entry to display
112112
*/
113-
const showDetailsForRow = (row: ILogEntry) => {
113+
function showDetailsForRow(row: ILogEntry) {
114114
currentRow.value = row
115115
isModalOpen.value = true
116116
}
@@ -124,7 +124,7 @@ const tableBody = ref<HTMLElement>()
124124
/**
125125
* Load older log entries and ensure that the view sticks at the previous top element
126126
*/
127-
const loadMore = async () => {
127+
async function loadMore() {
128128
const sizeBefore = logStore.entries.length
129129
await logStore.loadMore()
130130
// Ensure that the view sticks at the previous top element

src/components/table/LogTableHeader.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const sortIcon = computed(() => {
8484
/**
8585
* Switch through the sort modes
8686
*/
87-
const changeSortMode = () => {
87+
function changeSortMode() {
8888
switch (props.sorted) {
8989
case 'ascending': emit('update:sorted', 'descending'); break
9090
case 'descending': emit('update:sorted', ''); break

src/components/table/LogTableRow.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ const tableRowElement = ref<HTMLTableRowElement>()
144144
/**
145145
* Copy the raw log entry as json
146146
*/
147-
const copyRaw = async () => {
147+
async function copyRaw() {
148148
if (await copyToCipboard(JSON.stringify(props.row))) {
149149
showSuccess(t('logreader', 'Log entry successfully copied'))
150150
}
@@ -153,7 +153,7 @@ const copyRaw = async () => {
153153
/**
154154
* Copy the log entry formatted to be human readable
155155
*/
156-
const copyFormatted = async () => {
156+
async function copyFormatted() {
157157
if (await copyToCipboard(formatLogEntry(props.row))) {
158158
showSuccess(t('logreader', 'Log entry successfully copied'))
159159
}
@@ -163,7 +163,7 @@ const copyFormatted = async () => {
163163
* If expanded set a fixed height to show the full log message,
164164
* if not remove the height style to reset the height to one text line with hidden overflow
165165
*/
166-
const resizeTabeRow = () => {
166+
function resizeTabeRow() {
167167
if (isExpanded.value) {
168168
nextTick(() => {
169169
const height = tableRowElement.value?.scrollHeight || 0

0 commit comments

Comments
 (0)