Compare commits

..
Author SHA1 Message Date
sharevb 9045303721 feat(new tool): Dockerfile Linter 2025-01-12 22:26:38 +01:00
12 changed files with 8522 additions and 6718 deletions

No files matched your search

+8466 -6636
View File
File diff suppressed because it is too large. Load diff
@@ -128,7 +128,7 @@ function activateOption(option: PaletteOption) {
<c-input-text ref="inputRef" v-model:value="searchPrompt" raw-text placeholder="Type to search a tool or a command..." autofocus clearable />
<div v-for="(options, category) in filteredSearchResult" :key="category">
<div ml-3 mt-3 text-sm text-primary font-bold op-60>
<div ml-3 mt-3 text-sm font-bold text-primary op-60>
{{ category }}
</div>
<command-palette-option v-for="option in options" :key="option.name" :option="option" :selected="selectedOptionIndex === getOptionIndex(option)" @activated="activateOption" />
@@ -0,0 +1,15 @@
import { test, expect } from '@playwright/test';
test.describe('Tool - Dockerfile linter', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/dockerfile-linter');
});
test('Has correct title', async ({ page }) => {
await expect(page).toHaveTitle('Dockerfile linter - IT Tools');
});
test('', async ({ page }) => {
});
});
@@ -0,0 +1,6 @@
import { expect, describe, it } from 'vitest';
// import { } from './dockerfile-linter.service';
//
// describe('dockerfile-linter', () => {
//
// })
Whitespace-only changes.
@@ -0,0 +1,12 @@
<template>
<div>
Lorem ipsum
</div>
</template>
<script setup lang="ts">
</script>
<style lang="less" scoped>
</style>
+12
View File
@@ -0,0 +1,12 @@
import { ArrowsShuffle } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'Dockerfile Linter',
path: '/dockerfile-linter',
description: '',
keywords: ['dockerfile', 'docker', 'linter'],
component: () => import('./dockerfile-linter.vue'),
icon: ArrowsShuffle,
createdAt: new Date('2025-01-01'),
});
+2
View File
@@ -2,6 +2,7 @@ import { tool as base64FileConverter } from './base64-file-converter';
import { tool as base64StringConverter } from './base64-string-converter';
import { tool as basicAuthGenerator } from './basic-auth-generator';
import { tool as emailNormalizer } from './email-normalizer';
import { tool as dockerfileLinter } from './dockerfile-linter';
import { tool as asciiTextDrawer } from './ascii-text-drawer';
@@ -155,6 +156,7 @@ export const toolsByCategory: ToolCategory[] = [
sqlPrettify,
chmodCalculator,
dockerRunToDockerComposeConverter,
dockerfileLinter,
xmlFormatter,
yamlViewer,
emailNormalizer,
+3 -2
View File
@@ -1,10 +1,11 @@
import { Link } from '@vicons/tabler';
import { defineTool } from '../tool';
import { translate } from '@/plugins/i18n.plugin';
export const tool = defineTool({
name: 'Encode/decode url formatted strings',
name: translate('tools.url-encoder.title'),
path: '/url-encoder',
description: 'Encode to url-encoded format (also known as "percent-encoded") or decode from it.',
description: translate('tools.url-encoder.description'),
keywords: ['url', 'encode', 'decode', 'percent', '%20', 'format'],
component: () => import('./url-encoder.vue'),
icon: Link,
+3 -77
View File
@@ -1,82 +1,17 @@
<script setup lang="ts">
import { useCopy } from '@/composable/copy';
import { useQueryParamOrStorage } from '@/composable/queryParams';
import { useValidation } from '@/composable/validation';
import { isNotThrowing } from '@/utils/boolean';
import { withDefaultOnError } from '@/utils/defaults';
const encodings = [
{ value: 'URIComponent', label: 'URIComponent' },
{ value: 'RFC3986URIComponent', label: 'RFC3986 - URIComponent' },
{ value: 'RFC5987', label: 'RFC5987 (Link - Content-Disposition)' },
{ value: 'URI', label: 'URI' },
{ value: 'RFC3986URI', label: 'RFC3986 - URI' },
];
const encoding = useQueryParamOrStorage({ name: 'enc', storageName: 'url-encode:enc', defaultValue: 'URIComponent' });
function encodeRFC3986URIComponent(str: string) {
return encodeURIComponent(str).replace(
/[!'()*]/g,
(c: string) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`,
);
}
function encodeRFC5987ValueChars(str: string) {
return (
encodeURIComponent(str)
// The following creates the sequences %27 %28 %29 %2A (Note that
// the valid encoding of "*" is %2A, which necessitates calling
// toUpperCase() to properly encode). Although RFC3986 reserves "!",
// RFC5987 does not, so we do not need to escape it.
.replace(
/['()*]/g,
c => `%${c.charCodeAt(0).toString(16).toUpperCase()}`,
)
// The following are not required for percent-encoding per RFC5987,
// so we can allow for a little better readability over the wire: |`^
.replace(/%(7C|60|5E)/g, (str, hex) =>
String.fromCharCode(Number.parseInt(hex, 16)),
)
);
}
function encodeRFC3986URI(str: string) {
return encodeURI(str)
.replace(/%5B/g, '[')
.replace(/%5D/g, ']')
.replace(
/[!'()*]/g,
c => `%${c.charCodeAt(0).toString(16).toUpperCase()}`,
);
}
function encode(str: string) {
if (encoding.value === 'URIComponent') {
return encodeURIComponent(str);
}
if (encoding.value === 'RFC3986URIComponent') {
return encodeRFC3986URIComponent(str);
}
if (encoding.value === 'RFC5987') {
return encodeRFC5987ValueChars(str);
}
if (encoding.value === 'URI') {
return encodeURI(str);
}
if (encoding.value === 'RFC3986URI') {
return encodeRFC3986URI(str);
}
return str;
}
const encodeInput = ref('Hello world :)');
const encodeOutput = computed(() => withDefaultOnError(() => encode(encodeInput.value), ''));
const encodeOutput = computed(() => withDefaultOnError(() => encodeURIComponent(encodeInput.value), ''));
const encodedValidation = useValidation({
source: encodeInput,
rules: [
{
validator: value => isNotThrowing(() => encode(value)),
validator: value => isNotThrowing(() => encodeURIComponent(value)),
message: 'Impossible to parse this string',
},
],
@@ -88,7 +23,7 @@ const decodeInput = ref('Hello%20world%20%3A)');
const decodeOutput = computed(() => withDefaultOnError(() => decodeURIComponent(decodeInput.value), ''));
const decodeValidation = useValidation({
source: encodeInput,
source: decodeInput,
rules: [
{
validator: value => isNotThrowing(() => decodeURIComponent(value)),
@@ -102,15 +37,6 @@ const { copy: copyDecoded } = useCopy({ source: decodeOutput, text: 'Decoded str
<template>
<c-card title="Encode">
<c-select
v-model:value="encoding"
label="Encoding Kind:"
label-position="left"
:options="encodings"
/>
<n-divider />
<c-input-text
v-model:value="encodeInput"
label="Your string :"
+1 -1
View File
@@ -151,7 +151,7 @@ function onSearchInput() {
>
<div flex-1 truncate>
<slot name="displayed-value">
<input v-if="searchable && isOpen" ref="searchInputRef" v-model="searchQuery" type="text" placeholder="Search..." class="search-input" w-full color-current lh-normal @input="onSearchInput">
<input v-if="searchable && isOpen" ref="searchInputRef" v-model="searchQuery" type="text" placeholder="Search..." class="search-input" w-full lh-normal color-current @input="onSearchInput">
<span v-else-if="selectedOption" lh-normal>
{{ selectedOption.label }}
</span>
+1 -1
View File
@@ -39,7 +39,7 @@ const headers = computed(() => {
<template>
<div class="relative overflow-x-auto rounded">
<table class="w-full border-collapse text-left text-sm text-gray-500 dark:text-gray-400" role="table" :aria-label="description">
<thead v-if="!hideHeaders" class="bg-#ffffff text-gray-700 uppercase dark:bg-#333333 dark:text-gray-400" border-b="1px solid dark:transparent #efeff5">
<thead v-if="!hideHeaders" class="bg-#ffffff uppercase text-gray-700 dark:bg-#333333 dark:text-gray-400" border-b="1px solid dark:transparent #efeff5">
<tr>
<th v-for="header in headers" :key="header.key" scope="col" class="px-6 py-3 text-xs">
{{ header.label }}