Skip to content

Commit

Permalink
chore: Refactor FwbFileInput component lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Oğuzhan Güç committed Aug 2, 2024
1 parent 0ee8e66 commit 78ac82d
Showing 1 changed file with 10 additions and 39 deletions.
49 changes: 10 additions & 39 deletions src/components/FwbFileInput/FwbFileInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,15 @@
<div v-if="!dropzone">
<label>
<span :class="labelClasses">{{ label }}</span>
<input
:class="fileInpClasses"
:multiple="multiple"
type="file"
:accept="accept"
@change="handleChange"
>
<input :class="fileInpClasses" :multiple="multiple" type="file" :accept="accept" @change="handleChange" />

Check warning on line 6 in src/components/FwbFileInput/FwbFileInput.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

Disallow self-closing on HTML void elements (<input/>)

Check warning on line 6 in src/components/FwbFileInput/FwbFileInput.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

':multiple' should be on a new line

Check warning on line 6 in src/components/FwbFileInput/FwbFileInput.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

'type' should be on a new line

Check warning on line 6 in src/components/FwbFileInput/FwbFileInput.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

':accept' should be on a new line

Check warning on line 6 in src/components/FwbFileInput/FwbFileInput.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

'@change' should be on a new line
</label>
<slot />
</div>
<div
v-else
class="flex flex-col items-start justify-center"
@change="handleChange"
@dragover="dragOverHandler"
@drop="dropFileHandler"
>
<span v-if="label !== ''" :class="labelClasses">{{ label }}</span>
<div v-else class="flex flex-col items-start justify-center" @change="handleChange" @dragover="dragOverHandler" @drop="dropFileHandler">

Check warning on line 10 in src/components/FwbFileInput/FwbFileInput.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

'class' should be on a new line

Check warning on line 10 in src/components/FwbFileInput/FwbFileInput.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

'@change' should be on a new line

Check warning on line 10 in src/components/FwbFileInput/FwbFileInput.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

'@dragover' should be on a new line

Check warning on line 10 in src/components/FwbFileInput/FwbFileInput.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

'@drop' should be on a new line
<span v-if="label !== ''" :class="labelClasses">{{ label }}</span>

Check warning on line 11 in src/components/FwbFileInput/FwbFileInput.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

':class' should be on a new line
<label :class="dropzoneLabelClasses">
<div :class="dropzoneWrapClasses">
<svg
aria-hidden="true"
class="w-8 h-8 text-gray-500 dark:text-gray-400"
fill="none"
viewBox="0 0 20 16"
xmlns="http://www.w3.org/2000/svg"
>
<svg aria-hidden="true" class="w-8 h-8 text-gray-500 dark:text-gray-400" fill="none" viewBox="0 0 20 16" xmlns="http://www.w3.org/2000/svg">
<path
d="M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"
stroke-linecap="round"
Expand All @@ -47,12 +29,7 @@
</div>
<p v-else>File: {{ dropZoneText }}</p>
</div>
<input
:multiple="multiple"
type="file"
:accept="accept"
class="hidden"
>
<input :multiple="multiple" type="file" :accept="accept" class="hidden" />
</label>
</div>
</div>
Expand All @@ -68,8 +45,8 @@ interface FileInputProps {
label?: string
modelValue?: File | File[] | null
multiple?: boolean
size?: string,
accept?:string,
size?: string
accept?: string
}
const props = withDefaults(defineProps<FileInputProps>(), {
Expand Down Expand Up @@ -97,10 +74,10 @@ const dropZoneText = computed(() => {
const emit = defineEmits(['update:modelValue'])
const model = computed({
get () {
get() {

Check failure on line 77 in src/components/FwbFileInput/FwbFileInput.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

Missing space before function parentheses
return props.modelValue
},
set (val) {
set(val) {

Check failure on line 80 in src/components/FwbFileInput/FwbFileInput.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

Missing space before function parentheses
emit('update:modelValue', val)
},
})
Expand Down Expand Up @@ -139,11 +116,5 @@ const dragOverHandler = (event: Event) => {
event.preventDefault()
}
const {
fileInpClasses,
labelClasses,
dropzoneLabelClasses,
dropzoneWrapClasses,
dropzoneTextClasses,
} = useFileInputClasses(props.size)
const { fileInpClasses, labelClasses, dropzoneLabelClasses, dropzoneWrapClasses, dropzoneTextClasses } = useFileInputClasses(props.size)
</script>

0 comments on commit 78ac82d

Please sign in to comment.