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-to-yaml-converter | |
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-to-yaml-converter')
-rw-r--r-- | src/tools/json-to-yaml-converter/json-to-yaml.e2e.spec.ts | 4 | ||||
-rw-r--r-- | src/tools/json-to-yaml-converter/json-to-yaml.vue | 26 |
2 files changed, 14 insertions, 16 deletions
diff --git a/src/tools/json-to-yaml-converter/json-to-yaml.e2e.spec.ts b/src/tools/json-to-yaml-converter/json-to-yaml.e2e.spec.ts index bce095b..fee24d9 100644 --- a/src/tools/json-to-yaml-converter/json-to-yaml.e2e.spec.ts +++ b/src/tools/json-to-yaml-converter/json-to-yaml.e2e.spec.ts @@ -1,4 +1,4 @@ -import { test, expect } from '@playwright/test'; +import { expect, test } from '@playwright/test'; test.describe('Tool - json to yaml', () => { test.beforeEach(async ({ page }) => { @@ -14,6 +14,6 @@ test.describe('Tool - json to yaml', () => { const generatedJson = await page.getByTestId('area-content').innerText(); - expect(generatedJson.trim()).toEqual(`foo: bar\nlist:\n - item\n - key: value`.trim()); + expect(generatedJson.trim()).toEqual('foo: bar\nlist:\n - item\n - key: value'.trim()); }); }); diff --git a/src/tools/json-to-yaml-converter/json-to-yaml.vue b/src/tools/json-to-yaml-converter/json-to-yaml.vue index f25ef37..cbaeb22 100644 --- a/src/tools/json-to-yaml-converter/json-to-yaml.vue +++ b/src/tools/json-to-yaml-converter/json-to-yaml.vue @@ -1,20 +1,9 @@ -<template> - <format-transformer - input-label="Your JSON" - input-placeholder="Paste your JSON here..." - output-label="YAML from your JSON" - output-language="yaml" - :input-validation-rules="rules" - :transformer="transformer" - /> -</template> - <script setup lang="ts"> +import { stringify } from 'yaml'; +import JSON5 from 'json5'; import type { UseValidationRule } from '@/composable/validation'; import { isNotThrowing } from '@/utils/boolean'; import { withDefaultOnError } from '@/utils/defaults'; -import { stringify } from 'yaml'; -import JSON5 from 'json5'; const transformer = (value: string) => withDefaultOnError(() => stringify(JSON5.parse(value)), ''); @@ -26,4 +15,13 @@ const rules: UseValidationRule<string>[] = [ ]; </script> -<style lang="less" scoped></style> +<template> + <format-transformer + input-label="Your JSON" + input-placeholder="Paste your JSON here..." + output-label="YAML from your JSON" + output-language="yaml" + :input-validation-rules="rules" + :transformer="transformer" + /> +</template> |