Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update auto imports #18

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
'plugin:vue/vue3-essential',
'@vue/typescript',
'@vue/typescript/recommended',
'./auto-generated-imports/.eslintrc-auto-import.json',
],
plugins: [
'import',
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ jobs:
- run: npx cypress info
- run: node --version
- run: node -p 'os.cpus()'
- run: npm run build
- run: npm run lint
- run: npm run test:ci
- run: npm run build

- name: Save build folder
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ jobs:
- run: npx cypress info
- run: node --version
- run: node -p 'os.cpus()'
- run: npm run build
- run: npm run lint
- run: npm run test:ci
- run: npm run build

- name: Save build folder
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ yarn-error.log
.firebase

# Generated files
components.d.ts
auto-generated-imports
86 changes: 0 additions & 86 deletions auto-imports.d.ts

This file was deleted.

3 changes: 2 additions & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { defineConfig } from 'cypress'
import dotenv from 'dotenv'
// https://github.com/TypeStrong/ts-node/issues/1096
import * as dotenv from 'dotenv'

dotenv.config({ path: '.env' })
dotenv.config()
Expand Down
2 changes: 1 addition & 1 deletion cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "../tsconfig.json",
"include": ["./**/*.ts", "../cypress.d.ts"],
"include": ["./**/*.ts", "../types/cypress.d.ts"],
"exclude": [],
"compilerOptions": {
"types": ["cypress", "@percy/cypress"],
Expand Down
11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"license": "UNLICENSED",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"build": "vite build && vue-tsc --noEmit",
"preview": "vite preview",
"types": "vue-tsc --noEmit",
"lint": "eslint --ext .js,.ts,.vue src",
"lint:fix": "eslint --fix --ext .js,.ts,.vue src",
"stylelint": "stylelint \"src/**/*.scss\"",
Expand All @@ -26,6 +27,14 @@
"src/*.{js,ts,vue}": [
"eslint --fix",
"git add"
],
"cypress/*.{js,ts}": [
"eslint --fix",
"git add"
],
"tests/*.{js,ts}": [
"eslint --fix",
"git add"
]
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import { useErrorLogStore } from '@/store/modules/errorLog'
import { EErrorType } from '@/enums/EErrorType'
import { getErrorMessage } from '@/utils/error'
import { noop } from '@/utils/noop'

type TypeListener = (entry: IntersectionObserverEntry) => void;

// TODO Replace to useElementVisibility
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { type Ref } from 'vue'
import { noop } from '@/utils/noop'
import { useIntersectionObserver } from '@/composables/intersectionObserver/useIntersectionObserver'

export const useVisibilityObserver = (target: Ref<HTMLDivElement | undefined>, autoUnobserve?: boolean) => {
Expand Down
6 changes: 1 addition & 5 deletions src/composables/useLearningLanguage.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { useUserStore } from '@/store/modules/user'
import { BASE_INTERFACE_LANGUAGE } from '@/const/InterfaceLanguage'
import { useConfigStore } from '@/store/modules/config'

export const useLearningLanguage = () => {
const { customData } = storeToRefs(useUserStore())
const { getTranslatedLanguageName, languagesAvailableForLearning } = useConfigStore()
const { updateActiveLearningLanguage } = useUserStore()

const activeLearningLanguage = computed(() => unref(customData)?.activeLearningLanguage)
const activeLearningLanguage = computed(() => unref(customData)?.activeLearningLanguage ?? -1)
const activeLearningLanguageName = computed(() => getTranslatedLanguageName(unref(activeLearningLanguage) ?? BASE_INTERFACE_LANGUAGE))
const availableLearningLanguagesOptions = computed(() =>
languagesAvailableForLearning
Expand Down
2 changes: 1 addition & 1 deletion src/composables/useRequestMethod.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Without direct import get error in template
import { type Ref, type WritableComputedRef } from 'vue'
import { noop } from '@/utils/noop'

type RequestMethodOptions = {
allowConcurrentRequests: boolean
Expand Down
4 changes: 0 additions & 4 deletions src/hooks/onAuthStateChanged.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { type Router } from 'vue-router'
import { getAuth, onAuthStateChanged } from 'firebase/auth'
import { useUserStore } from '@/store/modules/user'
import { useErrorLogStore } from '@/store/modules/errorLog'
import { EErrorType } from '@/enums/EErrorType'
import { EPageName } from '@/enums/EPageName'

export const initializeOnAuthStateChangedHook = (router: Router): void => {
const route = router.currentRoute
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<script setup lang="ts">
import { useUserStore } from '@/store/modules/user'
import { EPageName } from '@/enums/EPageName'
import { EDataTest } from '@/enums/EDataTest'
import { EAuthenticateModalType } from '@/modules/landing/modules/authenticate/components/AuthenticateModal/EAuthenticateModalType'
import AuthenticateModal from '@/modules/landing/modules/authenticate/components/AuthenticateModal/AuthenticateModal.vue'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<script lang="ts" setup>
import AuthenticateModalForm from '@/modules/landing/modules/authenticate/components/AuthenticateModal/components/AuthenticateModalForm/AuthenticateModalForm.vue'
import { EAuthenticateModalType } from '@/modules/landing/modules/authenticate/components/AuthenticateModal/EAuthenticateModalType'
import { useAppBreakpoints } from '@/composables/useAppBreakpoints'
import { EDataTest } from '@/enums/EDataTest'

const props = defineProps<{
type: EAuthenticateModalType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
<script lang="ts" setup>
import { useNotification } from 'naive-ui'
import { EPageName } from '@/enums/EPageName'
import { type EAuthenticationProvider } from '@/services/authentication/EAuthenticationProvider'
import AuthenticateModalProviders from '@/modules/landing/modules/authenticate/components/AuthenticateModal/components/AuthenticateModalProviders/AuthenticateModalProviders.vue'
import { useAuthenticationService } from '@/plugins/services'
import { useErrorLogStore } from '@/store/modules/errorLog'
import { EErrorType } from '@/enums/EErrorType'
import { EAuthenticateModalType } from '@/modules/landing/modules/authenticate/components/AuthenticateModal/EAuthenticateModalType'
import { useI18n } from '@/plugins/i18n'
import { EDataTest } from '@/enums/EDataTest'

const { t } = useI18n()
const { addErrorLogInfo } = useErrorLogStore()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script lang="ts" setup>
import { EAuthenticationProvider } from '@/services/authentication/EAuthenticationProvider'
import { EDataTest } from '@/enums/EDataTest'

const emit = defineEmits<{
(e: 'signInWithProvider', provider: EAuthenticationProvider): void
Expand Down
1 change: 0 additions & 1 deletion src/modules/landing/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { RouteRecordRaw } from 'vue-router'
import { EPageName } from '@/enums/EPageName'

export const landingRoutes: RouteRecordRaw[] = [{
path: '',
Expand Down
2 changes: 0 additions & 2 deletions src/modules/workspace/components/UserAvatar/UserAvatar.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script lang="ts" setup>
import { useUserStore } from '@/store/modules/user'

const { profileData } = storeToRefs(useUserStore())
const name = computed(() => unref(profileData)?.displayName ?? unref(profileData)?.email ?? 'U')
const photoURL = computed(() => unref(profileData)?.photoURL ?? '')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { EPageName } from '@@/src/enums/EPageName'
import {
BarbellOutline,
BookOutline,
Expand All @@ -9,8 +8,7 @@ import {
import { type MenuOption } from 'naive-ui'
import { NIcon } from 'naive-ui'
import { type RouteLocationNamedRaw, RouterLink } from 'vue-router'
import { useI18n } from '@/plugins/i18n'
import { EDataTest } from '@/enums/EDataTest'
import { type Component } from 'vue'

const { t } = useI18n()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<script setup lang="ts">
import { EPageName } from '@/enums/EPageName'
import WorkspaceHeaderUserAvatar from '@/modules/workspace/components/WorkspaceHeader/components/WorkspaceHeaderUserAvatar/WorkspaceHeaderUserAvatar.vue'
import WorkspaceHeaderActiveLearningLanguage from '@/modules/workspace/components/WorkspaceHeader/components/WorkspaceHeaderActiveLearningLanguage/WorkspaceHeaderActiveLearningLanguage.vue'
import { useI18n } from '@/plugins/i18n'
import { EDataTest } from '@/enums/EDataTest'

const { t } = useI18n()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<script setup lang="ts">
import { useUserStore } from '@/store/modules/user'
import { useLearningLanguage } from '@/composables/useLearningLanguage'
import { useI18n } from '@/plugins/i18n'

const { isUserDataLoaded } = storeToRefs(useUserStore())
const { availableLearningLanguagesOptionsExceptActive, activeLearningLanguageName, updateActiveLearningLanguage } = useLearningLanguage()
const { t } = useI18n()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<script setup lang="ts">
import UserAvatar from '@/modules/workspace/components/UserAvatar/UserAvatar.vue'
import { useUserStore } from '@/store/modules/user'
import { EPageName } from '@/enums/EPageName'
import { useAuthenticationService } from '@/plugins/services'
import { useI18n } from '@/plugins/i18n'
import { EDataTest } from '@/enums/EDataTest'

const router = useRouter()
const { isUserDataLoaded } = storeToRefs(useUserStore())
Expand Down
2 changes: 0 additions & 2 deletions src/modules/workspace/layouts/WorkspaceLayout.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<script setup lang="ts">
import WorkspaceHeader from '@/modules/workspace/components/WorkspaceHeader/WorkspaceHeader.vue'
import WorkspaceBottomMenu from '@/modules/workspace/components/WorkspaceBottomMenu/WorkspaceBottomMenu.vue'
import { useAppBreakpoints } from '@/composables/useAppBreakpoints'
import { EDataTest } from '@/enums/EDataTest'

const { isMobile } = useAppBreakpoints()
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<script lang="ts" setup>
import { RouterLink } from 'vue-router'
import type { MenuOption } from 'naive-ui'
import { EPageName } from '@/enums/EPageName'
import { useI18n } from '@/plugins/i18n'
import { EDataTest } from '@/enums/EDataTest'

const { t } = useI18n()
const route = useRoute()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<script setup lang="ts">
import { type ComputedRef } from 'vue'
import OfficeNavigation from '@/modules/workspace/modules/office/components/OfficeNavigation/OfficeNavigation.vue'
import { useAppBreakpoints } from '@/composables/useAppBreakpoints'
import { useI18n } from '@/plugins/i18n'
import { EPageName } from '@/enums/EPageName'

const { t } = useI18n()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<script setup lang="ts">
import UserAvatar from '@/modules/workspace/components/UserAvatar/UserAvatar.vue'
import { useUserStore } from '@/store/modules/user'
import { EDataTest } from '@/enums/EDataTest'

const { isUserDataLoaded, profileData } = storeToRefs(useUserStore())
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<script setup lang="ts">
import type { WritableComputedRef } from 'vue'
import { useUserStore } from '@/store/modules/user'
import { useInterfaceLanguageStore } from '@/store/modules/interfaceLanguage'
import { useConfigStore } from '@/store/modules/config'
import { BASE_INTERFACE_LANGUAGE } from '@/const/InterfaceLanguage'
import { useLearningLanguage } from '@/composables/useLearningLanguage'
import { EDataTest, EDataTestClass } from '@/enums/EDataTest'

const { interfaceLanguages, interfaceLanguageId } = storeToRefs(useInterfaceLanguageStore())
const { setInterfaceLanguage } = useInterfaceLanguageStore()
Expand Down
1 change: 0 additions & 1 deletion src/modules/workspace/modules/office/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { RouteRecordRaw } from 'vue-router'
import { EPageName } from '@/enums/EPageName'

export const officeRoutes: RouteRecordRaw[] = [{
path: 'office',
Expand Down
1 change: 0 additions & 1 deletion src/modules/workspace/modules/trainings/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { RouteRecordRaw } from 'vue-router'
import { EPageName } from '@/enums/EPageName'

export const trainingsRoutes: RouteRecordRaw[] = [{
name: EPageName.TRAININGS,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<script lang="ts" setup>
import { WordCreatorType } from '@/modules/workspace/modules/words/components/WordCreator/types'
import { useI18n } from '@/plugins/i18n'
import { EDataTest } from '@/enums/EDataTest'

const { t } = useI18n()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import WordStatusIcon from '@/modules/workspace/modules/words/components/WordStatus/WordStatusIcon.vue'
import { type EWordStatus } from '@/services/dbstore/dto/Words'
import { useWordStatuses } from '@/modules/workspace/modules/words/composables/useWordStatuses'
import { EDataTestClass } from '@/enums/EDataTest'

const { wordStatusOptions } = useWordStatuses()
const options = computed(() => unref(wordStatusOptions).map(option => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import WordsContainerHeader from '@/modules/workspace/modules/words/components/W
import WordsList from '@/modules/workspace/modules/words/components/WordsList/WordsList.vue'
import WordCreator from '@/modules/workspace/modules/words/components/WordCreator/WordCreator.vue'
import { useWordsFilters } from '@/modules/workspace/modules/words/composables/useWordsFilters'
import { useUserStore } from '@/store/modules/user'
import { useWordsList } from '@/modules/workspace/modules/words/composables/useWordsList'
import { WordCreatorType } from '@/modules/workspace/modules/words/components/WordCreator/types'

Expand Down
Loading