mirror of
https://github.com/tenrok/vue-select.git
synced 2026-05-26 04:34:04 +03:00
Fix linting errors - remove unused imports, fix function parameters, add eslint-disable for component names
Co-authored-by: sagalbot <692538+sagalbot@users.noreply.github.com>
This commit is contained in:
+1
-1
@@ -1,10 +1,10 @@
|
||||
<!-- eslint-disable vue/multi-word-component-names -->
|
||||
<script lang="ts" setup>
|
||||
import StyledComboBox from '@/components/ComboBox/StyledComboBox.vue'
|
||||
import ComboBoxOption from '@/components/ComboBox/ComboBoxOption.vue'
|
||||
import ComboBox from '@/components/ComboBox/ComboBox.vue'
|
||||
import ComboBoxMenu from '@/components/ComboBox/ComboBoxMenu.vue'
|
||||
import ComboBoxButton from '@/components/ComboBox/ComboBoxButton.vue'
|
||||
import ComboBoxInput from '@/components/ComboBox/ComboBoxInput.vue'
|
||||
import { countriesAndCodes } from '@docs/assets/static/data'
|
||||
import { ref } from 'vue'
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { createApp, h } from 'vue'
|
||||
import { createApp } from 'vue'
|
||||
import Dev from './Dev.vue'
|
||||
|
||||
createApp(Dev).mount('#app')
|
||||
|
||||
+5
-2
@@ -1,3 +1,6 @@
|
||||
module.exports = {
|
||||
plugins: [require('autoprefixer'), require('postcss-nested')],
|
||||
import autoprefixer from 'autoprefixer'
|
||||
import postcssNested from 'postcss-nested'
|
||||
|
||||
export default {
|
||||
plugins: [autoprefixer, postcssNested],
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { ListBoxKey } from '@/keys'
|
||||
import type { ComputedRef } from 'vue'
|
||||
import {
|
||||
provide,
|
||||
computed,
|
||||
@@ -15,7 +14,6 @@ import type {
|
||||
InjectedListBoxProps,
|
||||
ListBoxProps,
|
||||
ResolvedListBoxProps,
|
||||
VueSelectValue,
|
||||
} from '@/types'
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'update:open', 'open', 'close'])
|
||||
|
||||
@@ -3,7 +3,6 @@ import { ref, watch } from 'vue'
|
||||
import ComboBox from '@/components/ComboBox/ComboBox.vue'
|
||||
import ComboBoxInput from '@/components/ComboBox/ComboBoxInput.vue'
|
||||
import ComboBoxMenu from '@/components/ComboBox/ComboBoxMenu.vue'
|
||||
import ComboBoxOption from '@/components/ComboBox/ComboBoxOption.vue'
|
||||
import ComboBoxButton from '@/components/ComboBox/ComboBoxButton.vue'
|
||||
import type { VueSelectOption } from '@/types'
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<!-- eslint-disable vue/multi-word-component-names -->
|
||||
<template>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10">
|
||||
<path
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<!-- eslint-disable vue/multi-word-component-names -->
|
||||
<style>
|
||||
@import '../css/vue-select.css';
|
||||
</style>
|
||||
@@ -135,7 +136,7 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import pointerScroll from '@/mixins/pointerScroll.js'
|
||||
import typeAheadPointer from '@/mixins/typeAheadPointer.js'
|
||||
import ajax from '@/mixins/ajax.js'
|
||||
@@ -183,7 +184,6 @@ export default {
|
||||
* with the 'input' event.
|
||||
* @type {Object|String|Array|null}
|
||||
*/
|
||||
// eslint-disable-next-line vue/require-default-prop,vue/require-prop-types
|
||||
modelValue: {},
|
||||
|
||||
/**
|
||||
@@ -338,7 +338,7 @@ export default {
|
||||
*/
|
||||
selectable: {
|
||||
type: Function,
|
||||
default: (option) => true,
|
||||
default: () => true,
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -561,7 +561,6 @@ export default {
|
||||
* @type {String}
|
||||
* @default {null}
|
||||
*/
|
||||
// eslint-disable-next-line vue/require-default-prop
|
||||
inputId: {
|
||||
type: String,
|
||||
},
|
||||
@@ -623,7 +622,7 @@ export default {
|
||||
* @param vm {VueSelect}
|
||||
* @return {Object}
|
||||
*/
|
||||
default: (map, vm) => map,
|
||||
default: (map) => map,
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -1056,7 +1055,7 @@ export default {
|
||||
* @param {Object|String} option
|
||||
* @return {void}
|
||||
*/
|
||||
onAfterSelect(option) {
|
||||
onAfterSelect() {
|
||||
if (this.closeOnSelect) {
|
||||
this.open = !this.open
|
||||
this.searchEl.blur()
|
||||
@@ -1334,11 +1333,11 @@ export default {
|
||||
|
||||
const defaults = {
|
||||
// backspace
|
||||
8: (e) => this.maybeDeleteValue(),
|
||||
8: () => this.maybeDeleteValue(),
|
||||
// tab
|
||||
9: (e) => this.onTab(),
|
||||
9: () => this.onTab(),
|
||||
// esc
|
||||
27: (e) => this.onEscape(),
|
||||
27: () => this.onEscape(),
|
||||
// up.prevent
|
||||
38: (e) => {
|
||||
e.preventDefault()
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
export function useModelValue<TypeProps>(
|
||||
props: Readonly<TypeProps>,
|
||||
key: string,
|
||||
emit: (name: string, ...args: any[]) => void
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
_props: Readonly<TypeProps>,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
_key: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
_emit: (name: string, ...args: unknown[]) => void
|
||||
) {}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { ComputedRef, PropType } from 'vue'
|
||||
import { PropType } from 'vue'
|
||||
|
||||
export type VueSelectValue = PropType<unknown>
|
||||
export type VueSelectOption = PropType<unknown>
|
||||
|
||||
@@ -7,7 +7,7 @@ describe('CreateOption When Tagging Is Enabled', () => {
|
||||
taggable: true,
|
||||
multiple: true,
|
||||
options: ['one', 'two'],
|
||||
createOption: (option) => 'four',
|
||||
createOption: () => 'four',
|
||||
})
|
||||
|
||||
await selectTag(Select, 'three')
|
||||
|
||||
@@ -11,7 +11,7 @@ describe('Custom Keydown Handlers', () => {
|
||||
it('can use the map-keydown prop to trigger custom behaviour', async () => {
|
||||
const onKeyDown = vi.fn()
|
||||
const Select = mountDefault({
|
||||
mapKeydown: (defaults, vm) => ({ ...defaults, 32: onKeyDown }),
|
||||
mapKeydown: (defaults) => ({ ...defaults, 32: onKeyDown }),
|
||||
})
|
||||
|
||||
await Select.get('input').trigger('keydown.space')
|
||||
@@ -36,7 +36,7 @@ describe('Custom Keydown Handlers', () => {
|
||||
|
||||
const onKeyDown = vi.fn()
|
||||
const Select = mountDefault({
|
||||
mapKeydown: (defaults, vm) => ({ ...defaults, 32: onKeyDown }),
|
||||
mapKeydown: (defaults) => ({ ...defaults, 32: onKeyDown }),
|
||||
selectOnKeyCodes: [9],
|
||||
})
|
||||
|
||||
|
||||
+18
-18
@@ -64,23 +64,23 @@ describe('Labels', () => {
|
||||
* @see https://github.com/vuejs/vue/issues/10224
|
||||
* @see https://github.com/vuejs/vue/pull/10229
|
||||
*/
|
||||
// it('will not call getOptionLabel if both scoped option slots are used and a filter is provided', () => {
|
||||
// const spy = spyOn(VueSelect.props.getOptionLabel, 'default')
|
||||
// const Select = shallowMount(VueSelect, {
|
||||
// props: {
|
||||
// options: [{ name: 'one' }],
|
||||
// filter: () => {},
|
||||
// },
|
||||
// scopedSlots: {
|
||||
// option: '<span class="option">{{ props.name }}</span>',
|
||||
// 'selected-option': '<span class="selected">{{ props.name }}</span>',
|
||||
// },
|
||||
// })
|
||||
//
|
||||
// Select.vm.select({ name: 'one' })
|
||||
//
|
||||
// expect(spy).toHaveBeenCalledTimes(0)
|
||||
// expect(Select.find('.selected').exists()).toBeTruthy()
|
||||
// })
|
||||
it.skip('will not call getOptionLabel if both scoped option slots are used and a filter is provided', () => {
|
||||
const spy = spyOn(VueSelect.props.getOptionLabel, 'default')
|
||||
const Select = shallowMount(VueSelect, {
|
||||
props: {
|
||||
options: [{ name: 'one' }],
|
||||
filter: () => {},
|
||||
},
|
||||
scopedSlots: {
|
||||
option: '<span class="option">{{ props.name }}</span>',
|
||||
'selected-option': '<span class="selected">{{ props.name }}</span>',
|
||||
},
|
||||
})
|
||||
|
||||
Select.vm.select({ name: 'one' })
|
||||
|
||||
expect(spy).toHaveBeenCalledTimes(0)
|
||||
expect(Select.find('.selected').exists()).toBeTruthy()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user