Skip to content

Commit a70412b

Browse files
committed
fix: enabling eslint on typescript and fixing all eslint issues
1 parent ddc10cd commit a70412b

File tree

9 files changed

+38
-31
lines changed

9 files changed

+38
-31
lines changed

components/RTStickyCopyButton.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<template>
22
<div class="sticky top-0 text-right z-1">
33
<button
4-
@click="handleClick"
54
class="absolute top-0 right-0 p-2 text-gray-800 transition-all transform rounded-full shadow dark:text-gray-50 z-1 hover:shadow-lg hover:scale-110 hover:rotate-12"
6-
v-bind:class="{
5+
:class="{
76
'bg-gray-100 dark:bg-gray-600': !copied,
87
'bg-green-500': copied,
98
}"
9+
@click="handleClick"
1010
>
1111
<svg
1212
v-show="!copied"
@@ -44,7 +44,12 @@
4444

4545
<script>
4646
export default {
47-
props: ['clickHandler'],
47+
props: {
48+
clickHandler: {
49+
type: Function,
50+
default: () => {},
51+
},
52+
},
4853
data() {
4954
return {
5055
copied: false,

components/Toast.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="absolute right-[20px] top-24" id="toast">
2+
<div id="toast" class="absolute right-[20px] top-24">
33
<div
44
class="
55
absolute
@@ -13,7 +13,7 @@
1313
z-2
1414
w-72
1515
"
16-
v-bind:class="{
16+
:class="{
1717
'-translate-y-screen': !toastState.show,
1818
'translate-y-0': toastState.show,
1919
'bg-green-400 text-gray-800': toastState.theme === 'success',

components/navbar.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@
6565
@click="toggleDarkMode"
6666
>
6767
<svg
68+
v-if="!darkMode"
6869
fill="none"
6970
stroke="currentColor"
7071
class="w-6 h-6"
7172
viewBox="0 0 24 24"
72-
v-if="!darkMode"
7373
xmlns="http://www.w3.org/2000/svg"
7474
>
7575
<path
@@ -80,11 +80,11 @@
8080
></path>
8181
</svg>
8282
<svg
83+
v-if="darkMode"
8384
fill="none"
8485
class="w-6 h-6"
8586
stroke="currentColor"
8687
viewBox="0 0 24 24"
87-
v-if="darkMode"
8888
xmlns="http://www.w3.org/2000/svg"
8989
>
9090
<path
@@ -152,7 +152,9 @@
152152

153153
<script>
154154
export default {
155-
props: ['showBackButton'],
155+
props: {
156+
showBackButton: Boolean,
157+
},
156158
data() {
157159
return {
158160
darkMode: false,

helpers/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function undoUrlSafeBase64(_encoded: string) {
99
}
1010

1111
export function urlEncode(unencoded: string): string {
12-
let encoded = globalThis.btoa(unencoded)
12+
const encoded = globalThis.btoa(unencoded)
1313
return doUrlSafeBase64(encoded)
1414
}
1515

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
"build": "npm run clean && nuxt build",
99
"start": "nuxt start",
1010
"generate": "npm run clean && nuxt generate",
11-
"lint:js": "eslint --ext \".js,.vue\" --ignore-path .gitignore .",
11+
"lint:jsts": "eslint --ext \".ts,.js,.vue\" --ignore-path .gitignore .",
1212
"lint:style": "stylelint \"**/*.{vue,css}\" --ignore-path .gitignore",
1313
"prepare": "husky install",
14-
"lint": "npm run lint:js && npm run lint:style",
14+
"lint": "npm run lint:jsts -- --fix && npm run lint:style",
1515
"test": "jest"
1616
},
1717
"engines": {

pages/diff.vue

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<template>
22
<div class="contents">
33
<Navbar show-back-button="true">
4-
<template v-slot:right>
4+
<template #right>
55
<button
66
type="button"
7-
@click="copyUrlToClipboard"
87
class="inline-flex justify-center px-4 py-2 transition-transform transform rounded-md shadow outline-none copy-uri-button align-center focus:ring-4 active:scale-y-75"
9-
v-bind:class="{
8+
:class="{
109
'bg-blue-500 text-white': !copied,
1110
'bg-green-500 text-gray-800': copied,
1211
}"
12+
@click="copyUrlToClipboard"
1313
>
14-
<span class="inline-flex justify-center" v-show="copied">
14+
<span v-show="copied" class="inline-flex justify-center">
1515
<svg
1616
class="inline-block w-6 h-6 ml-[-4px]"
1717
fill="none"
@@ -28,7 +28,7 @@
2828
</svg>
2929
<span class="hidden ml-2 md:inline-block">Copied</span>
3030
</span>
31-
<span class="inline-flex justify-center" v-show="!copied">
31+
<span v-show="!copied" class="inline-flex justify-center">
3232
<svg
3333
class="w-6 h-6"
3434
fill="none"
@@ -55,11 +55,11 @@
5555
<div
5656
class="relative flex-1 px-4 py-2 overflow-y-auto border-2 rounded-md dark:border-gray-500 max-h-screen--nav line-number-gutter min-h-80"
5757
>
58-
<RTStickyCopyButton :clickHandler="copyTextToClipboard" />
58+
<RTStickyCopyButton :click-handler="copyTextToClipboard" />
5959
<div
6060
v-for="(lineDiff, index) in lhsDiff"
6161
:key="index"
62-
v-bind:class="{
62+
:class="{
6363
'bg-red-100 dark:bg-yellow-700': lineDiff.includes('isModified'),
6464
}"
6565
>
@@ -69,11 +69,11 @@
6969
<div
7070
class="relative flex-1 px-4 py-2 overflow-y-auto border-2 rounded-md dark:border-gray-500 min-h-80 line-number-gutter max-h-screen--nav"
7171
>
72-
<RTStickyCopyButton :clickHandler="copyTextToClipboard" />
72+
<RTStickyCopyButton :click-handler="copyTextToClipboard" />
7373
<div
7474
v-for="(lineDiff, index) in rhsDiff"
7575
:key="index"
76-
v-bind:class="{
76+
:class="{
7777
'bg-green-100 dark:bg-green-700': lineDiff.includes('isModified'),
7878
}"
7979
>
@@ -90,6 +90,13 @@ import pako from 'pako'
9090
import { undoUrlSafeBase64 } from '../helpers/utils'
9191
export default {
9292
layout: 'main',
93+
data() {
94+
return {
95+
lhsDiff: this.lhsDiff,
96+
rhsDiff: this.rhsDiff,
97+
copied: false,
98+
}
99+
},
93100
mounted() {
94101
const _diff = this.$route.hash
95102
const gunzip = pako.ungzip(Buffer.from(undoUrlSafeBase64(_diff), 'base64'))
@@ -129,13 +136,6 @@ export default {
129136
`${`${maxLineCount}`.split('').length}ch`
130137
)
131138
},
132-
data() {
133-
return {
134-
lhsDiff: this.lhsDiff,
135-
rhsDiff: this.rhsDiff,
136-
copied: false,
137-
}
138-
},
139139
methods: {
140140
putToClipboard(textToPut, toastContent) {
141141
navigator.clipboard.writeText(textToPut)

pages/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<h2 class="w-full mb-2 text-center text-md">
99
Don’t worry, We don’t store any of your data
1010
</h2>
11-
<form @submit="checkForm" class="w-full h-full">
11+
<form class="w-full h-full" @submit="checkForm">
1212
<div class="flex flex-wrap w-full h-full gap-4">
1313
<textarea
1414
id="lhs"

plugins/fart-remover.client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ declare module '@nuxt/types' {
2121
declare module 'vuex/types/index' {
2222
// this.$isDarkModeinside Vuex stores
2323
interface Store<S> {
24-
$isDarkMode: boolean
24+
$isDarkMode: boolean | S
2525
}
2626
}
2727

28-
const myPlugin: Plugin = (context, inject) => {
28+
const myPlugin: Plugin = (_context, inject) => {
2929
inject('isDarkMode', isDarkModeCookie())
3030
}
3131

store/toast.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { GetterTree, Store, MutationTree } from 'vuex'
1+
import { GetterTree, MutationTree, Store } from 'vuex/types'
22

33
export const state = () => ({
44
show: false,

0 commit comments

Comments
 (0)