Skip to content

Commit

Permalink
* add some linting rules
Browse files Browse the repository at this point in the history
 * minor linting fixes
 * add file extensions
  • Loading branch information
ConorMurphy21 committed Feb 4, 2024
1 parent 0cacf20 commit c1cf903
Show file tree
Hide file tree
Showing 20 changed files with 63 additions and 54 deletions.
20 changes: 15 additions & 5 deletions client/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,21 @@ module.exports = {
parser: '@typescript-eslint/parser'
},
rules: {
'@typescript-eslint/consistent-type-imports': ['error'],
'@typescript-eslint/unbound-method': ['off'],
'@typescript-eslint/no-unused-vars': ['off'],
'@typescript-eslint/no-unsafe-assignment': ['off'],
'vue/multi-word-component-names': ['off'],
'@typescript-eslint/consistent-type-imports': 2,
'@typescript-eslint/unbound-method': 0,
'@typescript-eslint/no-unused-vars': 0,
'@typescript-eslint/no-unsafe-assignment': 0,
'vue/multi-word-component-names': 0,
'vue/require-typed-ref': 2,
'vue/component-api-style': [2, ['script-setup']],
'vue/block-lang': [2, { script: { lang: 'ts' } }],
'vue/define-macros-order': 2,
// 'vue/define-props-declaration': 2,
'vue/no-ref-object-reactivity-loss': 2,
'vue/no-undef-properties': 2,
'vue/no-unused-components': [2, { ignoreWhenBindingPresent: true }],
'vue/no-unused-properties': 2,
'vue/no-unused-refs': 2,
'prettier/prettier': 2
},
ignorePatterns: ['/*', '!/src']
Expand Down
8 changes: 4 additions & 4 deletions client/src/components/endRound/EndRound.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<script setup lang="ts">
import NotificationCount from '@/components/gameShared/NotificationCount.vue';
import PlayerChooser from '@/components/endRound/PlayerChooser.vue';
import ResponseList from '@/components/gameShared/ResponseList.vue';
import Prompt from '@/components/gameShared/Prompt.vue';
import { onMounted, ref, watch } from 'vue';
import { AudioWrap } from '@/mixins/audiowrap.js';
import ClickMp3 from '@/assets/audio/click2.mp3';
import socket from '@/socket/socket.js';
import { useRoomStore } from '@/stores/room.js';
import { useGameStore } from '@/stores/game.js';
import NotificationCount from '@/components/gameShared/NotificationCount.vue';
import PlayerChooser from '@/components/endRound/PlayerChooser.vue';
import ResponseList from '@/components/gameShared/ResponseList.vue';
import Prompt from '@/components/gameShared/Prompt.vue';
import { useI18n } from 'vue-i18n';
const roomStore = useRoomStore();
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/endRound/PlayerChooser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { computed, ref } from 'vue';
import { AudioWrap } from '@/mixins/audiowrap.js';
import Click2Mp3 from '@/assets/audio/click2.mp3';
import Click1Mp3 from '@/assets/audio/click1.mp3';
import { useRoomStore } from '@/stores/room';
import { type Player } from ':common/stateTypes';
import { useRoomStore } from '@/stores/room.js';
import { type Player } from ':common/stateTypes.js';
const roomStore = useRoomStore();
const hoverLeft = ref(false);
Expand Down
1 change: 1 addition & 0 deletions client/src/components/gameShared/Prompt.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
import VoteSkip from '@/components/promptResponse/VoteSkip.vue';
import { computed } from 'vue';
const props = defineProps({
Expand Down
8 changes: 4 additions & 4 deletions client/src/components/gameShared/ResponseList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ import Click1Mp3 from '@/assets/audio/click1.mp3';
import Click2Mp3 from '@/assets/audio/click2.mp3';
import { useGameStore } from '@/stores/game.js';
const gameStore = useGameStore();
const model = defineModel({ type: String });
const props = defineProps({
selectable: {
type: Boolean,
Expand All @@ -25,6 +21,10 @@ const props = defineProps({
}
});
const gameStore = useGameStore();
const model = defineModel({ type: String });
const selected = ref(-1);
const responses = computed((): string[] => {
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/gameShared/SelectionType.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import { computed } from 'vue';
import StrikeImg from '@/assets/images/strike.png';
import SikeImg from '@/assets/images/sike.png';
import ChoiceImg from '@/assets/images/choice.png';
import { useGameStore } from '@/stores/game';
import { useGameStore } from '@/stores/game.js';
import { useI18n } from 'vue-i18n';
const gameStore = useGameStore();
defineProps({
tooltip: {
type: Boolean,
default: true
}
});
const gameStore = useGameStore();
const typeImg = computed(() => {
if (gameStore.selectionType === 'strike') {
return StrikeImg;
Expand Down
9 changes: 4 additions & 5 deletions client/src/components/gameShared/Timer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ import timerMp3 from '@/assets/audio/timer_full.mp3';
import timerCompleteMp3 from '@/assets/audio/timerComplete.mp3';
import { useI18n } from 'vue-i18n';
const timer = new AudioWrap(timerMp3);
const timerComplete = new AudioWrap(timerCompleteMp3);
const gameStore = useGameStore();
const settingsStore = useGameStore();
defineProps({
time: {
type: Number,
required: true
}
});
const timer = new AudioWrap(timerMp3);
const timerComplete = new AudioWrap(timerCompleteMp3);
const gameStore = useGameStore();
const settingsStore = useGameStore();
watch(
() => settingsStore.timer,
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/gameShared/VolumeControl.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--suppress CssUnusedSymbol -->
<script setup lang="ts">
import { computed, type Ref, ref } from 'vue';
import { useSettingsStore } from '@/stores/settings';
import { useSettingsStore } from '@/stores/settings.js';
import VueSlider from 'vue-slider-component';
const settingsStore = useSettingsStore();
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/lobby/Lobby.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import PlayerList from '@/components/lobby/PlayerList.vue';
import Options from '@/components/lobby/Options.vue';
import { computed } from 'vue';
import socket from '@/socket/socket';
import { AudioWrap } from '@/mixins/audiowrap';
import socket from '@/socket/socket.js';
import { AudioWrap } from '@/mixins/audiowrap.js';
import ClickMp3 from '@/assets/audio/click2.mp3';
import { useRoomStore } from '@/stores/room';
import { useRoomStore } from '@/stores/room.js';
import { useI18n } from 'vue-i18n';
const click = new AudioWrap(ClickMp3);
const roomStore = useRoomStore();
Expand Down
9 changes: 4 additions & 5 deletions client/src/components/lobby/Options.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script setup lang="ts">
import { onMounted, type Ref, ref } from 'vue';
import type { SettableOptions } from ':common/options';
import socket from '@/socket/socket';
import { useGameStore } from '@/stores/game';
import type { SettableOptions } from ':common/options.js';
import socket from '@/socket/socket.js';
import { useGameStore } from '@/stores/game.js';
import { useI18n } from 'vue-i18n';
import { useRoomStore } from '@/stores/room';
import { useRoomStore } from '@/stores/room.js';
defineProps({
disabled: {
Expand Down Expand Up @@ -127,7 +127,6 @@ const { t } = useI18n();
<label v-t="'customPromptsLabel'" for="customPrompts" class="form-label" />
<textarea
id="customPrompts"
ref="customPrompts"
class="form-control fs-6"
:class="{ Disabled: !customSelected }"
:disabled="!customSelected"
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/lobby/PlayerCard.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { type PropType } from 'vue';
import type { Player } from ':common/stateTypes';
import type { Player } from ':common/stateTypes.js';
defineProps({
player: {
type: Object as PropType<Player>,
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/lobby/PlayerList.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script setup lang="ts">
import { computed } from 'vue';
import type { Player } from ':common/stateTypes';
import PlayerCard from '@/components/lobby/PlayerCard.vue';
import { useRoomStore } from '@/stores/room';
import { computed } from 'vue';
import type { Player } from ':common/stateTypes.js';
import { useRoomStore } from '@/stores/room.js';
const roomStore = useRoomStore();
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/promptResponse/PromptResponse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Timer from '@/components/gameShared/Timer.vue';
import ResponseList from '@/components/gameShared/ResponseList.vue';
import Prompt from '@/components/gameShared/Prompt.vue';
import { onMounted, type Ref, ref } from 'vue';
import socket from '@/socket/socket';
import { useGameStore } from '@/stores/game';
import socket from '@/socket/socket.js';
import { useGameStore } from '@/stores/game.js';
const response = ref('');
const resInput: Ref<null | HTMLInputElement> = ref(null);
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/promptResponse/VoteSkip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { AudioWrap } from '@/mixins/audiowrap.js';
import ClickMp3 from '@/assets/audio/click2.mp3';
import socket from '@/socket/socket.js';
import { useI18n } from 'vue-i18n';
import { useGameStore } from '@/stores/game';
import { useGameStore } from '@/stores/game.js';
const pressedVote = ref(false);
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/responseMatching/MatchCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import { AudioWrap } from '@/mixins/audiowrap.js';
import { type PropType, computed, ref } from 'vue';
import type { Player } from ':common/stateTypes.js';
import { type Match, useGameStore } from '@/stores/game.js';
import { useRoomStore } from '@/stores/room';
import { useRoomStore } from '@/stores/room.js';
import { useI18n } from 'vue-i18n';
const click = new AudioWrap(ClickMp3);
const props = defineProps({
player: {
type: Object as PropType<Player>,
Expand All @@ -19,6 +17,8 @@ const props = defineProps({
}
});
const click = new AudioWrap(ClickMp3);
const hovering = ref(false);
const gameStore = useGameStore();
Expand Down
2 changes: 1 addition & 1 deletion client/src/views/About.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import ClickMp3 from '@/assets/audio/click1.mp3';
import { AudioWrap } from '@/mixins/audiowrap';
import { AudioWrap } from '@/mixins/audiowrap.js';
const click = new AudioWrap(ClickMp3);
</script>

Expand Down
15 changes: 7 additions & 8 deletions client/src/views/Game.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,24 @@ import EndRound from '@/components/endRound/EndRound.vue';
import EndGame from '@/components/endGame/EndGame.vue';
import VolumeControl from '@/components/gameShared/VolumeControl.vue';
import TooltipToggle from '@/components/gameShared/TooltipToggle.vue';
import { useRoomStore } from '@/stores/room';
import { useGameStore } from '@/stores/game';
import { useRoomStore } from '@/stores/room.js';
import { useGameStore } from '@/stores/game.js';
import { Portal } from 'portal-vue';
import { computed, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
const gameStore = useGameStore();
const roomStore = useRoomStore();
const router = useRouter();
const { t } = useI18n();
const props = defineProps({
roomName: {
type: String,
required: true
}
});
const gameStore = useGameStore();
const roomStore = useRoomStore();
const router = useRouter();
const { t } = useI18n();
const gameScenes = {
Lobby,
Expand Down
4 changes: 2 additions & 2 deletions client/src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import { Instance } from '@popperjs/core';
import { onMounted, reactive, type Ref, ref } from 'vue';
import ClickMp3 from '@/assets/audio/click2.mp3';
import { AudioWrap } from '@/mixins/audiowrap';
import { AudioWrap } from '@/mixins/audiowrap.js';
import { useGameStore } from '@/stores/game.js';
import { useRoomStore } from '@/stores/room.js';
import { useRoute } from 'vue-router';
import socket from '@/socket/socket';
import socket from '@/socket/socket.js';
import { useI18n } from 'vue-i18n';
const click = new AudioWrap(ClickMp3);
Expand Down
2 changes: 1 addition & 1 deletion client/src/views/HowToPlay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Sike from '@/assets/images/howToPlay/sike.png';
import Choice from '@/assets/images/howToPlay/choice.png';
import Matching from '@/assets/images/howToPlay/matching.png';
import ClickMp3 from '@/assets/audio/click1.mp3';
import { AudioWrap } from '@/mixins/audiowrap';
import { AudioWrap } from '@/mixins/audiowrap.js';
import { useI18n } from 'vue-i18n';
const click = new AudioWrap(ClickMp3);
Expand Down
1 change: 1 addition & 0 deletions tsconfig.options.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"moduleResolution": "node",
"noEmitOnError": false,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
Expand Down

0 comments on commit c1cf903

Please sign in to comment.