From e9d1c2fb7d04bdb53bd0285bad7e7baf8f4e2f29 Mon Sep 17 00:00:00 2001 From: Wallgau <46035189+Wallgau@users.noreply.github.com> Date: Fri, 31 Oct 2025 15:23:28 -0400 Subject: [PATCH] Chore: enforce no any type lint (#10461) * chore(frontend): enforce no explicit any types in lint for changed files - Add noExplicitAny rule to Biome configuration - Update pre-commit hook to only check staged files (not entire codebase) - Add check-format:staged npm script for manual checks - Fix biome schema version to match installed version (2.1.1) * add lint to biome to enforce not using any in commited files only --------- Co-authored-by: Olfa Maslah Co-authored-by: Deon Sanchez <69873175+deon-sanchez@users.noreply.github.com> --- .pre-commit-config.yaml | 12 ++++++++++-- src/frontend/biome.json | 3 ++- src/frontend/package.json | 5 ++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6cf761fe43..b0eaf8f34a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,11 +35,19 @@ repos: hooks: - id: local-biome-check name: biome check - entry: bash -c 'cd src/frontend && npx @biomejs/biome check --write --files-ignore-unknown=true --no-errors-on-unmatched --diagnostic-level=error' + entry: bash -c 'cd src/frontend && files=("${@#src/frontend/}") && npx @biomejs/biome check --write --files-ignore-unknown=true --diagnostic-level=error "${files[@]}"' -- language: system types: [text] - files: "\\.(jsx?|tsx?|c(js|ts)|m(js|ts)|d\\.(ts|cts|mts)|jsonc?)$" + files: "^src/frontend/.*\\.(jsx?|tsx?|c(js|ts)|m(js|ts)|d\\.(ts|cts|mts)|jsonc?)$" exclude: (^docs/|src/lfx/src/lfx/_assets/component_index\.json$) + pass_filenames: true + - id: biome-lint-no-any-staged + name: biome no-any check (staged only) + entry: bash -c 'cd src/frontend && npx @biomejs/biome lint --staged --diagnostic-level=error --no-errors-on-unmatched' + language: system + files: "^src/frontend/.*\\.(tsx?|ts)$" + exclude: (^docs/) + pass_filenames: false - id: validate-starter-projects name: Validate Starter Project Templates entry: uv run python src/backend/tests/unit/template/test_starter_projects.py diff --git a/src/frontend/biome.json b/src/frontend/biome.json index 6b3c6a5209..e7a05d5985 100644 --- a/src/frontend/biome.json +++ b/src/frontend/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/2.1.2/schema.json", + "$schema": "https://biomejs.dev/schemas/2.1.1/schema.json", "vcs": { "enabled": true, "clientKind": "git", @@ -73,6 +73,7 @@ "noDuplicateElseIf": "error", "noDuplicateObjectKeys": "error", "noDuplicateParameters": "error", + "noExplicitAny": "error", "noFallthroughSwitchClause": "error", "noFunctionAssign": "error", "noGlobalAssign": "error", diff --git a/src/frontend/package.json b/src/frontend/package.json index c748eeaa1e..be316b5ee2 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -97,7 +97,10 @@ "test:coverage": "jest --coverage", "test:watch": "jest --watch", "serve": "vite preview", - "format": "npx @biomejs/biome check --write", + "format": "npx @biomejs/biome format --write", + "lint": "npx @biomejs/biome lint", + "lint:types": "npx @biomejs/biome lint --diagnostic-level=error", + "lint:types:staged": "npx @biomejs/biome lint --staged --diagnostic-level=error", "check-format": "npx @biomejs/biome check", "type-check": "tsc --noEmit --pretty --project tsconfig.json && vite" },