diff --git a/js/.eslintrc.js b/js/.eslintrc.js index ac692e5ee..d29e98c47 100644 --- a/js/.eslintrc.js +++ b/js/.eslintrc.js @@ -48,6 +48,8 @@ module.exports = { "import/prefer-default-export": "off", "import/extensions": "off", "import/no-unresolved": "off", + "no-shadow": "off", + "@typescript-eslint/no-shadow": ["error"], }, ignorePatterns: ["src/typings/*.d.ts", "vue.config.js"], diff --git a/js/src/@types/dom.d.ts b/js/src/@types/dom.d.ts new file mode 100644 index 000000000..59a3a0781 --- /dev/null +++ b/js/src/@types/dom.d.ts @@ -0,0 +1,18 @@ +declare global { + interface GeolocationCoordinates { + readonly accuracy: number; + readonly altitude: number | null; + readonly altitudeAccuracy: number | null; + readonly heading: number | null; + readonly latitude: number; + readonly longitude: number; + readonly speed: number | null; + } + + interface GeolocationPosition { + readonly coords: GeolocationCoordinates; + readonly timestamp: number; + } +} + +export {}; diff --git a/js/src/apollo/user.ts b/js/src/apollo/user.ts index 5abd70fcf..824df6f73 100644 --- a/js/src/apollo/user.ts +++ b/js/src/apollo/user.ts @@ -1,8 +1,11 @@ +import { ICurrentUserRole } from "@/types/enums"; import { ApolloCache } from "apollo-cache"; import { NormalizedCacheObject } from "apollo-cache-inmemory"; -import { ICurrentUserRole } from "@/types/current-user.model"; +import { Resolvers } from "apollo-client/core/types"; -export default function buildCurrentUserResolver(cache: ApolloCache) { +export default function buildCurrentUserResolver( + cache: ApolloCache +): Resolvers { cache.writeData({ data: { currentUser: { diff --git a/js/src/components/Account/Identities.vue b/js/src/components/Account/Identities.vue index 81c08e66a..6dea19a45 100644 --- a/js/src/components/Account/Identities.vue +++ b/js/src/components/Account/Identities.vue @@ -53,7 +53,7 @@ export default class Identities extends Vue { errors: string[] = []; - isCurrentIdentity(identity: IPerson) { + isCurrentIdentity(identity: IPerson): boolean { return identity.preferredUsername === this.currentIdentityName; } } diff --git a/js/src/components/Account/ParticipantCard.vue b/js/src/components/Account/ParticipantCard.vue deleted file mode 100644 index 807e2f3a5..000000000 --- a/js/src/components/Account/ParticipantCard.vue +++ /dev/null @@ -1,94 +0,0 @@ - -```vue - -``` - -```vue - -``` - -```vue - -``` - -```vue - -``` - - - - - - diff --git a/js/src/components/Account/PopoverActorCard.vue b/js/src/components/Account/PopoverActorCard.vue index a61d08880..7374376c5 100644 --- a/js/src/components/Account/PopoverActorCard.vue +++ b/js/src/components/Account/PopoverActorCard.vue @@ -12,8 +12,9 @@ diff --git a/js/src/components/Group/GroupMemberCard.vue b/js/src/components/Group/GroupMemberCard.vue index f00689077..0b94eacdd 100644 --- a/js/src/components/Group/GroupMemberCard.vue +++ b/js/src/components/Group/GroupMemberCard.vue @@ -54,7 +54,9 @@ diff --git a/js/src/components/Map/Vue2LeafletLocateControl.vue b/js/src/components/Map/Vue2LeafletLocateControl.vue index 9a69db9f0..df2de381e 100644 --- a/js/src/components/Map/Vue2LeafletLocateControl.vue +++ b/js/src/components/Map/Vue2LeafletLocateControl.vue @@ -17,13 +17,13 @@ import { Component, Prop, Vue } from "vue-property-decorator"; @Component({ beforeDestroy() { - // eslint-disable-next-line @typescript-eslint/ban-ts-ignore + // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore this.parentContainer.removeLayer(this); }, }) export default class Vue2LeafletLocateControl extends Vue { - @Prop({ type: Object, default: () => ({}) }) options!: object; + @Prop({ type: Object, default: () => ({}) }) options!: Record; @Prop({ type: Boolean, default: true }) visible = true; @@ -33,7 +33,7 @@ export default class Vue2LeafletLocateControl extends Vue { parentContainer: any; - mounted() { + mounted(): void { this.mapObject = L.control.locate(this.options); DomEvent.on(this.mapObject, this.$listeners as any); propsBinder(this, this.mapObject, this.$props); @@ -42,7 +42,7 @@ export default class Vue2LeafletLocateControl extends Vue { this.mapObject.addTo(this.parentContainer.mapObject, !this.visible); } - public locate() { + public locate(): void { this.mapObject.start(); } } diff --git a/js/src/components/NavBar.vue b/js/src/components/NavBar.vue index 5af8b3f00..6846f78eb 100644 --- a/js/src/components/NavBar.vue +++ b/js/src/components/NavBar.vue @@ -109,13 +109,14 @@ import { Component, Vue, Watch } from "vue-property-decorator"; import Logo from "@/components/Logo.vue"; import { GraphQLError } from "graphql"; import { loadLanguageAsync } from "@/utils/i18n"; +import { ICurrentUserRole } from "@/types/enums"; import { CURRENT_USER_CLIENT, USER_SETTINGS } from "../graphql/user"; import { changeIdentity, logout } from "../utils/auth"; import { CURRENT_ACTOR_CLIENT, IDENTITIES, UPDATE_DEFAULT_ACTOR } from "../graphql/actor"; import { IPerson, Person } from "../types/actor"; import { CONFIG } from "../graphql/config"; import { IConfig } from "../types/config.model"; -import { ICurrentUser, ICurrentUserRole, IUser } from "../types/current-user.model"; +import { ICurrentUser, IUser } from "../types/current-user.model"; import SearchField from "./SearchField.vue"; import RouteName from "../router/name"; diff --git a/js/src/components/Participation/ConfirmParticipation.vue b/js/src/components/Participation/ConfirmParticipation.vue index 8630e0362..a72c8d4d6 100644 --- a/js/src/components/Participation/ConfirmParticipation.vue +++ b/js/src/components/Participation/ConfirmParticipation.vue @@ -38,9 +38,9 @@ diff --git a/js/src/views/Moderation/Logs.vue b/js/src/views/Moderation/Logs.vue index c5369f9ec..b0cc89c6f 100644 --- a/js/src/views/Moderation/Logs.vue +++ b/js/src/views/Moderation/Logs.vue @@ -158,9 +158,10 @@