Skip to content

Commit f907d5a

Browse files
Antreesybackportbot[bot]
authored andcommitted
chore(eslint): function multiline rules
- @stylistic/function-paren-newline - @stylistic/implicit-arrow-linebreak - @stylistic/max-statements-per-line - curly Signed-off-by: Maksim Sukharev <[email protected]>
1 parent 6907cf5 commit f907d5a

File tree

12 files changed

+52
-35
lines changed

12 files changed

+52
-35
lines changed

eslint.config.mjs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,13 @@ export default [
1313
'@nextcloud/vue/no-deprecated-exports': 'off',
1414
'@nextcloud/vue/no-deprecated-props': 'off',
1515
'@stylistic/arrow-parens': 'off',
16-
'@stylistic/function-paren-newline': 'off',
17-
'@stylistic/implicit-arrow-linebreak': 'off',
1816
'@stylistic/indent': 'off',
1917
'@stylistic/indent-binary-ops': 'off',
20-
'@stylistic/max-statements-per-line': 'off',
2118
'@stylistic/member-delimiter-style': 'off',
2219
'@stylistic/object-curly-spacing': 'off',
2320
'@typescript-eslint/no-unsafe-function-type': 'off',
2421
'@typescript-eslint/no-unused-vars': 'off',
2522
'@typescript-eslint/no-use-before-define': 'off',
26-
'curly': 'off',
2723
'import-extensions/extensions': 'off',
2824
'vue/first-attribute-linebreak': 'off',
2925
'vue/no-boolean-default': 'off',

src/components/IntersectionObserver.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,18 @@ const observable = ref<HTMLDivElement>()
3636
* The intersection observer
3737
*/
3838
const observer = new IntersectionObserver((entries) => {
39-
if (entries[0].isIntersecting) emit('intersection')
39+
if (entries[0].isIntersecting) {
40+
emit('intersection')
41+
}
4042
}, props.options)
4143
4244
/**
4345
* Start observing when mounted
4446
*/
4547
onMounted(() => {
46-
if (observable.value) observer.observe(observable.value)
48+
if (observable.value) {
49+
observer.observe(observable.value)
50+
}
4751
})
4852
4953
/**

src/components/LogDetailsModal.vue

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,13 @@ watchEffect(() => {
9999
/**
100100
* Index of the current entry within all entries
101101
*/
102-
const index = computed(() =>
103-
props.logEntries.findIndex((entry) => entry === props.currentEntry),
104-
)
102+
const index = computed(() => props.logEntries.findIndex((entry) => entry === props.currentEntry))
105103
106104
/**
107105
* Formatted data of the entry
108106
*/
109-
const code = computed(
110-
() =>
111-
hljs.highlight(JSON.stringify(props.currentEntry, null, 2), { language: 'json' })
112-
.value,
113-
)
107+
const code = computed(() => hljs.highlight(JSON.stringify(props.currentEntry, null, 2), { language: 'json' })
108+
.value)
114109
115110
/**
116111
* Level as translated human readable string

src/components/exception/TraceLine.vue

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,12 @@ const props = defineProps<{
2828
/**
2929
* The fully qualified function name (including the class name)
3030
*/
31-
const functionText = computed(
32-
() => `${props.line.class}${props.line.type}${props.line.function}`,
33-
)
31+
const functionText = computed(() => `${props.line.class}${props.line.type}${props.line.function}`)
3432
3533
/**
3634
* The arguments of the function
3735
*/
38-
const argumentText = computed(
39-
() => (props.line.args || []).length === 0
36+
const argumentText = computed(() => (props.line.args || []).length === 0
4037
? '()'
4138
: (
4239
'(\n'
@@ -45,8 +42,7 @@ const argumentText = computed(
4542
.map((argument) => JSON.stringify(argument, undefined, 2).split('\n').map((code) => ` ${code}`).join('\n'))
4643
.join(',\n')
4744
+ '\n)'
48-
),
49-
)
45+
))
5046
</script>
5147

5248
<style lang="scss" scoped>

src/components/settings/SettingsLiveView.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ import { logger } from '../../utils/logger'
2828
const settingsStore = useSettingsStore()
2929
const liveLog = computed({
3030
get: () => settingsStore.enabled ? settingsStore.liveLog : false,
31-
set: (v: boolean) =>
32-
settingsStore
31+
set: (v: boolean) => settingsStore
3332
.setSetting('liveLog', v)
3433
.catch((e) => {
3534
logger.debug(e)

src/components/table/LogTable.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ async function loadMore() {
132132
if (sortedByTime.value === 'ascending') {
133133
const positionOfPreviousElement = logStore.entries.length - sizeBefore + 1 // ensure the loading row is not inside view
134134
const previousTopElement = tableBody.value?.querySelector(`tr:nth-of-type(${positionOfPreviousElement})`)
135-
if (previousTopElement) previousTopElement.scrollIntoView({ block: 'start' })
135+
if (previousTopElement) {
136+
previousTopElement.scrollIntoView({ block: 'start' })
137+
}
136138
}
137139
})
138140
}

src/components/table/LogTableHeader.vue

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,18 @@ const sortIcon = computed(() => {
8888
*/
8989
function changeSortMode() {
9090
switch (props.sorted) {
91-
case 'ascending': emit('update:sorted', 'descending'); break
92-
case 'descending': emit('update:sorted', ''); break
93-
case '': emit('update:sorted', 'ascending'); break
91+
case 'ascending': {
92+
emit('update:sorted', 'descending')
93+
break
94+
}
95+
case 'descending': {
96+
emit('update:sorted', '')
97+
break
98+
}
99+
case '': {
100+
emit('update:sorted', 'ascending')
101+
break
102+
}
94103
}
95104
}
96105

src/components/table/LogTableRow.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ function resizeTabeRow() {
167167
if (isExpanded.value) {
168168
nextTick(() => {
169169
const height = tableRowElement.value?.scrollHeight || 0
170-
if (tableRowElement.value) tableRowElement.value.style.height = `${height}px`
170+
if (tableRowElement.value) {
171+
tableRowElement.value.style.height = `${height}px`
172+
}
171173
})
172174
} else if (tableRowElement.value !== undefined) {
173175
tableRowElement.value.style.height = ''

src/store/logging.spec.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,9 @@ describe('store:logging', () => {
284284
})
285285

286286
// throw an error
287-
mocks.parseLogString.mockImplementationOnce(() => { throw new Error() })
287+
mocks.parseLogString.mockImplementationOnce(() => {
288+
throw new Error()
289+
})
288290

289291
const store = useLogStore()
290292
const settings = useSettingsStore()
@@ -621,7 +623,9 @@ describe('store:logging', () => {
621623
logger: mocks.logger,
622624
}
623625
})
624-
vi.mocked(mocks.pollLog).mockImplementationOnce(() => { throw Error() })
626+
vi.mocked(mocks.pollLog).mockImplementationOnce(() => {
627+
throw Error()
628+
})
625629

626630
// clean pinia
627631
createTestingPinia({
@@ -650,7 +654,9 @@ describe('store:logging', () => {
650654
logger: mocks.logger,
651655
}
652656
})
653-
vi.mocked(mocks.pollLog).mockImplementationOnce(() => { throw new ServerError() })
657+
vi.mocked(mocks.pollLog).mockImplementationOnce(() => {
658+
throw new ServerError()
659+
})
654660

655661
// clean pinia
656662
createTestingPinia({

src/store/logging.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,14 @@ export const useLogStore = defineStore('logreader-logs', () => {
6565
*/
6666
async function loadMore(older = true) {
6767
// Nothing to do if server logging is disabled
68-
if (!_settings.isEnabled) return
68+
if (!_settings.isEnabled) {
69+
return
70+
}
6971

7072
// Only load any entries if there is no previous unfinished request
71-
if (!(_loading.value = !_loading.value)) return
73+
if (!(_loading.value = !_loading.value)) {
74+
return
75+
}
7276

7377
try {
7478
if (older) {

0 commit comments

Comments
 (0)