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