chore(lint): switched to a better lint config
This commit is contained in:
1 parent
4d2b037dbe
commit
33c9b6643f
178 files changed
+4105
-3371
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
test.describe('Tool - Yaml to json', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
<script setup lang="ts">
|
||||
import { parse as parseYaml } from 'yaml';
|
||||
import type { UseValidationRule } from '@/composable/validation';
|
||||
import { isNotThrowing } from '@/utils/boolean';
|
||||
import { withDefaultOnError } from '@/utils/defaults';
|
||||
|
||||
function transformer(value: string) {
|
||||
return withDefaultOnError(() => {
|
||||
const obj = parseYaml(value);
|
||||
return obj ? JSON.stringify(obj, null, 3) : '';
|
||||
}, '');
|
||||
}
|
||||
|
||||
const rules: UseValidationRule<string>[] = [
|
||||
{
|
||||
validator: (value: string) => isNotThrowing(() => parseYaml(value)),
|
||||
message: 'Provided YAML is not valid.',
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<format-transformer
|
||||
input-label="Your YAML"
|
||||
@@ -8,25 +29,3 @@
|
||||
:transformer="transformer"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { UseValidationRule } from '@/composable/validation';
|
||||
import { isNotThrowing } from '@/utils/boolean';
|
||||
import { withDefaultOnError } from '@/utils/defaults';
|
||||
import { parse as parseYaml } from 'yaml';
|
||||
|
||||
const transformer = (value: string) =>
|
||||
withDefaultOnError(() => {
|
||||
const obj = parseYaml(value);
|
||||
return obj ? JSON.stringify(obj, null, 3) : '';
|
||||
}, '');
|
||||
|
||||
const rules: UseValidationRule<string>[] = [
|
||||
{
|
||||
validator: (value: string) => isNotThrowing(() => parseYaml(value)),
|
||||
message: 'Provided YAML is not valid.',
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
Reference in new issue
Block a user