Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: npm run format:fix #2456

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion playwright/support/fixtures/random-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import { createRandomUser, login } from '../utils/session'
export const test = base.extend({
page: async ({ browser, baseURL }, use) => {
// Important: make sure we authenticate in a clean environment by unsetting storage state.
const page = await browser.newPage({ storageState: undefined, baseURL })
const page = await browser.newPage({
storageState: undefined,
baseURL,
})

const uid = await createRandomUser()
await login(page.request, uid, uid)
Expand Down
4 changes: 3 additions & 1 deletion playwright/support/sections/QuestionSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export class QuestionSection {
public readonly page: Page,
public readonly section: Locator,
) {
this.titleInput = this.section.getByRole('textbox', { name: /title of/i })
this.titleInput = this.section.getByRole('textbox', {
name: /title of/i,
})
this.newAnswerInput = this.section.getByRole('textbox', {
name: 'Add a new answer',
})
Expand Down
9 changes: 7 additions & 2 deletions playwright/support/utils/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ export async function runShell(
*/
export async function runOCC(
command: string,
options?: { env?: Record<string, string | number>; rejectOnError?: boolean },
options?: {
env?: Record<string, string | number>
rejectOnError?: boolean
},
) {
return await runShell(`php ./occ ${command}`, {
...options,
Expand Down Expand Up @@ -109,6 +112,8 @@ export async function login(
*/
export async function createRandomUser(): Promise<string> {
const uid = (Math.random() + 1).toString(36).substring(7)
await runOCC(`user:add --password-from-env ${uid}`, { env: { OC_PASS: uid } })
await runOCC(`user:add --password-from-env ${uid}`, {
env: { OC_PASS: uid },
})
return uid
}
18 changes: 14 additions & 4 deletions src/Forms.vue
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,9 @@ export default {
)
this.allSharedForms = OcsResponse2Data(response)
} catch (error) {
logger.error('Error while loading shared forms list', { error })
logger.error('Error while loading shared forms list', {
error,
})
showError(
t('forms', 'An error occurred while loading the forms list'),
)
Expand Down Expand Up @@ -451,7 +453,10 @@ export default {
)
const newForm = OcsResponse2Data(response)
this.forms.unshift(newForm)
this.$router.push({ name: 'edit', params: { hash: newForm.hash } })
this.$router.push({
name: 'edit',
params: { hash: newForm.hash },
})
this.mobileCloseNavigation()
} catch (error) {
logger.error('Unable to create new form', { error })
Expand All @@ -467,11 +472,16 @@ export default {
async onCloneForm(id) {
try {
const response = await axios.post(
generateOcsUrl('apps/forms/api/v3/forms?fromId={id}', { id }),
generateOcsUrl('apps/forms/api/v3/forms?fromId={id}', {
id,
}),
)
const newForm = OcsResponse2Data(response)
this.forms.unshift(newForm)
this.$router.push({ name: 'edit', params: { hash: newForm.hash } })
this.$router.push({
name: 'edit',
params: { hash: newForm.hash },
})
this.mobileCloseNavigation()
} catch (error) {
logger.error(`Unable to copy form ${id}`, { error })
Expand Down
8 changes: 6 additions & 2 deletions src/components/AppNavigationForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,9 @@ export default {
if (this.form.expires) {
const relativeDate = moment(this.form.expires, 'X').fromNow()
if (this.isExpired) {
return t('forms', 'Expired {relativeDate}', { relativeDate })
return t('forms', 'Expired {relativeDate}', {
relativeDate,
})
}
return t('forms', 'Expires {relativeDate}', { relativeDate })
}
Expand Down Expand Up @@ -318,7 +320,9 @@ export default {
this.isArchived ? FormState.FormClosed : FormState.FormArchived,
)
} catch (error) {
logger.error('Error changing archived state of form', { error })
logger.error('Error changing archived state of form', {
error,
})
showError(t('forms', 'Error changing archived state of form'))
}
},
Expand Down
8 changes: 6 additions & 2 deletions src/components/QRDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
:src="uri"
:title="text"
:alt="
t('forms', 'QR code representation of {text}', { text: text })
t('forms', 'QR code representation of {text}', {
text: text,
})
" />
</div>
</NcDialog>
Expand Down Expand Up @@ -90,7 +92,9 @@ export default {
async generateQr() {
if (this.text) {
try {
this.uri = await QRCode.toDataURL(this.text, { width: 256 })
this.uri = await QRCode.toDataURL(this.text, {
width: 256,
})
} catch (err) {
console.error(err)
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/Questions/Question.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@
v-if="!readOnly"
:placeholder="titlePlaceholder"
:aria-label="
t('forms', 'Title of question number {index}', { index })
t('forms', 'Title of question number {index}', {
index,
})
"
:value="text"
class="question__header__title__text question__header__title__text__input"
Expand Down
4 changes: 3 additions & 1 deletion src/components/Questions/QuestionLong.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
<textarea
ref="textarea"
:aria-label="
t('forms', 'A long answer for the question “{text}”', { text })
t('forms', 'A long answer for the question “{text}”', {
text,
})
"
:placeholder="submissionInputPlaceholder"
:disabled="!readOnly"
Expand Down
4 changes: 3 additions & 1 deletion src/components/Questions/QuestionShort.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
<input
ref="input"
:aria-label="
t('forms', 'A short answer for the question “{text}”', { text })
t('forms', 'A short answer for the question “{text}”', {
text,
})
"
:placeholder="submissionInputPlaceholder"
:disabled="!readOnly"
Expand Down
4 changes: 3 additions & 1 deletion src/components/SidebarTabs/TransferOwnership.vue
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ export default {
)
emit('forms:ownership-transfered', this.form.id)
} catch (error) {
logger.error('Error while transfering form ownership', { error })
logger.error('Error while transfering form ownership', {
error,
})
showError(
t('forms', 'An error occurred while transfering ownership'),
)
Expand Down
4 changes: 3 additions & 1 deletion src/mixins/ViewsMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,14 @@
this.$emit('update:form', OcsResponse2Data(response))
this.isLoadingForm = false
} catch (error) {
if (axios.isCancel(error)) {

Check warning on line 162 in src/mixins/ViewsMixin.js

View workflow job for this annotation

GitHub Actions / NPM lint

Caution: `axios` also has a named export `isCancel`. Check if you meant to write `import {isCancel} from '@nextcloud/axios'` instead
logger.debug(`The request for form ${id} has been canceled`, {
error,
})
} else {
logger.error(`Unexpected error fetching form ${id}`, { error })
logger.error(`Unexpected error fetching form ${id}`, {
error,
})
this.isLoadingForm = false
}
} finally {
Expand Down
4 changes: 3 additions & 1 deletion src/views/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,9 @@ export default {
lastQuestion.focus()
})
} catch (error) {
logger.error(`Error while duplicating question ${id}`, { error })
logger.error(`Error while duplicating question ${id}`, {
error,
})
showError('There was an error while duplicating the question')
} finally {
this.isLoadingQuestions = false
Expand Down
4 changes: 3 additions & 1 deletion src/views/Results.vue
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,9 @@ export default {
}),
)
} catch (error) {
logger.error('Error while exporting to Files', { error })
logger.error('Error while exporting to Files', {
error,
})
showError(
t(
'forms',
Expand Down
4 changes: 3 additions & 1 deletion src/views/Submit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,9 @@ export default {
// Clean up answers for questions that do not exist anymore
if (!this.validQuestionsIds.has(parseInt(questionId))) {
this.showClearFormDueToChangeDialog = true
logger.debug('Question does not exist anymore', { questionId })
logger.debug('Question does not exist anymore', {
questionId,
})
continue
}

Expand Down
Loading