diff options
author | 2023-05-28 23:13:24 +0200 | |
---|---|---|
committer | 2023-05-28 23:29:14 +0200 | |
commit | 33c9b6643f58a6930043f460d5bfdca4bc1f7222 (patch) | |
tree | f313935e30f7b90ea16e564e7171e2e72319ce29 /src/tools/json-diff/json-diff.vue | |
parent | 4d2b037dbe4e78aa90a4a6d9c7315dcf0a51fed9 (diff) | |
download | it-tools-33c9b6643f58a6930043f460d5bfdca4bc1f7222.tar.gz it-tools-33c9b6643f58a6930043f460d5bfdca4bc1f7222.tar.zst it-tools-33c9b6643f58a6930043f460d5bfdca4bc1f7222.zip |
chore(lint): switched to a better lint config
Diffstat (limited to 'src/tools/json-diff/json-diff.vue')
-rw-r--r-- | src/tools/json-diff/json-diff.vue | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/tools/json-diff/json-diff.vue b/src/tools/json-diff/json-diff.vue index 811f7fa..2ef3de0 100644 --- a/src/tools/json-diff/json-diff.vue +++ b/src/tools/json-diff/json-diff.vue @@ -1,3 +1,24 @@ +<script setup lang="ts"> +import JSON5 from 'json5'; + +import DiffsViewer from './diff-viewer/diff-viewer.vue'; +import { withDefaultOnError } from '@/utils/defaults'; +import { isNotThrowing } from '@/utils/boolean'; + +const rawLeftJson = ref(''); +const rawRightJson = ref(''); + +const leftJson = computed(() => withDefaultOnError(() => JSON5.parse(rawLeftJson.value), undefined)); +const rightJson = computed(() => withDefaultOnError(() => JSON5.parse(rawRightJson.value), undefined)); + +const jsonValidationRules = [ + { + validator: (value: string) => value === '' || isNotThrowing(() => JSON5.parse(value)), + message: 'Invalid JSON format', + }, +]; +</script> + <template> <c-input-text v-model:value="rawLeftJson" @@ -23,24 +44,3 @@ <DiffsViewer :left-json="leftJson" :right-json="rightJson" /> </template> - -<script setup lang="ts"> -import JSON5 from 'json5'; - -import { withDefaultOnError } from '@/utils/defaults'; -import { isNotThrowing } from '@/utils/boolean'; -import DiffsViewer from './diff-viewer/diff-viewer.vue'; - -const rawLeftJson = ref(''); -const rawRightJson = ref(''); - -const leftJson = computed(() => withDefaultOnError(() => JSON5.parse(rawLeftJson.value), undefined)); -const rightJson = computed(() => withDefaultOnError(() => JSON5.parse(rawRightJson.value), undefined)); - -const jsonValidationRules = [ - { - validator: (value: string) => value === '' || isNotThrowing(() => JSON5.parse(value)), - message: 'Invalid JSON format', - }, -]; -</script> |