Skip to content

Commit

Permalink
Package updates
Browse files Browse the repository at this point in the history
  • Loading branch information
RISCfuture committed Sep 3, 2024
1 parent 4f0e78a commit 0e4c548
Show file tree
Hide file tree
Showing 18 changed files with 2,184 additions and 3,970 deletions.
7 changes: 6 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = {
}
},
rules: {
'@typescript-eslint/no-duplicate-enum-values': 'off', // seems to have a bug
'arrow-parens': ['error', 'as-needed'],
'class-methods-use-this': 'off',
'comma-dangle': ['error', 'never'],
Expand All @@ -32,6 +33,7 @@ module.exports = {
'no-shadow': 'off',
'no-undef': 'off',
'no-useless-constructor': 'off',
'vue/max-len': 'off',
'vue/script-indent': ['error', 2, { baseIndent: 1 }],
'vuejs-accessibility/label-has-for': ['error', { required: { some: ['nesting', 'id'] } }],
'vuejs-accessibility/no-static-element-interactions': 'off',
Expand All @@ -47,7 +49,10 @@ module.exports = {
{
files: ['.ts', '.tsx'],
rules: {
'@typescript-eslint/consistent-type-assertions': ['error', { assertionStyle: 'angle-bracket' }],
'@typescript-eslint/consistent-type-assertions': [
'error',
{ assertionStyle: 'angle-bracket' }
],
'@typescript-eslint/no-loss-of-precision': 'off',
'@typescript-eslint/no-non-null-assertion': 'off'
},
Expand Down
Empty file removed .yarn/releases/.gitkeep
Empty file.
894 changes: 0 additions & 894 deletions .yarn/releases/yarn-4.3.0.cjs

This file was deleted.

2 changes: 0 additions & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.3.0.cjs
66 changes: 33 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
"ci:e2e": "npx start-server-and-test ci:e2e:start-server 5100 ci:e2e:run"
},
"dependencies": {
"@bugsnag/core": "^7.22.7",
"@bugsnag/js": "^7.23.0",
"@bugsnag/plugin-vue": "^7.22.7",
"@bugsnag/core": "^8.0.0",
"@bugsnag/js": "^8.0.0",
"@bugsnag/plugin-vue": "^8.0.0",
"@popperjs/core": "^2.11.8",
"actioncable": "5.2.8-1",
"@rails/actioncable": "^7.2.100",
"bootstrap": "^4",
"bootstrap-vue": "^2.23.1",
"bootswatch": "^5.3.3",
"core-js": "^3.37.1",
"core-js": "^3.38.1",
"jquery": "^3.7.1",
"lodash-es": "^4.17.21",
"luxon": "^3.4.4",
"luxon": "^3.5.0",
"numeral": "^2.0.6",
"popper.js": "^1.16.1",
"query-string": "^9.0.0",
"query-string": "^9.1.0",
"slugify": "^1.6.6",
"ts-results": "^3.3.0",
"vue": "^2",
Expand All @@ -40,23 +40,23 @@
"vuex-class": "^0.3.2"
},
"devDependencies": {
"@babel/core": "^7.24.7",
"@babel/preset-env": "^7.24.7",
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.4",
"@cypress/webpack-preprocessor": "^6.0.2",
"@types/actioncable": "^5.2.11",
"@types/chai": "^4.3.16",
"@types/chai-as-promised": "^7.1.8",
"@types/chai": "^4.3.19",
"@types/chai-as-promised": "^8.0.0",
"@types/deep-equal-in-any-order": "^1.0.3",
"@types/lodash-es": "^4.17.12",
"@types/luxon": "^3.4.2",
"@types/mocha": "^10.0.6",
"@types/mocha": "^10.0.7",
"@types/numeral": "^2.0.5",
"@types/query-string": "^6.3.0",
"@types/rails__actioncable": "^6.1.11",
"@types/sinon": "^17.0.3",
"@types/sinon-chai": "^3.2.12",
"@types/webpack-env": "^1.18.5",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"@typescript-eslint/eslint-plugin": "^8.4.0",
"@typescript-eslint/parser": "^8.4.0",
"@vue/cli-plugin-babel": "^5.0.8",
"@vue/cli-plugin-e2e-cypress": "^5.0.8",
"@vue/cli-plugin-eslint": "^5.0.8",
Expand All @@ -73,28 +73,28 @@
"chai-as-promised": "^8.0.0",
"chai-each": "^0.0.1",
"compression-webpack-plugin": "^11.1.0",
"cypress": "^13.12.0",
"cypress": "^13.14.1",
"cypress-file-upload": "^5.0.8",
"deep-equal-in-any-order": "^2.0.6",
"eslint": "^8",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-chai-expect": "^3.1.0",
"eslint-plugin-chai-friendly": "^1.0.0",
"eslint-plugin-cypress": "^3.3.0",
"eslint-plugin-chai-friendly": "^1.0.1",
"eslint-plugin-cypress": "^3.5.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-mocha": "^10.4.3",
"eslint-plugin-vue": "^9.26.0",
"eslint-plugin-vuejs-accessibility": "^2.3.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.7",
"msw": "^2.3.1",
"eslint-plugin-mocha": "^10.5.0",
"eslint-plugin-vue": "^9.27.0",
"eslint-plugin-vuejs-accessibility": "^2.4.1",
"husky": "^9.1.5",
"lint-staged": "^15.2.10",
"msw": "<2.4",
"null-loader": "^4.0.1",
"postcss": "^8.4.38",
"postcss": "^8.4.44",
"postcss-html": "^1.7.0",
"sass": "^1.77.6",
"sass-loader": "^14.2.1",
"sass": "^1.77.8",
"sass-loader": "^16.0.1",
"sinon": "^18.0.0",
"sinon-chai": "^3.7.0",
"sinon-chai": "^3",
"stylelint": "^15",
"stylelint-config-recommended": "^13",
"stylelint-config-recommended-scss": "^13",
Expand All @@ -103,10 +103,10 @@
"stylelint-processor-html": "^1.0.0",
"stylelint-webpack-plugin": "^5.0.1",
"ts-loader": "^9.5.1",
"typedoc": "^0.25.13",
"typescript": "^5.4.5",
"typedoc": "^0.26.6",
"typescript": "^5.5.4",
"vue-template-compiler": "^2.7.16",
"webpack": "^5.92.1"
"webpack": "^5.94.0"
},
"packageManager": "yarn@4.3.0"
"packageManager": "yarn@4.4.0+sha512.91d93b445d9284e7ed52931369bc89a663414e5582d00eea45c67ddc459a2582919eece27c412d6ffd1bd0793ff35399381cb229326b961798ce4f4cc60ddfdb"
}
4 changes: 2 additions & 2 deletions src/shims-tsx.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable @typescript-eslint/no-empty-object-type */

import Vue, { VNode } from 'vue'

declare global {
namespace JSX {
// tslint:disable no-empty-interface
interface Element extends VNode {}
// tslint:disable no-empty-interface
interface ElementClass extends Vue {}
interface IntrinsicElements {
[elem: string]: any;
Expand Down
6 changes: 3 additions & 3 deletions src/store/modules/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
} from 'vuex'
import { assign, isNull } from 'lodash-es'
import { Result } from 'ts-results'
import * as ActionCable from 'actioncable'
import queryString from 'query-string'
import { Consumer, createConsumer } from '@rails/actioncable'
import { AuthState, RootState } from '@/store/types'
import secrets from '@/config/secrets'
import {
Expand Down Expand Up @@ -52,10 +52,10 @@ const getters: GetterTree<AuthState, RootState> = {
return payload.u
},

actionCableConsumer(state): ActionCable.Cable | null {
actionCableConsumer(state): Consumer | null {
if (isNull(state.JWT)) return null
const URL = `${secrets.actionCableURL}?${queryString.stringify({ jwt: state.JWT })}`
return ActionCable.createConsumer(URL)
return createConsumer(URL)
},

authHeader(state): string | null {
Expand Down
36 changes: 19 additions & 17 deletions src/store/modules/logfiles.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/* eslint-disable no-shadow */

import * as ActionCable from 'actioncable'
import {
ActionContext, ActionTree, Dispatch, GetterTree, Module, MutationTree
} from 'vuex'
import { isNull } from 'lodash-es'
import { Ok, Result } from 'ts-results'
import Bugsnag from '@bugsnag/js'
import { Consumer, Subscription } from '@rails/actioncable'
import { Logfile, LogfileState } from '@/types'
import {
APIResponse, Errors, LogfilesState, RootState
} from '@/store/types'
import { logfileFromJSON, LogfileJSON } from '@/store/coding'
import { loadResponseBodyOrReturnErrors, loadResponseBodyOrThrowError } from '@/store/utils'

let logfilesSubscription: ActionCable.Channel | null = null
let logfilesSubscription: Subscription

function createLogfilesSubscription(consumer: ActionCable.Cable, dispatch: Dispatch) {
function createLogfilesSubscription(consumer: Consumer, dispatch: Dispatch) {
if (logfilesSubscription) logfilesSubscription.unsubscribe()
logfilesSubscription = consumer.subscriptions.create({
channel: 'LogfilesChannel'
Expand All @@ -36,7 +36,6 @@ export function state(): LogfilesState {
}

const getters: GetterTree<LogfilesState, RootState> = {

/** @return Whether the list of Logfiles has finished loading. */
logfilesLoaded(state): boolean {
return !isNull(state.logfiles) && !state.logfilesLoading && isNull(state.logfilesError)
Expand Down Expand Up @@ -89,10 +88,7 @@ const mutations: MutationTree<LogfilesState> = {

let logfiles
if (logfileJSON['destroyed?']) {
logfiles = [
...state.logfiles.slice(0, index - 1),
...state.logfiles.slice(index + 1)
]
logfiles = [...state.logfiles.slice(0, index - 1), ...state.logfiles.slice(index + 1)]
} else {
logfiles = [
...state.logfiles.slice(0, index - 1),
Expand All @@ -106,22 +102,25 @@ const mutations: MutationTree<LogfilesState> = {
}

const actions: ActionTree<LogfilesState, RootState> = {

/**
* Loads the list of unfinished Logfiles for the logged-in squadron.
*/

async loadLogfiles(
{
commit, dispatch, getters, rootGetters
}: ActionContext<LogfilesState, RootState>
): Promise<void> {
async loadLogfiles({
commit,
dispatch,
getters,
rootGetters
}: ActionContext<LogfilesState, RootState>): Promise<void> {
if (getters.logfilesLoading) return

try {
commit('START_LOGFILES')
const result: APIResponse<LogfileJSON[]> = await dispatch('requestJSON', { path: '/squadron/logfiles.json' })
const logfiles = loadResponseBodyOrThrowError(result).map(logfile => logfileFromJSON(logfile))
const result: APIResponse<LogfileJSON[]> = await dispatch('requestJSON', {
path: '/squadron/logfiles.json'
})
const logfiles = loadResponseBodyOrThrowError(result).map(logfile =>
logfileFromJSON(logfile))
commit('FINISH_LOGFILES', { logfiles })

if (rootGetters.actionCableConsumer) {
Expand Down Expand Up @@ -174,6 +173,9 @@ const actions: ActionTree<LogfilesState, RootState> = {
}

const logfiles: Module<LogfilesState, RootState> = {
state, getters, mutations, actions
state,
getters,
mutations,
actions
}
export default logfiles
36 changes: 14 additions & 22 deletions src/store/modules/passes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from 'lodash-es'
import { Ok, Result } from 'ts-results'
import Bugsnag from '@bugsnag/js'
import ActionCable from 'actioncable'
import { Consumer, Subscription } from '@rails/actioncable'
import {
APIResponse, Errors, PassesState, RootState
} from '@/store/types'
Expand All @@ -31,9 +31,9 @@ import {
loadResponseBodyOrThrowError
} from '@/store/utils'

let passesSubscription: ActionCable.Channel | null = null
let passesSubscription: Subscription | null = null

function createPassesSubscription(consumer: ActionCable.Cable, dispatch: Dispatch) {
function createPassesSubscription(consumer: Consumer, dispatch: Dispatch) {
if (passesSubscription) passesSubscription.unsubscribe()
passesSubscription = consumer.subscriptions.create({
channel: 'PassesChannel'
Expand All @@ -55,7 +55,6 @@ export function state(): PassesState {
}

const getters: GetterTree<PassesState, RootState> = {

/** @return Whether the list of Passes has been loaded. */
passesLoaded(state): boolean {
return !isNull(state.passes) && !state.passesLoading && isNull(state.passesError)
Expand Down Expand Up @@ -185,18 +184,15 @@ const mutations: MutationTree<PassesState> = {
if (passJSON['destroyed?']) {
state.passes = state.passes.filter(p => p.ID !== passJSON.id)
} else if (some(state.passes, p => p.ID === passJSON.id)) {
state.passes = [
...state.passes.filter(p => p.ID !== passJSON.id),
passFromJSON(passJSON)
]
state.passes = [...state.passes.filter(p => p.ID !== passJSON.id), passFromJSON(passJSON)]
} else {
if (state.passCurrentPage !== 1) return
// don't append new passes except on the first page
state.passes = concat(state.passes, passFromJSON(passJSON))
}
},

UPDATE_PASS_PAGES(state, { page, count }: { page: number, count: number }) {
UPDATE_PASS_PAGES(state, { page, count }: { page: number; count: number }) {
state.passCurrentPage = page
state.passCount = count
},
Expand All @@ -207,24 +203,19 @@ const mutations: MutationTree<PassesState> = {
const index = state.passes.findIndex(p => p.ID === pass.ID)
if (index === -1) return

state.passes = [
...state.passes.slice(0, index),
pass,
...state.passes.slice(index + 1)
]
state.passes = [...state.passes.slice(0, index), pass, ...state.passes.slice(index + 1)]
},

RENAME_PILOT(state, { oldName, newName }: { oldName: string, newName: string }) {
RENAME_PILOT(state, { oldName, newName }: { oldName: string; newName: string }) {
if (isNull(state.passes)) return
state.passes = state.passes.map(pass => ({
...pass,
pilot: (pass.pilot === oldName) ? newName : pass.pilot
pilot: pass.pilot === oldName ? newName : pass.pilot
}))
}
}

const actions: ActionTree<PassesState, RootState> = {

/**
* Loads Passes for a squadron. Can be paginated.
*
Expand Down Expand Up @@ -254,10 +245,8 @@ const actions: ActionTree<PassesState, RootState> = {
commit('FINISH_PASSES', { passes })

const { headers } = result.val.response
const currentPage = headers.has('X-Page')
? Number.parseInt(headers.get('X-Page')!, 10) : 1
const passCount = headers.has('X-Count')
? Number.parseInt(headers.get('X-Count')!, 10) : 1
const currentPage = headers.has('X-Page') ? Number.parseInt(headers.get('X-Page')!, 10) : 1
const passCount = headers.has('X-Count') ? Number.parseInt(headers.get('X-Count')!, 10) : 1
commit('UPDATE_PASS_PAGES', { page: currentPage, count: passCount })
} catch (error: unknown) {
if (error instanceof Error) {
Expand Down Expand Up @@ -364,6 +353,9 @@ const actions: ActionTree<PassesState, RootState> = {
}

const passes: Module<PassesState, RootState> = {
state, getters, mutations, actions
state,
getters,
mutations,
actions
}
export default passes
Loading

0 comments on commit 0e4c548

Please sign in to comment.