mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-20 21:23:08 +03:00
Merge branch 'feat/json-linter' into chore/all-my-stuffs
# Conflicts: # components.d.ts # package.json # pnpm-lock.yaml # src/tools/index.ts
This commit is contained in:
commit
9cd3841448
6 files changed
+102
-1
No files matched your search
@@ -223,6 +223,7 @@
|
||||
"jsonar-mod": "^1.9.0",
|
||||
"jsstack.js": "^2.0.0",
|
||||
"jsvat-next": "^3.0.4",
|
||||
"jsonlint-mod": "^1.7.6",
|
||||
"jwt-decode": "^3.1.2",
|
||||
"korean-unpacker": "^1.0.3",
|
||||
"libphonenumber-js": "^1.10.28",
|
||||
|
||||
Generated
+21
-1
@@ -407,6 +407,9 @@ dependencies:
|
||||
jsonar-mod:
|
||||
specifier: ^1.9.0
|
||||
version: 1.9.0
|
||||
jsonlint-mod:
|
||||
specifier: ^1.7.6
|
||||
version: 1.7.6
|
||||
jsonpath:
|
||||
specifier: ^1.1.1
|
||||
version: 1.1.1
|
||||
@@ -6477,6 +6480,10 @@ packages:
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/JSV@4.0.2:
|
||||
resolution: {integrity: sha512-ZJ6wx9xaKJ3yFUhq5/sk82PJMuUyLk277I8mQeyDgCTjGdjWJIvPfaU5LIXaMuaN2UO1X3kZH4+lgphublZUHw==}
|
||||
dev: false
|
||||
|
||||
/abab@2.0.6:
|
||||
resolution: {integrity: sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==}
|
||||
dev: true
|
||||
@@ -11036,6 +11043,16 @@ packages:
|
||||
graceful-fs: 4.2.11
|
||||
dev: true
|
||||
|
||||
/jsonlint-mod@1.7.6:
|
||||
resolution: {integrity: sha512-oGuk6E1ehmIpw0w9ttgb2KsDQQgGXBzZczREW8OfxEm9eCQYL9/LCexSnh++0z3AiYGcXpBgqDSx9AAgzl/Bvg==}
|
||||
engines: {node: '>= 0.6'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
JSV: 4.0.2
|
||||
chalk: 2.4.2
|
||||
underscore: 1.13.7
|
||||
dev: false
|
||||
|
||||
/jsonpath@1.1.1:
|
||||
resolution: {integrity: sha512-l6Cg7jRpixfbgoWgkrl77dgEj8RPvND0wMH6TwQmi9Qs4TFfS9u5cUFnbeKTwj5ga5Y3BTGGNI28k117LJ009w==}
|
||||
dependencies:
|
||||
@@ -14759,6 +14776,10 @@ packages:
|
||||
resolution: {integrity: sha512-hEQt0+ZLDVUMhebKxL4x1BTtDY7bavVofhZ9KZ4aI26X9SRaE+Y3m83XUL1UP2jn8ynjndwCCpEHdUG+9pP1Tw==}
|
||||
dev: false
|
||||
|
||||
/underscore@1.13.7:
|
||||
resolution: {integrity: sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g==}
|
||||
dev: false
|
||||
|
||||
/undertaker-registry@2.0.0:
|
||||
resolution: {integrity: sha512-+hhVICbnp+rlzZMgxXenpvTxpuvA67Bfgtt+O9WOE5jo7w/dyiF1VmoZVIHvP2EkUjsyKyTwYKlLhA+j47m1Ew==}
|
||||
engines: {node: '>= 10.13.0'}
|
||||
@@ -16233,7 +16254,6 @@ packages:
|
||||
|
||||
/yamljs@0.3.0:
|
||||
resolution: {integrity: sha512-C/FsVVhht4iPQYXOInoxUM/1ELSf9EsgKH34FofQOp6hwCPrW4vG4w5++TED3xRUo8gD7l0P1J1dLlDYzODsTQ==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
argparse: 1.0.10
|
||||
glob: 7.2.3
|
||||
|
||||
@@ -119,6 +119,7 @@ import { tool as htmlCleaner } from './html-cleaner';
|
||||
import { tool as imageToAsciiArt } from './image-to-ascii-art';
|
||||
import { tool as ipv6SubnetCalculator } from './ipv6-subnet-calculator';
|
||||
import { tool as jsonEscaper } from './json-escaper';
|
||||
import { tool as jsonLinter } from './json-linter';
|
||||
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
|
||||
import { tool as numeronymGenerator } from './numeronym-generator';
|
||||
import { tool as macAddressGenerator } from './mac-address-generator';
|
||||
@@ -370,6 +371,7 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
jsonViewer,
|
||||
jsonMinify,
|
||||
jsonSizeAnalyzer,
|
||||
jsonLinter,
|
||||
jsonToCsv,
|
||||
sqlPrettify,
|
||||
chmodCalculator,
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Braces } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'JSON Linter',
|
||||
path: '/json-linter',
|
||||
description: 'Check and lint JSON content',
|
||||
keywords: ['json', 'linter', 'check'],
|
||||
component: () => import('./json-linter.vue'),
|
||||
icon: Braces,
|
||||
createdAt: new Date('2024-03-20'),
|
||||
});
|
||||
@@ -0,0 +1,55 @@
|
||||
<script setup lang="ts">
|
||||
import linter from 'jsonlint-mod';
|
||||
|
||||
const jsonContent = ref(
|
||||
`{
|
||||
a: True;
|
||||
b=5
|
||||
}`,
|
||||
);
|
||||
|
||||
const conversionError = computed(() => {
|
||||
try {
|
||||
linter.parse(jsonContent.value);
|
||||
return null;
|
||||
}
|
||||
catch (e: any) {
|
||||
return e.toString();
|
||||
}
|
||||
});
|
||||
|
||||
const MONACO_EDITOR_OPTIONS = {
|
||||
automaticLayout: true,
|
||||
formatOnType: true,
|
||||
formatOnPaste: true,
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<c-label label="Paste your JSON file content:">
|
||||
<div relative w-full>
|
||||
<c-monaco-editor
|
||||
v-model:value="jsonContent"
|
||||
theme="vs-dark"
|
||||
language="yaml"
|
||||
height="250px"
|
||||
:options="MONACO_EDITOR_OPTIONS"
|
||||
/>
|
||||
</div>
|
||||
</c-label>
|
||||
|
||||
<div v-if="conversionError">
|
||||
<n-alert title="The following errors occured" type="error" mt-5>
|
||||
<pre>
|
||||
{{ conversionError }}
|
||||
</pre>
|
||||
</n-alert>
|
||||
</div>
|
||||
<div v-else>
|
||||
<n-alert type="success" mt-5>
|
||||
Validation successful!
|
||||
</n-alert>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
declare module 'jsonlint-mod'{
|
||||
/**
|
||||
* Parse a JSON string to Typescript Object. If there is an error will print it
|
||||
* as human readible.
|
||||
*
|
||||
* Please use `import * as jsonlint from 'jsonlint';`. Instead of,
|
||||
* `import {parse} from 'jsonlint';`. Otherwise, it cannot reference to the
|
||||
* correct instance.
|
||||
*/
|
||||
export function parse(str: string): Record<string, unknown>;
|
||||
}
|
||||
Reference in new issue
Block a user