chore(lint): switched to a better lint config

This commit is contained in:
Corentin Thomasset 2023-05-28 23:13:24 +02:00 committed by Corentin THOMASSET
parent 4d2b037dbe
commit 33c9b6643f
178 changed files with 4105 additions and 3371 deletions

View file

@ -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 }) => {

View file

@ -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>