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

Enable unplugin auto import for vue and vue-route imports #2757

Merged
merged 5 commits into from
Feb 6, 2023
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
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ dist/
tokenlists.json
public/data/tokenlists/*.json
package-lock.json
components.d.ts
components.d.ts
auto-imports.d.ts
61 changes: 61 additions & 0 deletions .eslintrc-auto-import.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"globals": {
"EffectScope": true,
"computed": true,
"createApp": true,
"customRef": true,
"defineAsyncComponent": true,
"defineComponent": true,
"effectScope": true,
"getCurrentInstance": true,
"getCurrentScope": true,
"h": true,
"inject": true,
"isProxy": true,
"isReactive": true,
"isReadonly": true,
"isRef": true,
"markRaw": true,
"nextTick": true,
"onActivated": true,
"onBeforeMount": true,
"onBeforeRouteLeave": true,
"onBeforeRouteUpdate": true,
"onBeforeUnmount": true,
"onBeforeUpdate": true,
"onDeactivated": true,
"onErrorCaptured": true,
"onMounted": true,
"onRenderTracked": true,
"onRenderTriggered": true,
"onScopeDispose": true,
"onServerPrefetch": true,
"onUnmounted": true,
"onUpdated": true,
"provide": true,
"reactive": true,
"readonly": true,
"ref": true,
"resolveComponent": true,
"resolveDirective": true,
"shallowReactive": true,
"shallowReadonly": true,
"shallowRef": true,
"toRaw": true,
"toRef": true,
"toRefs": true,
"triggerRef": true,
"unref": true,
"useAttrs": true,
"useCssModule": true,
"useCssVars": true,
"useLink": true,
"useRoute": true,
"useRouter": true,
"useSlots": true,
"watch": true,
"watchEffect": true,
"watchPostEffect": true,
"watchSyncEffect": true
}
}
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
'plugin:@typescript-eslint/recommended',
'plugin:vue/vue3-recommended',
'plugin:prettier-vue/recommended',
'./.eslintrc-auto-import.json',
],

plugins: ['simple-import-sort', 'tailwindcss'],
Expand Down
61 changes: 61 additions & 0 deletions auto-imports.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Generated by 'unplugin-auto-import'
export {}
declare global {
const EffectScope: typeof import('vue')['EffectScope']
const computed: typeof import('vue')['computed']
const createApp: typeof import('vue')['createApp']
const customRef: typeof import('vue')['customRef']
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
const defineComponent: typeof import('vue')['defineComponent']
const effectScope: typeof import('vue')['effectScope']
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
const getCurrentScope: typeof import('vue')['getCurrentScope']
const h: typeof import('vue')['h']
const inject: typeof import('vue')['inject']
const isProxy: typeof import('vue')['isProxy']
const isReactive: typeof import('vue')['isReactive']
const isReadonly: typeof import('vue')['isReadonly']
const isRef: typeof import('vue')['isRef']
const markRaw: typeof import('vue')['markRaw']
const nextTick: typeof import('vue')['nextTick']
const onActivated: typeof import('vue')['onActivated']
const onBeforeMount: typeof import('vue')['onBeforeMount']
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
const onDeactivated: typeof import('vue')['onDeactivated']
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
const onMounted: typeof import('vue')['onMounted']
const onRenderTracked: typeof import('vue')['onRenderTracked']
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
const onScopeDispose: typeof import('vue')['onScopeDispose']
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
const onUnmounted: typeof import('vue')['onUnmounted']
const onUpdated: typeof import('vue')['onUpdated']
const provide: typeof import('vue')['provide']
const reactive: typeof import('vue')['reactive']
const readonly: typeof import('vue')['readonly']
const ref: typeof import('vue')['ref']
const resolveComponent: typeof import('vue')['resolveComponent']
const resolveDirective: typeof import('vue')['resolveDirective']
const shallowReactive: typeof import('vue')['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef']
const toRaw: typeof import('vue')['toRaw']
const toRef: typeof import('vue')['toRef']
const toRefs: typeof import('vue')['toRefs']
const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs']
const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars']
const useLink: typeof import('vue-router')['useLink']
const useRoute: typeof import('vue-router')['useRoute']
const useRouter: typeof import('vue-router')['useRouter']
const useSlots: typeof import('vue')['useSlots']
const watch: typeof import('vue')['watch']
const watchEffect: typeof import('vue')['watchEffect']
const watchPostEffect: typeof import('vue')['watchPostEffect']
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
}
2 changes: 1 addition & 1 deletion src/components/_global/BalAccordion/BalAccordion.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ComponentPublicInstance, nextTick, onMounted, ref, watch } from 'vue';
import { ComponentPublicInstance } from 'vue';

type Section = {
title: string;
Expand Down
1 change: 0 additions & 1 deletion src/components/_global/BalActionSteps/BalActionSteps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
TransactionReceipt,
TransactionResponse,
} from '@ethersproject/abstract-provider';
import { computed, ref, watch } from 'vue';

import AnimatePresence from '@/components/animate/AnimatePresence.vue';
import useEthers from '@/composables/useEthers';
Expand Down
2 changes: 1 addition & 1 deletion src/components/_global/BalAlert/BalAlert.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</template>

<script lang="ts">
import { computed, defineComponent, PropType } from 'vue';
import { PropType } from 'vue';

import BalBtn from '../BalBtn/BalBtn.vue';
import BalIcon from '../BalIcon/BalIcon.vue';
Expand Down
2 changes: 0 additions & 2 deletions src/components/_global/BalAsset/BalAsset.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup lang="ts">
import { computed, ref, toRefs, watch } from 'vue';

import { useTokens } from '@/providers/tokens.provider';
import useUrls from '@/composables/useUrls';
import { TokenInfo } from '@/types/TokenList';
Expand Down
8 changes: 0 additions & 8 deletions src/components/_global/BalBlankSlate/BalBlankSlate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
</div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';

export default defineComponent({
name: 'BalBlankSlate',
});
</script>

<style>
.bal-blank-slate {
@apply border dark:border-gray-700 border-dashed p-6 flex flex-col items-start justify-center rounded-lg;
Expand Down
2 changes: 0 additions & 2 deletions src/components/_global/BalBreakdown/BalBreakdown.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup lang="ts">
import { computed } from 'vue';

/**
* TYPES
*/
Expand Down
2 changes: 0 additions & 2 deletions src/components/_global/BalBtn/BalBtn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
</template>

<script lang="ts">
import { computed, defineComponent } from 'vue';

import BalLoadingIcon from '../BalLoadingIcon/BalLoadingIcon.vue';

export default defineComponent({
Expand Down
2 changes: 1 addition & 1 deletion src/components/_global/BalBtnGroup/BalBtnGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<script lang="ts">
import omit from 'lodash/omit';
import { computed, defineComponent, PropType } from 'vue';
import { PropType } from 'vue';

interface Option {
value: string | number;
Expand Down
2 changes: 0 additions & 2 deletions src/components/_global/BalCard/BalCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
</template>

<script lang="ts">
import { computed, defineComponent } from 'vue';

export default defineComponent({
name: 'BalCard',

Expand Down
1 change: 0 additions & 1 deletion src/components/_global/BalChart/BalChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { GridOption } from 'echarts/types/dist/shared';
import { last } from 'lodash';
import { Dictionary } from 'lodash';
import numeral from 'numeral';
import { computed, onMounted, ref, watch } from 'vue';
import ECharts from 'vue-echarts';

import useDarkMode from '@/composables/useDarkMode';
Expand Down
2 changes: 1 addition & 1 deletion src/components/_global/BalCheckbox/BalCheckbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</template>

<script lang="ts">
import { computed, defineComponent, PropType, ref } from 'vue';
import { PropType } from 'vue';

import { RuleFunction, Rules } from '@/types';

Expand Down
2 changes: 0 additions & 2 deletions src/components/_global/BalChip/composables/useChipStyles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { computed } from 'vue';

export function useChipClasses(props) {
const sizeClasses = () => {
switch (props.size) {
Expand Down
2 changes: 0 additions & 2 deletions src/components/_global/BalDropdown/BalDropdown.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup lang="ts">
import { computed, ref } from 'vue';

/**
* TYPES
*/
Expand Down
2 changes: 1 addition & 1 deletion src/components/_global/BalFlexGrid/BalFlexGrid.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { computed, defineComponent, h, VNodeArrayChildren } from 'vue';
import { VNodeArrayChildren } from 'vue';

export default defineComponent({
name: 'BalFlexGrid',
Expand Down
2 changes: 0 additions & 2 deletions src/components/_global/BalForm/BalForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue';

function useFormValidations() {
const errors = ref([] as Array<string>);
const validatable = ref([] as Array<any>);
Expand Down
2 changes: 0 additions & 2 deletions src/components/_global/BalHorizSteps/BalHorizSteps.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup lang="ts">
import { computed } from 'vue';

import useWeb3 from '@/services/web3/useWeb3';
import { getConnectorLogo } from '@/services/web3/web3.plugin';
import { Step, StepState } from '@/types';
Expand Down
1 change: 0 additions & 1 deletion src/components/_global/BalIcon/BalIcon.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script lang="ts" setup>
import feather from 'feather-icons';
import { computed, onMounted } from 'vue';

/**
* TYPES
Expand Down
2 changes: 0 additions & 2 deletions src/components/_global/BalImage/BalImage.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script lang="ts" setup>
import { computed, ref } from 'vue';

/**
* TYPES
*/
Expand Down
1 change: 0 additions & 1 deletion src/components/_global/BalInlineInput/BalInlineInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export default {

<script setup lang="ts">
import { omit } from 'lodash';
import { computed, ref, useAttrs } from 'vue';

import useInputEvents from '@/components/_global/BalTextInput/composables/useInputEvents';
import useInputValidation from '@/components/_global/BalTextInput/composables/useInputValidation';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { computed, Ref } from 'vue';
import { Ref } from 'vue';

export default function useInputStyles(props, isInvalid: Ref<boolean>, attrs) {
const extPaddingClass = (): string => {
Expand Down
1 change: 0 additions & 1 deletion src/components/_global/BalLazy/BalLazy.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { nextTick, ref } from 'vue';
const shouldRender = ref(false);
nextTick(() => {
shouldRender.value = true;
Expand Down
2 changes: 0 additions & 2 deletions src/components/_global/BalLink/BalLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ export default {
</script>

<script lang="ts" setup>
import { computed, useAttrs } from 'vue';

/**
* TYPES
*/
Expand Down
2 changes: 0 additions & 2 deletions src/components/_global/BalLoadingBlock/BalLoadingBlock.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script lang="ts" setup>
import { computed } from 'vue';

import useDarkMode from '@/composables/useDarkMode';

/**
Expand Down
2 changes: 0 additions & 2 deletions src/components/_global/BalLoadingIcon/BalLoadingIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
</template>

<script>
import { computed, defineComponent } from 'vue';

export default defineComponent({
name: 'BalLoadingIcon',

Expand Down
2 changes: 0 additions & 2 deletions src/components/_global/BalLoadingNumber/BalLoadingNumber.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script lang="ts" setup>
import { computed } from 'vue';

import { useUserSettings } from '@/providers/user-settings.provider';
import { FiatSymbol } from '@/constants/currency';

Expand Down
2 changes: 0 additions & 2 deletions src/components/_global/BalModal/BalModal.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script lang="ts" setup>
import { ref, watch } from 'vue';

import BalCard from '../BalCard/BalCard.vue';

/**
Expand Down
2 changes: 0 additions & 2 deletions src/components/_global/BalPopover/BalPopover.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup lang="ts">
import { computed, ref, watch } from 'vue';

type PopoverTrigger = 'click' | 'hover';

type Props = {
Expand Down
2 changes: 0 additions & 2 deletions src/components/_global/BalProgressBar/BalProgressBar.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup lang="ts">
import { computed } from 'vue';

/**
* TYPES
*/
Expand Down
2 changes: 0 additions & 2 deletions src/components/_global/BalRadio/BalRadio.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
</template>

<script lang="ts">
import { computed, defineComponent } from 'vue';

export default defineComponent({
name: 'BalRadio',

Expand Down
1 change: 0 additions & 1 deletion src/components/_global/BalRangeInput/BalRangeInput.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import 'vue-slider-component/theme/antd.css';

import { computed } from 'vue';
import VueSlider, { DefineComponent as TVueSlider } from 'vue-slider-component';

// Note that we are explicitly importing from 'tailwind.config.js' which is a vite alias (see vite.config.ts)
Expand Down
2 changes: 1 addition & 1 deletion src/components/_global/BalSelectInput/BalSelectInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</template>

<script lang="ts">
import { computed, defineComponent, PropType, ref } from 'vue';
import { PropType } from 'vue';

import { RuleFunction, Rules } from '@/types';

Expand Down
2 changes: 1 addition & 1 deletion src/components/_global/BalStack/BalStack.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { defineComponent, h, PropType } from 'vue';
import { PropType } from 'vue';

type Spacing = 'xs' | 'sm' | 'base' | 'lg' | 'xl' | '2xl' | 'none';
type Alignment = 'center' | 'start' | 'end' | 'between';
Expand Down
Loading