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" },