From d835e2f92847075fb97448c11ed9d37eb46c3a85 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 May 2021 16:52:45 -0700 Subject: [PATCH] Bump prettier from 2.2.1 to 2.3.0 in /frontend (#453) Bumps [prettier](https://github.com/prettier/prettier) from 2.2.1 to 2.3.0. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.2.1...2.3.0) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- frontend/locales/en.ts | 6 ++---- frontend/package.json | 2 +- frontend/pages/new.vue | 4 ++-- frontend/plugins/api.ts | 2 +- frontend/plugins/utils.ts | 24 ++++++++++++++++-------- frontend/store/index.ts | 12 ++++++------ frontend/utils/perms.ts | 18 ++++++++++-------- frontend/yarn.lock | 8 ++++---- 8 files changed, 42 insertions(+), 34 deletions(-) diff --git a/frontend/locales/en.ts b/frontend/locales/en.ts index c17e03745..845240f62 100644 --- a/frontend/locales/en.ts +++ b/frontend/locales/en.ts @@ -143,8 +143,7 @@ const msgs: LocaleMessageObject = { new: { step1: { title: 'User Agreement', - text: - 'A project contains your downloads and the documentation for your plugin.
Before continuing, please review the Hangar Submission Guidelines.', + text: 'A project contains your downloads and the documentation for your plugin.
Before continuing, please review the Hangar Submission Guidelines.', continue: 'Agree', back: 'Abort', }, @@ -541,8 +540,7 @@ const msgs: LocaleMessageObject = { }, visibility: { notice: { - new: - 'This project is new, and will not be shown to others until a version has been uploaded. If a version is not uploaded over a longer time the project will be deleted.', + new: 'This project is new, and will not be shown to others until a version has been uploaded. If a version is not uploaded over a longer time the project will be deleted.', needsChanges: 'This project requires changes', needsApproval: 'You have sent the project for review', softDelete: 'Project deleted by {0}', diff --git a/frontend/package.json b/frontend/package.json index 22f0dcdc7..58e302e5a 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -52,7 +52,7 @@ "fibers": "5.0.0", "husky": "6.0.0", "lint-staged": "11.0.0", - "prettier": "2.2.1", + "prettier": "2.3.0", "sass": "1.32.13", "sass-loader": "10.1.1", "typescript": "4.2.4", diff --git a/frontend/pages/new.vue b/frontend/pages/new.vue index 06489d16a..6ab1177e8 100644 --- a/frontend/pages/new.vue +++ b/frontend/pages/new.vue @@ -312,11 +312,11 @@ export default class NewProjectPage extends HangarComponent { error = null as string | null; form: NewProjectForm = { category: ProjectCategory.ADMIN_TOOLS, - settings: ({ + settings: { license: {} as ProjectSettingsForm['settings']['license'], donation: {} as ProjectSettingsForm['settings']['donation'], keywords: [], - } as unknown) as ProjectSettingsForm['settings'], + } as unknown as ProjectSettingsForm['settings'], } as NewProjectForm; nameErrors: TranslateResult[] = []; diff --git a/frontend/plugins/api.ts b/frontend/plugins/api.ts index 553ef5be3..2ddfbc1fd 100644 --- a/frontend/plugins/api.ts +++ b/frontend/plugins/api.ts @@ -128,7 +128,7 @@ const createApi = ({ $axios, store, app: { $cookies } }: Context) => { if (headers['set-cookie']) { const statString = headers['set-cookie'].find((c: string) => c.startsWith('hangar_stats')); if (statString) { - const statCookie: StatCookie = (Cookie.parse(statString) as unknown) as StatCookie; + const statCookie: StatCookie = Cookie.parse(statString) as unknown as StatCookie; $cookies.set('hangar_stats', statCookie.hangar_stats, { path: statCookie.Path, expires: new Date(statCookie.Expires), diff --git a/frontend/plugins/utils.ts b/frontend/plugins/utils.ts index 8840ab72a..fef259259 100644 --- a/frontend/plugins/utils.ts +++ b/frontend/plugins/utils.ts @@ -63,7 +63,7 @@ function collectErrors(exception: HangarApiException | MultiHangarApiException, const createUtil = ({ store, error, app: { i18n } }: Context) => { class Util { dummyUser(): HangarUser { - return ({ + return { name: 'Dummy', id: 42, tagline: null, @@ -77,11 +77,11 @@ const createUtil = ({ store, error, app: { i18n } }: Context) => { unresolvedFlags: 2, }, joinDate: this.prettyDate(new Date()), - } as unknown) as HangarUser; + } as unknown as HangarUser; } dummyProject(): HangarProject { - return ({ namespace: { owner: 'test', slug: 'test2' }, visibility: Visibility.NEW } as unknown) as HangarProject; + return { namespace: { owner: 'test', slug: 'test2' }, visibility: Visibility.NEW } as unknown as HangarProject; } avatarUrl(name: string): string { @@ -239,7 +239,10 @@ const createUtil = ({ store, error, app: { i18n } }: Context) => { } $vc = { - require: (name: TranslateResult = 'Field') => (v: string) => !!v || i18n.t('validation.required', [name]), + require: + (name: TranslateResult = 'Field') => + (v: string) => + !!v || i18n.t('validation.required', [name]), maxLength: (maxLength: number) => (v: string | any[]) => { return ( ((v === null || typeof v === 'undefined' || typeof v === 'string') && !v) || @@ -256,11 +259,16 @@ const createUtil = ({ store, error, app: { i18n } }: Context) => { i18n.t('validation.minLength', [minLength]) ); }, - requireNonEmptyArray: (name: TranslateResult = 'Field') => (v: any[]) => v.length > 0 || i18n.t('validation.required', [name]), + requireNonEmptyArray: + (name: TranslateResult = 'Field') => + (v: any[]) => + v.length > 0 || i18n.t('validation.required', [name]), url: (v: string) => !v || new RegExp((store.state as RootState).validations.urlRegex).test(v) || i18n.t('validation.invalidUrl'), - regex: (name: TranslateResult = 'Field', regexp: string) => (v: string) => { - return !v || new RegExp(regexp).test(v) || i18n.t('validation.invalidFormat', [name]); - }, + regex: + (name: TranslateResult = 'Field', regexp: string) => + (v: string) => { + return !v || new RegExp(regexp).test(v) || i18n.t('validation.invalidFormat', [name]); + }, requireNumberArray: () => (v: string | any[]) => { return ( ((v === null || typeof v === 'undefined' || typeof v === 'string') && !v) || diff --git a/frontend/store/index.ts b/frontend/store/index.ts index 82ccc7dee..372b00cfa 100644 --- a/frontend/store/index.ts +++ b/frontend/store/index.ts @@ -35,11 +35,11 @@ export interface RootState { } export const state: () => RootState = () => ({ - projectCategories: (null as unknown) as Map, - permissions: (null as unknown) as Map, - platforms: (null as unknown) as Map, - validations: (null as unknown) as RootState['validations'], - prompts: (null as unknown) as RootState['prompts'], + projectCategories: null as unknown as Map, + permissions: null as unknown as Map, + platforms: null as unknown as Map, + validations: null as unknown as RootState['validations'], + prompts: null as unknown as RootState['prompts'], }); export const mutations: MutationTree = { @@ -107,7 +107,7 @@ export const getters: GetterTree = { function convertToMap(values: T[], toStringFunc: (value: T) => string): Map { const map = new Map(); for (const value of values) { - const key: E = (toStringFunc(value) as unknown) as E; + const key: E = toStringFunc(value) as unknown as E; if (key == null) { throw new Error('Could not find an enum for ' + value); } diff --git a/frontend/utils/perms.ts b/frontend/utils/perms.ts index ade6937ea..7f65087cf 100644 --- a/frontend/utils/perms.ts +++ b/frontend/utils/perms.ts @@ -3,14 +3,16 @@ import { PermissionCheck } from 'hangar-api'; import { NamedPermission, PermissionType } from '~/types/enums'; import { AuthState } from '~/store/auth'; -const loggedInMiddleware = (code: number, msg?: string): Middleware => ({ store, error }: Context) => { - if (!store.state.auth.authenticated) { - error({ - message: msg, - statusCode: code, - }); - } -}; +const loggedInMiddleware = + (code: number, msg?: string): Middleware => + ({ store, error }: Context) => { + if (!store.state.auth.authenticated) { + error({ + message: msg, + statusCode: code, + }); + } + }; export function NotLoggedIn(constructor: Function) { addMiddleware(constructor, ({ store, redirect }) => { diff --git a/frontend/yarn.lock b/frontend/yarn.lock index 9387f041e..c3fa5f4a6 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -8369,10 +8369,10 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" - integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== +prettier@2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.0.tgz#b6a5bf1284026ae640f17f7ff5658a7567fc0d18" + integrity sha512-kXtO4s0Lz/DW/IJ9QdWhAf7/NmPWQXkFr/r/WkR3vyI+0v8amTDxiaQSLzs8NBlytfLWX/7uQUMIW677yLKl4w== prettier@^1.18.2: version "1.19.1"