Skip to content

Commit

Permalink
fix: linter
Browse files Browse the repository at this point in the history
  • Loading branch information
camarm-dev committed Jul 10, 2024
1 parent 6cbd520 commit 05fd111
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 62 deletions.
10 changes: 5 additions & 5 deletions app/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ import RemedeLogo from "@/components/RemedeLogo.vue"
import {useRouter} from "vue-router"
import {getOfflineDictionaryStatus} from "@/functions/offline"
import { App } from "@capacitor/app"
import {defineComponent} from "vue";
import {defineComponent} from "vue"
import {wordExists} from "@/functions/dictionnary"
import {getDeviceLocale} from "@/functions/device";
import {getDeviceLocale} from "@/functions/device"
export default defineComponent({
mounted() {
Expand Down Expand Up @@ -127,12 +127,12 @@ export default defineComponent({
router: useRouter(),
path: location.pathname,
downloaded: false,
query: ''
query: ""
}
},
methods: {
async setLocale() {
this.$i18n.locale = localStorage.getItem("interfaceLanguage") || await getDeviceLocale();
this.$i18n.locale = localStorage.getItem("interfaceLanguage") || await getDeviceLocale()
},
async handleFastSearch(query: string) {
if (await wordExists(query)) {
Expand All @@ -155,7 +155,7 @@ export default defineComponent({
this.query = this.query.slice(0, this.query.length - 1)
return
}
this.query += event.key.length == 1 ? event.key: ''
this.query += event.key.length == 1 ? event.key: ""
return
}
}
Expand Down
10 changes: 5 additions & 5 deletions app/src/components/ConjugationTable.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import {IonItem, IonLabel, IonList, IonSelect, IonSelectOption} from "@ionic/vue";
import {IonItem, IonLabel, IonList, IonSelect, IonSelectOption} from "@ionic/vue"
</script>

<template>
Expand Down Expand Up @@ -33,7 +33,7 @@ import {IonItem, IonLabel, IonList, IonSelect, IonSelectOption} from "@ionic/vue
</template>

<script lang="ts">
import {PropType} from "vue";
import {PropType} from "vue"
type conjugationData = {
[key: string]: { // Mode
Expand All @@ -46,14 +46,14 @@ type conjugationData = {
export default {
props: {
conjugations: {
type: Object as PropType<any>,
type: Object as PropType<conjugationData>,
required: true
}
},
data() {
return {
currentMode: '' as string,
currentTense: '' as string,
currentMode: "" as string,
currentTense: "" as string,
currentSubjects: [] as string[],
availableTenses: [] as string[]
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/functions/animations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createAnimation} from "@ionic/vue";
import {createAnimation} from "@ionic/vue"

export const defaultRemedeMainToolbarAnimation = (element: Element | Element[] | Node | Node[] | NodeList) => createAnimation()
.addElement(element)
Expand All @@ -8,7 +8,7 @@ export const defaultRemedeMainToolbarAnimation = (element: Element | Element[] |

export const defaultRemedeSearchToolbarAnimation = (element: Element | Element[] | Node | Node[] | NodeList) => createAnimation()
.addElement(element)
.beforeAddClass('mt')
.beforeAddClass("mt")
.duration(250)
.fromTo("transform", "translateY(0)", "translateY(-50%)")
.fromTo("scale", "1", "1.01")
Expand Down
4 changes: 2 additions & 2 deletions app/src/functions/device.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Device} from "@capacitor/device";
import {Device} from "@capacitor/device"

export async function getDeviceLocale() {
const locale = await Device.getLanguageCode()
return locale.value.includes('-') ? locale.value.split('-')[0]: locale.value
return locale.value.includes("-") ? locale.value.split("-")[0]: locale.value
}
2 changes: 1 addition & 1 deletion app/src/functions/locales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const locales = {
}

export function hasDialect(locale: string) {
return locales.dialects.hasOwnProperty(locale)
return Object.prototype.hasOwnProperty.call(locales.dialects, locale)
}

export default locales
2 changes: 1 addition & 1 deletion app/src/functions/sources.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const sources = {
antonyme_org: {
label: 'definition.antonyms',
label: "definition.antonyms",
url: "http://www.antonyme.org/antonyme/{word}"
},
synonymo_fr: {
Expand Down
6 changes: 3 additions & 3 deletions app/src/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createI18n } from 'vue-i18n'
import { createI18n } from "vue-i18n"
import frenchTranslations from "@/data/translations/fr.json"
import englishTranslations from "@/data/translations/en.json"

Expand All @@ -8,8 +8,8 @@ const globalizationList = {
}

export default createI18n({
locale: 'fr',
fallbackLocale: 'en',
locale: "fr",
fallbackLocale: "en",
messages: globalizationList,
preserveDirectiveContent: true
})
6 changes: 3 additions & 3 deletions app/src/views/CorrectionView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<ion-buttons slot="end">
<ion-item color="light" lines="none" v-if="hasDialect($i18n.locale)">
<ion-select label="" :value="selectedDialect" @ionChange="selectedDialect = $event.target.value" interface="popover">
<ion-select-option v-for="dialect in availableDialects">{{ dialect }}</ion-select-option>
<ion-select-option :key="dialect" v-for="dialect in availableDialects">{{ dialect }}</ion-select-option>
</ion-select>
</ion-item>
<ion-button v-if="locked" @click="locked = false" color="primary">
Expand Down Expand Up @@ -183,14 +183,14 @@ import {
informationCircleOutline,
returnUpBackOutline
} from "ionicons/icons"
import { hasDialect } from "@/functions/locales";
import { hasDialect } from "@/functions/locales"
</script>

<script lang="ts">
import { Clipboard } from "@capacitor/clipboard"
import {ExplainSegment, LanguageToolCorrection} from "@/functions/types/languagetool"
import SetResult from "@/functions/plugins/setResult"
import locales from "@/functions/locales";
import locales from "@/functions/locales"
export default {
data() {
Expand Down
14 changes: 7 additions & 7 deletions app/src/views/DefinitionView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ import { Swiper, SwiperSlide } from "swiper/vue"
import { Pagination } from "swiper/modules"
import example from "@/assets/example.svg"
import quoteOpen from "@/assets/openQuote.svg"
import TabSection from "@/components/TabSection.vue";
import ConjugationTable from "@/components/ConjugationTable.vue";
import TabSection from "@/components/TabSection.vue"
import ConjugationTable from "@/components/ConjugationTable.vue"
const detailsModal = ref()
Expand Down Expand Up @@ -351,10 +351,10 @@ export default defineComponent({
async shareDefinition() {
try {
await Share.share({
title: this.$t('share.definitionTitle', { word: this.mot }),
text: this.$t('share.definitionDescription', { word: this.mot }),
title: this.$t("share.definitionTitle", { word: this.mot }),
text: this.$t("share.definitionDescription", { word: this.mot }),
url: `https://remede-app.camarm.fr/dictionnaire/${this.mot}`,
dialogTitle: this.$t('share.definitionDialogTitle'),
dialogTitle: this.$t("share.definitionDialogTitle"),
})
} catch {
console.error("Failed to share.")
Expand All @@ -373,8 +373,8 @@ export default defineComponent({
this.audioLoading = false
}).catch(async e => {
const toast = await toastController.create({
header: this.$t('error'),
message: this.$t('errors.cannotReadWord', { error: e }),
header: this.$t("error"),
message: this.$t("errors.cannotReadWord", { error: e }),
color: "danger",
duration: 3000
})
Expand Down
6 changes: 3 additions & 3 deletions app/src/views/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ import {
defaultRemedeContentAnimation,
defaultRemedeMainToolbarAnimation,
defaultRemedeSearchToolbarAnimation
} from "@/functions/animations";
} from "@/functions/animations"
export default defineComponent({
components: {
Expand Down Expand Up @@ -277,8 +277,8 @@ export default defineComponent({
this.query = this.query.slice(0, this.query.length - 1)
return
}
if (this.$route.name == 'dictionnaire') {
this.query += event.key.length == 1 ? event.key: ''
if (this.$route.name == "dictionnaire") {
this.query += event.key.length == 1 ? event.key: ""
}
}
})
Expand Down
14 changes: 7 additions & 7 deletions app/src/views/ReadSheetView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ import {

<script lang="ts">
import {defineComponent} from "vue"
import {Share} from "@capacitor/share";
import {Share} from "@capacitor/share"
export default defineComponent({
data() {
return {
fiche: {
contenu: "",
description: this.$t('sheetPage.sheetNotFound'),
nom: this.$t('sheetPage.noSheet'),
description: this.$t("sheetPage.sheetNotFound"),
nom: this.$t("sheetPage.noSheet"),
tags: [],
slug: "",
credits: {
Expand All @@ -101,13 +101,13 @@ export default defineComponent({
async shareSheet() {
try {
await Share.share({
title: this.$t('share.sheetTitle', { name: this.fiche.nom }),
text: this.$t('share.sheetDescription', { name: this.fiche.nom }),
title: this.$t("share.sheetTitle", { name: this.fiche.nom }),
text: this.$t("share.sheetDescription", { name: this.fiche.nom }),
url: `https://remede-app.camarm.fr/fiches/${this.fiche.slug}`,
dialogTitle: this.$t('share.sheetDialogTitle')
dialogTitle: this.$t("share.sheetDialogTitle")
})
} catch {
console.error('Failed to share')
console.error("Failed to share")
}
},
getTagColor(tag: string) {
Expand Down
20 changes: 10 additions & 10 deletions app/src/views/RhymesDictionarySearchResultsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export default defineComponent({
name: "minSyllabes",
options: [
{
text: this.$t('rhymesPage.syllablesMinimumAbbr'),
text: this.$t("rhymesPage.syllablesMinimumAbbr"),
value: 0
},
{
Expand All @@ -209,7 +209,7 @@ export default defineComponent({
name: "maxSyllabes",
options: [
{
text: this.$t('rhymesPage.syllablesMaximumAbbr'),
text: this.$t("rhymesPage.syllablesMaximumAbbr"),
value: 0
},
{
Expand Down Expand Up @@ -238,11 +238,11 @@ export default defineComponent({
const syllabesPickerButtons = [
{
text: this.$t('cancel'),
text: this.$t("cancel"),
role: "cancel",
},
{
text: this.$t('apply'),
text: this.$t("apply"),
handler: (value: any) => {
this.setMinMax(value.minSyllabes.value, value.maxSyllabes.value)
this.search()
Expand All @@ -255,19 +255,19 @@ export default defineComponent({
name: "quality",
options: [
{
text: this.$t('feminineAll'),
text: this.$t("feminineAll"),
value: 0
},
{
text: this.$t('rhymesPage.qualityPoor'),
text: this.$t("rhymesPage.qualityPoor"),
value: 1
},
{
text: this.$t('rhymesPage.qualitySufficient'),
text: this.$t("rhymesPage.qualitySufficient"),
value: 2
},
{
text: this.$t('rhymesPage.qualityRich'),
text: this.$t("rhymesPage.qualityRich"),
value: 3
}
],
Expand All @@ -276,11 +276,11 @@ export default defineComponent({
const rimeQualityPickerButtons = [
{
text: this.$t('cancel'),
text: this.$t("cancel"),
role: "cancel",
},
{
text: this.$t('apply'),
text: this.$t("apply"),
handler: (value: any) => {
this.setQuality(value.quality.value)
this.search()
Expand Down
8 changes: 4 additions & 4 deletions app/src/views/RhymesDictionaryView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<script lang="ts">
import {getRimesAutocomplete} from "@/functions/dictionnary"
import {
type Animation, AnimationDirection, createAnimation,
type Animation, AnimationDirection,
IonButtons,
IonContent,
IonHeader,
Expand Down Expand Up @@ -74,7 +74,7 @@ import {
defaultRemedeContentAnimation,
defaultRemedeMainToolbarAnimation,
defaultRemedeSearchToolbarAnimation
} from "@/functions/animations";
} from "@/functions/animations"
export default defineComponent({
data() {
Expand Down Expand Up @@ -143,8 +143,8 @@ export default defineComponent({
this.results = await getRimesAutocomplete(query)
} catch (e) {
const message = await toastController.create({
header: this.$t('error'),
message: this.$t('errors.rhymesSearchFailed', { error: e }),
header: this.$t("error"),
message: this.$t("errors.rhymesSearchFailed", { error: e }),
duration: 5000,
color: "danger"
})
Expand Down
17 changes: 8 additions & 9 deletions app/src/views/SettingsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ import {
import {
checkmarkCircle,
closeCircle, contrastOutline,
globeOutline,
invertModeOutline, languageOutline,
languageOutline,
refreshOutline,
trashBinOutline
} from "ionicons/icons"
Expand All @@ -147,8 +146,8 @@ import {App} from "@capacitor/app"
import {Capacitor} from "@capacitor/core"
import {getWordDocument} from "@/functions/dictionnary"
import {RemedeWordDocument} from "@/functions/types/remede"
import {getDeviceLocale} from "@/functions/device";
import locales from "@/functions/locales";
import {getDeviceLocale} from "@/functions/device"
import locales from "@/functions/locales"
export default {
data() {
Expand Down Expand Up @@ -241,9 +240,9 @@ export default {
try {
await downloadDictionary(this.availableDictionaries[this.dictionaryToDownload])
const successMessage = await alertController.create({
header: this.$t('settingsPage.downloadSuccess'),
subHeader: this.$t('settingsPage.downloadDescription'),
message: this.$t('settingsPage.downloadLongDescription'),
header: this.$t("settingsPage.downloadSuccess"),
subHeader: this.$t("settingsPage.downloadDescription"),
message: this.$t("settingsPage.downloadLongDescription"),
buttons: [
{
text: "C'est compris !",
Expand All @@ -258,8 +257,8 @@ export default {
await successMessage.present()
} catch (e) {
const message = await toastController.create({
header: this.$t('settingsPage.downloadFailed'),
message: this.$t('settingsPage.downloadFailedDescription', { error: e }),
header: this.$t("settingsPage.downloadFailed"),
message: this.$t("settingsPage.downloadFailedDescription", { error: e }),
duration: 5000,
color: "danger"
})
Expand Down

0 comments on commit 05fd111

Please sign in to comment.