chore: Minor optimizations

- Optimize code, update a validation message and fix code inspection warning
This commit is contained in:
Magnus Leßmann (MarkL4YG) 2025-07-12 12:45:18 +02:00
parent e7ada4b47d
commit b0650a5bf4
Signed by: Mark.TwoFive
GPG key ID: 5B5EBCBE331F1E6F
2 changed files with 4 additions and 7 deletions

View file

@ -1,7 +1,7 @@
<script setup lang="ts">
import { ref, useId, useTemplateRef } from "vue";
import CountryListItem from "./CountryListItem.vue";
import { Country, getAvailableCountries } from "../utils/countries";
import { type Country, getAvailableCountries } from "../utils/countries.ts";
const formModel = ref(false);
const formRef = useTemplateRef("form");
@ -22,10 +22,7 @@ const state = ref("");
const locality = ref("");
// Countries data for autocomplete
const countries = ref<(Country | { divider: boolean; header: string })[]>([]);
// Initialize countries list
countries.value = getAvailableCountries();
const countries = ref(getAvailableCountries());
// Certificate settings
const keyLength = ref(4096);
@ -35,7 +32,7 @@ const noExpiry = ref(false);
// Validation rules
const domainRules = [
(value: string) => !!value || "A value must be provided to add the domain.",
(value: string) => new RegExp("^[a-z0-9][a-z0-9.]+$").test(value) || "Invalid domain characters provided. (To use some characters, convert the domain to xn-domain format.)",
(value: string) => /^[a-z0-9][a-z0-9.\-_]+$|^xn--[a-z0-9.\-_]+$/i.test(value) || "Invalid domain characters provided. (To use some special characters, convert the domain to xn-domain format.)",
]
const emailRules = [

View file

@ -1,6 +1,6 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"include": ["env.d.ts", "src/**/*", "src/**/*.ts", "src/**/*.vue"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
"composite": true,