chore: fix lint:format skipping assets and tests (#32662)

This commit is contained in:
Michael Geers 2026-08-09 13:01:19 +02:00 • committed by GitHub
parent 99a9c88948
commit 28e41bdd09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 52 additions and 51 deletions

View file

@ -52,14 +52,7 @@ import BatteryIcon from "../Energyflow/BatteryIcon.vue";
import Item from "./Item.vue";
import MoreItem from "./MoreItem.vue";
import { defineComponent, type PropType } from "vue";
import type {
FatalError,
Sponsor,
EvOpt,
AuthProviders,
Battery,
Vehicle,
} from "@/types/evcc";
import type { FatalError, Sponsor, EvOpt, AuthProviders, Battery, Vehicle } from "@/types/evcc";
export default defineComponent({
name: "BottomTabBar",

View file

@ -31,7 +31,10 @@
<div v-else class="row">
<div class="col-12 col-lg-6 mb-3">
<div class="row">
<label :for="formId('continuous')" class="col-form-label col-5 col-lg-12">
<label
:for="formId('continuous')"
class="col-form-label col-5 col-lg-12"
>
{{ $t("main.chargingPlan.optimization.label") }}
</label>
<div class="col-7 col-lg-12">
@ -56,7 +59,10 @@
</div>
<div class="col-12 col-lg-6 mb-3">
<div class="row">
<label :for="formId('precondition')" class="col-form-label col-5 col-lg-12">
<label
:for="formId('precondition')"
class="col-form-label col-5 col-lg-12"
>
{{ $t("main.chargingPlan.precondition.label") }}
</label>
<div class="col-7 col-lg-12">

View file

@ -215,5 +215,4 @@ export default {
.w-min-200 {
min-width: min(200px, 100%);
}
</style>

View file

@ -36,7 +36,8 @@ function extractPlaceholders(text: string): string[] {
// Flatten nested translation object into dot-notation keys
function flattenObject(obj: any, prefix = ""): Record<string, string> {
return Object.entries(obj).reduce((acc, [key, val]) => {
return Object.entries(obj).reduce(
(acc, [key, val]) => {
const path = prefix ? `${prefix}.${key}` : key;
if (val && typeof val === "object") {
Object.assign(acc, flattenObject(val, path));
@ -44,7 +45,9 @@ function flattenObject(obj: any, prefix = ""): Record<string, string> {
acc[path] = val;
}
return acc;
}, {} as Record<string, string>);
},
{} as Record<string, string>
);
}
// Compare placeholder arrays using Set equality for better performance
@ -69,11 +72,11 @@ function loadTranslationFile(filePath: string): Record<string, string> {
// Get all translation files in the directory safely
function getTranslationFiles(): string[] {
const files = readdirSync(__dirname)
.filter(file => {
.filter((file) => {
// Only allow valid filename characters and JSON extension
return /^[a-zA-Z0-9_-]+\.json$/.test(file);
})
.map(file => validateFilePath(join(__dirname, file)));
.map((file) => validateFilePath(join(__dirname, file)));
return files;
}
@ -90,8 +93,7 @@ function validateTranslations(): void {
}
const sourceFlat = loadTranslationFile(sourceFile);
const translationFiles = getTranslationFiles()
.filter(file => basename(file) !== "en.json");
const translationFiles = getTranslationFiles().filter((file) => basename(file) !== "en.json");
if (translationFiles.length === 0) {
console.log("ℹ️ No translation files to check.");
@ -120,7 +122,7 @@ function validateTranslations(): void {
file: lang,
key,
expected: sourcePlaceholders,
found: targetPlaceholders
found: targetPlaceholders,
});
}
}

View file

@ -6,7 +6,7 @@
"build": "vp build",
"test": "cross-env TZ=Europe/Berlin NODE_OPTIONS=--no-experimental-webstorage vp test",
"lint": "vp run lint:format && vp run lint:lint && vp run lint:tsc && vp run lint:i18n",
"lint:format": "vp fmt assets tests **/*.{yaml,sh} i18n/*.json --write",
"lint:format": "vp fmt assets tests i18n --write && vp fmt '**/*.{yaml,sh}' --write",
"lint:lint": "vp lint --fix --max-warnings=0",
"lint:tsc": "vue-tsc --noEmit",
"lint:i18n": "tsx i18n/check.ts",

View file

@ -127,7 +127,10 @@ maxconsumptionpower:
await expectModalHidden(hemsModal);
// enable experimental
await page.getByTestId("generalconfig-experimental").getByRole("button", { name: "edit" }).click();
await page
.getByTestId("generalconfig-experimental")
.getByRole("button", { name: "edit" })
.click();
const experimentalModal = page.getByTestId("experimental-modal");
await expectModalVisible(experimentalModal);
await experimentalModal.getByLabel("Enable experimental features.").click();

View file

@ -725,9 +725,7 @@ test.describe("plan strategy", async () => {
await expect(modal.getByTestId("plan-strategy")).toContainText("cleanest slots");
await optimization.selectOption("continuous");
await expect(modal.getByTestId("plan-strategy")).toContainText(
"cleanest uninterrupted series"
);
await expect(modal.getByTestId("plan-strategy")).toContainText("cleanest uninterrupted series");
});
test("visible and functional on mobile", async ({ page }) => {