Skip to content

Commit

Permalink
style(lint): enable trailing commas
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantinos Maninakis <maninak@protonmail.com>
  • Loading branch information
maninak committed Jan 22, 2024
1 parent 9f3ce43 commit 3e69502
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/webviews/.prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"tabWidth": 2,
"singleQuote": true,
"printWidth": 95,
"trailingComma": "none",
"trailingComma": "all",
"htmlWhitespaceSensitivity": "strict"
}
18 changes: 9 additions & 9 deletions src/webviews/src/components/PatchDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
provideVSCodeDesignSystem,
vsCodeButton,
vsCodeDropdown,
vsCodeOption
vsCodeOption,
} from '@vscode/webview-ui-toolkit'
import { ref, computed } from 'vue'
import { storeToRefs } from 'pinia'
Expand All @@ -30,7 +30,7 @@ function getRevisionOptionLabel(revision: Revision): string {
revision.reviews.find((review) => review.verdict === 'accept') && 'accepted',
revision.reviews.find((review) => review.verdict === 'reject') && 'rejected',
patch.value.revisions.length >= 2 && revision.id === firstRevision.value.id && 'first',
patch.value.revisions.length >= 2 && revision.id === latestRevision.value.id && 'latest'
patch.value.revisions.length >= 2 && revision.id === latestRevision.value.id && 'latest',
].filter(Boolean)
const parsedState = state.length ? ` [${state.join(', ')}]` : ''
const author = authors.value.length >= 2 ? ` ${getIdentityAliasOrId(revision.author)}` : ''
Expand All @@ -43,26 +43,26 @@ const revisionOptionsMap = ref(
new Map(
[...patch.value.revisions]
.reverse()
.map((revision) => [getRevisionOptionLabel(revision), revision] as const)
)
.map((revision) => [getRevisionOptionLabel(revision), revision] as const),
),
)
// TODO: maninak if patch is merged pre-select revision that got merged
const selectedRevisionOption = ref(getRevisionOptionLabel(latestRevision.value))
const selectedRevision = computed(
() =>
revisionOptionsMap.value.get(selectedRevisionOption.value) as NonNullable<
ReturnType<(typeof revisionOptionsMap)['value']['get']>
>
>,
)
const shouldHideRevisionDescription = computed(
() =>
selectedRevision.value.description && selectedRevision.value.id === firstRevision.value.id
selectedRevision.value.description && selectedRevision.value.id === firstRevision.value.id,
)
const selectedRevisionAcceptedReviews = computed(() =>
selectedRevision.value.reviews.filter((review) => review.verdict === 'accept')
selectedRevision.value.reviews.filter((review) => review.verdict === 'accept'),
)
const selectedRevisionRejectedReviews = computed(() =>
selectedRevision.value.reviews.filter((review) => review.verdict === 'reject')
selectedRevision.value.reviews.filter((review) => review.verdict === 'reject'),
)
function refetchPatchData() {
Expand Down Expand Up @@ -169,7 +169,7 @@ This is a patch description parsed from Markdown:
@click="
notifyExtension({
command: 'copyToClipboardAndNotify',
payload: { textToCopy: selectedRevision.id }
payload: { textToCopy: selectedRevision.id },
})
"
>
Expand Down
4 changes: 2 additions & 2 deletions src/webviews/src/components/PatchMajorEvents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ const { patch, firstRevision, latestRevision } = storeToRefs(usePatchDetailStore
// TODO: maninak show `accepted` review as major event, if the related revision got accepted?
const latestMerge = computed(() =>
[...patch.value.merges].sort((m1, m2) => m1.timestamp - m2.timestamp).at(-1)
[...patch.value.merges].sort((m1, m2) => m1.timestamp - m2.timestamp).at(-1),
)
const shouldShowRevisionEvent = computed(() => patch.value.revisions.length >= 2)
const createdTimeAgo = computedWithControl(firstRevision, () =>
getTimeAgo(firstRevision.value.timestamp)
getTimeAgo(firstRevision.value.timestamp),
)
// Somehow this useIntervalFn() triggers re-rendering of the whole component including
// re-calculation of all other `getTimeAgo()` calls too.
Expand Down
2 changes: 1 addition & 1 deletion src/webviews/src/components/PatchMetadata.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const { patch, authors } = storeToRefs(usePatchDetailStore())
@click="
notifyExtension({
command: 'copyToClipboardAndNotify',
payload: { textToCopy: patch.id }
payload: { textToCopy: patch.id },
})
"
>
Expand Down
2 changes: 1 addition & 1 deletion src/webviews/src/components/TheCounter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const { increment, reset } = counterStore
function showInfoNotifWithCount() {
notifyExtension({
command: 'showInfoNotification',
payload: { text: `The count is: ${count.value}` }
payload: { text: `The count is: ${count.value}` },
})
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/webviews/src/stores/counter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const useCounterStore = defineStore('counter', () => {
const message = event.data

message.command === 'resetCount' && reset()
}
},
)

return { count, doubleCount, increment, reset }
Expand Down
6 changes: 3 additions & 3 deletions src/webviews/src/stores/patchDetailStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export const usePatchDetailStore = defineStore('patch-detail', () => {
uniqueAuthors.find((uniqueAuthor) => uniqueAuthor.id === maybeUniqueAuthor.id)
? uniqueAuthors
: [...uniqueAuthors, maybeUniqueAuthor],
[] as Patch['author'][]
)
[] as Patch['author'][],
),
)

watchEffect(() => {
Expand All @@ -43,7 +43,7 @@ export const usePatchDetailStore = defineStore('patch-detail', () => {
if (message.command === 'updateState') {
state.value = message.payload
}
}
},
)

return { patch, firstRevision, latestRevision, authors }
Expand Down

0 comments on commit 3e69502

Please sign in to comment.