mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-08 07:11:03 -04:00
Fixed lint errors
This commit is contained in:
parent
84934504c7
commit
4f69621a9d
4 changed files with 37 additions and 37 deletions
|
@ -140,7 +140,7 @@ export const toolsByCategory: ToolCategory[] = [
|
||||||
chmodCalculator,
|
chmodCalculator,
|
||||||
dockerRunToDockerComposeConverter,
|
dockerRunToDockerComposeConverter,
|
||||||
xmlFormatter,
|
xmlFormatter,
|
||||||
yamlViewer
|
yamlViewer,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,11 +2,11 @@ import { AlignJustified } from '@vicons/tabler';
|
||||||
import { defineTool } from '../tool';
|
import { defineTool } from '../tool';
|
||||||
|
|
||||||
export const tool = defineTool({
|
export const tool = defineTool({
|
||||||
name: 'YAML prettify and format',
|
name: 'YAML prettify and format',
|
||||||
path: '/yaml-prettify',
|
path: '/yaml-prettify',
|
||||||
description: 'Prettify your YAML string to a human friendly readable format.',
|
description: 'Prettify your YAML string to a human friendly readable format.',
|
||||||
keywords: ['yaml', 'viewer', 'prettify', 'format'],
|
keywords: ['yaml', 'viewer', 'prettify', 'format'],
|
||||||
component: () => import('./yaml-viewer.vue'),
|
component: () => import('./yaml-viewer.vue'),
|
||||||
icon: AlignJustified,
|
icon: AlignJustified,
|
||||||
redirectFrom: ['/yaml-viewer'],
|
redirectFrom: ['/yaml-viewer'],
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
import { type MaybeRef, get } from '@vueuse/core';
|
import { type MaybeRef, get } from '@vueuse/core';
|
||||||
|
|
||||||
import yaml from "js-yaml";
|
import yaml from 'js-yaml';
|
||||||
|
|
||||||
export { formatYaml };
|
export { formatYaml };
|
||||||
|
|
||||||
function formatYaml({
|
function formatYaml({
|
||||||
rawYaml,
|
rawYaml,
|
||||||
sortKeys = false,
|
sortKeys = false,
|
||||||
indentSize = 2,
|
indentSize = 2,
|
||||||
}: {
|
}: {
|
||||||
rawYaml: MaybeRef<string>
|
rawYaml: MaybeRef<string>
|
||||||
sortKeys?: MaybeRef<boolean>
|
sortKeys?: MaybeRef<boolean>
|
||||||
indentSize?: MaybeRef<number>
|
indentSize?: MaybeRef<number>
|
||||||
}) {
|
}) {
|
||||||
const parsedYaml = yaml.load(get(rawYaml));
|
const parsedYaml = yaml.load(get(rawYaml));
|
||||||
|
|
||||||
const formattedYAML = yaml.dump(parsedYaml, {
|
const formattedYAML = yaml.dump(parsedYaml, {
|
||||||
sortKeys: get(sortKeys),
|
sortKeys: get(sortKeys),
|
||||||
indent: get(indentSize)
|
indent: get(indentSize),
|
||||||
});
|
});
|
||||||
|
|
||||||
return formattedYAML
|
return formattedYAML;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import yaml from 'js-yaml'
|
import yaml from 'js-yaml';
|
||||||
import { useStorage } from '@vueuse/core';
|
import { useStorage } from '@vueuse/core';
|
||||||
import { formatYaml } from './yaml-models';
|
import { formatYaml } from './yaml-models';
|
||||||
import { withDefaultOnError } from '@/utils/defaults';
|
import { withDefaultOnError } from '@/utils/defaults';
|
||||||
|
@ -12,7 +12,7 @@ const rawYaml = useStorage('yaml-prettify:raw-yaml', '');
|
||||||
const indentSize = useStorage('yaml-prettify:indent-size', 2);
|
const indentSize = useStorage('yaml-prettify:indent-size', 2);
|
||||||
const sortKeys = useStorage('yaml-prettify:sort-keys', false);
|
const sortKeys = useStorage('yaml-prettify:sort-keys', false);
|
||||||
|
|
||||||
const cleanYaml = computed(() => withDefaultOnError(() => formatYaml({ rawYaml: rawYaml, indentSize, sortKeys }), ''));
|
const cleanYaml = computed(() => withDefaultOnError(() => formatYaml({ rawYaml, indentSize, sortKeys }), ''));
|
||||||
|
|
||||||
const rawYamlValidation = useValidation({
|
const rawYamlValidation = useValidation({
|
||||||
source: rawYaml,
|
source: rawYaml,
|
||||||
|
@ -38,21 +38,21 @@ const rawYamlValidation = useValidation({
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<n-form-item
|
<n-form-item
|
||||||
label="Your raw YAML"
|
label="Your raw YAML"
|
||||||
:feedback="rawYamlValidation.message"
|
:feedback="rawYamlValidation.message"
|
||||||
:validation-status="rawYamlValidation.status"
|
:validation-status="rawYamlValidation.status"
|
||||||
>
|
>
|
||||||
<c-input-text
|
<c-input-text
|
||||||
ref="inputElement"
|
ref="inputElement"
|
||||||
v-model:value="rawYaml"
|
v-model:value="rawYaml"
|
||||||
placeholder="Paste your raw YAML here..."
|
placeholder="Paste your raw YAML here..."
|
||||||
rows="20"
|
rows="20"
|
||||||
multiline
|
multiline
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
autocorrect="off"
|
autocorrect="off"
|
||||||
autocapitalize="off"
|
autocapitalize="off"
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
monospace
|
monospace
|
||||||
/>
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-form-item label="Prettified version of your YAML">
|
<n-form-item label="Prettified version of your YAML">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue