Skip to content

Commit

Permalink
Better lint
Browse files Browse the repository at this point in the history
  • Loading branch information
bcspragu committed Oct 5, 2023
1 parent dce0bc2 commit bb28933
Show file tree
Hide file tree
Showing 27 changed files with 92 additions and 92 deletions.
4 changes: 2 additions & 2 deletions frontend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/strict-boolean-expressions": 0,
"@typescript-eslint/promise-function-async": 0,
"comma-dangle": 0,
"@typescript-eslint/comma-dangle": 0
"comma-dangle": "off",
"@typescript-eslint/comma-dangle": ["error", "always-multiline" ]
},
"overrides": [
{
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/IconButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const props = withDefaults(defineProps<Props>(), {
buttonClass: undefined,
buttonStyle: undefined,
tooltipClass: undefined,
offlineSafe: undefined
offlineSafe: undefined,
})
const tt = computed(() => {
const result = { value: props.alt, class: props.tooltipClass }
Expand Down
12 changes: 6 additions & 6 deletions frontend/components/LinkButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const props = withDefaults(defineProps<Props>(), {
badge: undefined,
badgeClass: undefined,
loading: undefined,
loadingIcon: 'pi pi-spinner pi-spin'
loadingIcon: 'pi pi-spinner pi-spin',
})
const attrs = useAttrs()
Expand All @@ -58,8 +58,8 @@ const iconStyleClass = computed(() => {
'p-button-icon-left': props.iconPos === 'left' && props.label,
'p-button-icon-right': props.iconPos === 'right' && props.label,
'p-button-icon-top': props.iconPos === 'top' && props.label,
'p-button-icon-bottom': props.iconPos === 'bottom' && props.label
}
'p-button-icon-bottom': props.iconPos === 'bottom' && props.label,
},
]
})
Expand All @@ -68,8 +68,8 @@ const badgeStyleClass = computed(() => {
'p-badge p-component',
props.badgeClass,
{
'p-badge-no-gutter': props.badge !== undefined && props.badge.length === 1
}
'p-badge-no-gutter': props.badge !== undefined && props.badge.length === 1,
},
]
})
Expand All @@ -96,7 +96,7 @@ const buttonClass = computed(() => {
'p-button-loading': props.loading,
'p-button-loading-label-only': props.loading !== undefined && props.icon === undefined && props.label !== undefined,
'no-underline': true,
'click-does-nothing': disabled.value
'click-does-nothing': disabled.value,
}
})
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/RMILogo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface Props {
}
const props = withDefaults(defineProps<Props>(), {
layout: 'horizontal',
background: 'blue'
background: 'blue',
})
</script>

Expand Down
2 changes: 1 addition & 1 deletion frontend/components/form/Field.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const props = withDefaults(defineProps<Props>(), {
completed: false,
requiredLabel: 'Required',
loadingLabel: 'Loading...',
completedLabel: ''
completedLabel: '',
})
const slots = useSlots()
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/modal/Error.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ interface Props {
}
const props = withDefaults(defineProps<Props>(), {
routeBackOnClose: false
routeBackOnClose: false,
})
const { error: { errorModalVisible, error: modalError } } = useModal()
Expand All @@ -29,7 +29,7 @@ const fullError = computed(() => {
return {
name: err.name ?? '',
message: err.message,
stack: err.stack?.split('\n')
stack: err.stack?.split('\n'),
}
} else if (err) {
return err
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/pactaversion/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const emit = defineEmits<(e: 'update:pactaVersion', pactaVersion: PactaVersion)
const model = computed({
get: () => props.pactaVersion,
set: (pactaVersion: PactaVersion) => { emit('update:pactaVersion', pactaVersion) }
set: (pactaVersion: PactaVersion) => { emit('update:pactaVersion', pactaVersion) },
})
</script>

Expand Down
4 changes: 2 additions & 2 deletions frontend/components/standard/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const props = withDefaults(defineProps<{
subHeader?: string
}>(), {
small: false,
subHeader: ''
subHeader: '',
})
const emit = defineEmits<{
Expand All @@ -18,7 +18,7 @@ const emit = defineEmits<{
const visible = computed<boolean>({
get: () => props.visible,
set: (value) => { emit('update:visible', value) }
set: (value) => { emit('update:visible', value) },
})
const breakpoints = computed(() => props.small ? smallDialogBreakpoints : dialogBreakpoints)
Expand Down
14 changes: 7 additions & 7 deletions frontend/components/standard/Nav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,36 @@ const menuStyles = computed(() => {
overflow: 'hidden',
'max-height': menuHidden.value ? '0px' : '100vh',
border: menuHidden.value ? undefined : '2px solid',
'margin-top': menuHidden.value ? '0' : '-2px'
'margin-top': menuHidden.value ? '0' : '-2px',
}
})
const menuItems = computed(() => {
const result: MenuItem[] = [
{
to: '/',
label: 'Home'
label: 'Home',
},
{
to: 'https://github.com/RMI-PACTA/app/issues/new',
label: 'File a Bug'
}
label: 'File a Bug',
},
]
if (showStandardDebug) {
result.push({
label: 'Admin',
to: '/admin'
to: '/admin',
})
}
if (isAuthenticated.value) {
result.push({
label: 'Sign Out',
command: () => { void signOut() }
command: () => { void signOut() },
})
} else {
result.push({
label: 'Sign In',
command: () => { void signIn() }
command: () => { void signIn() },
})
}
return result
Expand Down
8 changes: 4 additions & 4 deletions frontend/composables/newModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ export const useModal = () => {
stopLoading,
clearLoading,
loading,
loadingSet
loadingSet,
},
error: {
error,
errorModalVisible
errorModalVisible,
},
permissionDenied: {
permissionDeniedVisible,
permissionDeniedError,
setPermissionDenied
}
setPermissionDenied,
},
}
}
10 changes: 5 additions & 5 deletions frontend/composables/useAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const useAPI = (): API => {
const { public: { apiServerURL, authServerURL } } = useRuntimeConfig()
const baseCfg = {
CREDENTIALS: 'include' as const, // To satisfy typing of 'include' | 'same-origin' | etc
WITH_CREDENTIALS: true
WITH_CREDENTIALS: true,
}

// If we're on the server, forward our cookie header along to the backend
Expand All @@ -24,14 +24,14 @@ export const useAPI = (): API => {

const userCfg = {
...baseCfg,
BASE: authServerURL
BASE: authServerURL,
}
const userClient = new UserClient(userCfg)

const pactaClient = new PACTAClient({
...baseCfg,
BASE: apiServerURL,
HEADERS: headers
HEADERS: headers,
})

return {
Expand All @@ -40,9 +40,9 @@ export const useAPI = (): API => {
userClientWithCustomToken: (tkn: string) => {
const newCfg = {
...userCfg,
TOKEN: tkn
TOKEN: tkn,
}
return new UserClient(newCfg).default
}
},
}
}
10 changes: 5 additions & 5 deletions frontend/composables/useLocalStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const useLocalStorage = () => {
localStorage.setItem(key, value)
}
state.value = value
}
},
})
}

Expand All @@ -38,7 +38,7 @@ export const useLocalStorage = () => {
const stringState = computedStringLocalStorageValue('bool:' + key, `${defaultValue}`)
return computed({
get: () => stringState.value === 'true',
set: (value: boolean) => { stringState.value = `${value}` }
set: (value: boolean) => { stringState.value = `${value}` },
})
}

Expand All @@ -49,7 +49,7 @@ export const useLocalStorage = () => {
const s = stringState.value
return s ? new Date(s) : defaultValue
},
set: (d: Date) => { stringState.value = d.toString() }
set: (d: Date) => { stringState.value = d.toString() },
})
}

Expand All @@ -62,7 +62,7 @@ export const useLocalStorage = () => {
},
set: (s: Set<string>) => {
stringState.value = JSON.stringify([...s])
}
},
})
}

Expand All @@ -89,6 +89,6 @@ export const useLocalStorage = () => {
helpTextExpanded,
showStandardDebug,
deviceId,
getDeviceId
getDeviceId,
}
}
12 changes: 6 additions & 6 deletions frontend/composables/useMSAL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const useMSAL = async (): Promise<MSAL> => {
signIn: async () => { await Promise.reject(new Error('cannot call signIn on server')) },
signOut: async () => { await Promise.reject(new Error('cannot call signOut on server')) },
createAPIKey: async () => await Promise.reject(new Error('cannot call createAPIKey on server')),
isAuthenticated: computed(() => isAuthenticated.value)
isAuthenticated: computed(() => isAuthenticated.value),
}
}

Expand Down Expand Up @@ -106,7 +106,7 @@ export const useMSAL = async (): Promise<MSAL> => {
const request: SilentRequest = {
scopes: [],
forceRefresh: false, // Set this to "true" to skip a cached token and go to the server to get a new token
account: instance.getAccountByHomeId(account.value.homeAccountId) ?? undefined
account: instance.getAccountByHomeId(account.value.homeAccountId) ?? undefined,
}

const response = await instance.acquireTokenSilent(request)
Expand All @@ -127,7 +127,7 @@ export const useMSAL = async (): Promise<MSAL> => {
const request: SilentRequest = {
scopes: [],
forceRefresh: false, // Set this to "true" to skip a cached token and go to the server to get a new token
account: instance.getAccountByHomeId(account.value.homeAccountId) ?? undefined
account: instance.getAccountByHomeId(account.value.homeAccountId) ?? undefined,
}

try {
Expand Down Expand Up @@ -161,13 +161,13 @@ export const useMSAL = async (): Promise<MSAL> => {
const signOut = async (): Promise<void> => {
const logoutRequest = {
postLogoutRedirectUri: msalConfig.auth.redirectUri,
mainWindowRedirectUri: msalConfig.auth.logoutUri
mainWindowRedirectUri: msalConfig.auth.logoutUri,
}
const userClient = userClientWithCustomToken('') // Logging out doesn't require auth.
try {
await Promise.all([
userClient.logout(),
instance.logoutPopup(logoutRequest)
instance.logoutPopup(logoutRequest),
])
} catch (e) {
console.log('failed to log out', e)
Expand Down Expand Up @@ -218,6 +218,6 @@ export const useMSAL = async (): Promise<MSAL> => {
signIn,
signOut,
createAPIKey,
isAuthenticated: computed(() => isAuthenticated.value)
isAuthenticated: computed(() => isAuthenticated.value),
}
}
6 changes: 3 additions & 3 deletions frontend/composables/useSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const useSession = () => {
// the single-lookup behavior above. This cast is safe.
me: currentUser as Ref<User>,
isAdmin,
isSuperAdmin
isSuperAdmin,
}
}
const getMaybeMe = async () => {
Expand All @@ -55,14 +55,14 @@ export const useSession = () => {
// Will be a Ref with a value of undefined if the user isn't logged in.
maybeMe: currentUser,
isAdmin,
isSuperAdmin
isSuperAdmin,
}
}

return {
signedIn,
getMe,
getMaybeMe,
currentUser
currentUser,
}
}
2 changes: 1 addition & 1 deletion frontend/composables/useStateIDGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export const useStateIDGenerator = () => {
id: (): string => {
nextId.value = nextId.value + 1
return `${nextId.value}`
}
},
}
}
4 changes: 2 additions & 2 deletions frontend/composables/useURLParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ export const useURLParams = () => {
fromQueryReactive: (key: string): WritableComputedRef<string | undefined> => {
return computed({
get: () => getVal(router.currentRoute.value.query, key),
set: (val: string | undefined) => { setVal(key, val) }
set: (val: string | undefined) => { setVal(key, val) },
})
},
fromParams: (key: string): string | undefined => {
return getVal(route.params, key)
}
},
}
}
4 changes: 2 additions & 2 deletions frontend/globalimports/present.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ export const present = <T>(t: T | undefined | null, r: Remediation, cause?: stri
throw createErrorWithRemediation({
name: 'present error',
message: 'expected to be present but was undefined',
cause
cause,
}, r)
}
if (t === null) {
throw createErrorWithRemediation({
name: 'present error',
message: 'expected to be present but was null',
cause
cause,
}, r)
}
return t
Expand Down
Loading

0 comments on commit bb28933

Please sign in to comment.