Repository navigation
ci: ui checkstyle workflow in favour to remove pre-commit - #26445
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the OpenMetadata UI code-style enforcement approach by introducing a dedicated GitHub Actions workflow for UI checkstyle, cleaning up local git-hook tooling, and aligning formatting configuration/ignores.
Changes:
- Added a new
.github/workflows/ui-checkstyle.ymlworkflow to run UI checkstyle steps on PRs (with changed-file detection and PR commenting). - Removed Husky hook setup and related dependency entries from the UI
package.json/yarn.lock, and deleted the.husky/pre-commithook file. - Updated Prettier configuration (
trailingComma) and expanded.prettierignorefor Playwright outputs/test data.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/ui-checkstyle.yml |
Adds a PR-triggered UI checkstyle workflow with changed-file detection, caching, and PR comments on failures. |
openmetadata-ui/src/main/resources/ui/package.json |
Removes Husky/lint-staged-related setup and dependencies as part of moving checks to CI. |
openmetadata-ui/src/main/resources/ui/yarn.lock |
Updates lockfile to reflect removed dependencies. |
openmetadata-ui/src/main/resources/ui/.prettierrc.yaml |
Adjusts Prettier formatting rules (trailing commas). |
openmetadata-ui/src/main/resources/ui/.prettierignore |
Ignores Playwright-generated outputs and test fixtures to avoid formatting artifacts. |
openmetadata-ui/src/main/resources/ui/.husky/pre-commit |
Removes the Husky pre-commit hook script. |
openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ImpactAnalysis.spec.ts |
Updates copyright year and modifies an import formatting. |
Comments suppressed due to low confidence (1)
openmetadata-ui/src/main/resources/ui/package.json:236
lint-staged(andhusky) were removed fromdevDependencies, but.lintstagedrc.yamlis still present and CI runsnpx lint-stagedviascripts/lint-staged.sh. Relying onnpxhere means the version is no longer pinned to the repo (non-deterministic results) and local installs won’t have lint-staged available. Consider keepinglint-stagedas a devDependency even ifhuskyis removed, and have CI runyarn pre-commit(oryarn lint-staged) to use the locked version.
"jest-sonar-reporter": "^2.0.0",
"less": "4.1.3",
"license-check-and-add": "^4.0.5",
"organize-imports-cli": "^0.10.0",
"pinst": "^3.0.0",
"postcss": "8.4.31",
"prettier": "2.8.8",
"react-test-renderer": "^18.2.0",
"sync-i18n": "^0.0.20",
You can also share your feedback on Copilot code review. Take the survey.
🟡 Playwright Results — all passed (15 flaky)✅ 3394 passed · ❌ 0 failed · 🟡 15 flaky · ⏭️ 183 skipped
🟡 15 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
❌ TypeScript Type Check Failed (playwright)View type errors (first 50 lines)Fix locally: yarn tsc:playwright |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 161 out of 164 changed files in this pull request and generated 5 comments.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 161 out of 164 changed files in this pull request and generated 5 comments.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 162 out of 165 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (3)
openmetadata-ui/src/main/resources/ui/src/utils/QueryBuilderUtils.tsx:538
JsonLogicnow uses[key: string]: unknown, but the implementation still treats properties likeandasJsonLogic[](e.g.,flattenAndClauses(clause.and)). Withunknown, this should fail type-checking. Consider modeling the known JsonLogic structure explicitly (e.g.,and?: JsonLogic[]; or?: JsonLogic[];plus an index signature) or narrowing/casting before passing toflattenAndClauses.
openmetadata-ui/src/main/resources/ui/src/components/common/MUIAsyncTreeSelect/atoms/TreeDropdown/TreeDropdown.tsx:46handleClickAwayusesevent.currentTargetas the dropdown element and checksdropdownElement.contains(target). ForClickAwayListener,event.currentTargetis typically the document, so this condition will almost always be true and preventonClickAway()from firing. Use a ref to the dropdownPaperelement (or rely onClickAwayListener’s built-in inside/outside detection) instead ofevent.currentTarget.
openmetadata-ui/src/main/resources/ui/src/components/common/atoms/data/useDataFetching.tsx:64DataFetchingConfig.transformis typed as(data: SearchResponse<SearchIndex>) => T[], butSearchResponse<SearchIndex>represents a union of all search indices, so the default transform (hit._source) is not assignable to arbitraryT(only to the constraint{ id: string }). This will makesetEntities(transformedEntities)unsafe and is likely to fail type-checking oncetscis enabled. Consider parameterizing the hook by the specific index (SI extends SearchIndex) and usingSearchResponse<SI>throughout, or otherwise narrowing/casting_sourcetoTin a controlled way.
| "scripts": { | ||
| "start": "vite", | ||
| "build": "NODE_OPTIONS=\"${NODE_OPTIONS:---max-old-space-size=6144}\" vite build", | ||
| "preview": "vite preview", | ||
| "postinstall": "yarn run build-check", | ||
| "preinstall": "cd ../../../../.. && yarn install --frozen-lockfile && cd openmetadata-ui-core-components/src/main/resources/ui && yarn install && yarn build", | ||
| "pre-commit": "lint-staged --concurrent false", | ||
| "test": "jest --passWithNoTests", | ||
| "prepare": "cd ../../../../.. && husky install openmetadata-ui/src/main/resources/ui/.husky", | ||
| "test:watch": "jest --passWithNoTests --watch", | ||
| "test:coverage": "jest --passWithNoTests --coverage", | ||
| "test:cov-summary": "jest --passWithNoTests --coverage --coverageReporters json-summary", | ||
| "lint": "NODE_OPTIONS='--max-old-space-size=8192' eslint \"./src/**/*.{js,jsx,ts,tsx,json}\"", | ||
| "lint:fix": "NODE_OPTIONS='--max-old-space-size=8192' eslint './src/**/*.{js,jsx,ts,tsx,json}' --fix", | ||
| "lint:playwright": "eslint './playwright/**/*.{ts,tsx}'", | ||
| "pretty": "prettier . --config './.prettierrc.yaml' --ignore-path './.prettierignore' --write", | ||
| "build-check": "yarn run js-antlr && yarn run parse-schema", | ||
| "commit-check": "yarn run pretty && yarn run build", | ||
| "license-header-check": "license-check-and-add check -f .licenseheaderrc.json", |
There was a problem hiding this comment.
This PR removes scripts/lint-staged.sh (and the lint-staged tooling), but the repo-level .pre-commit-config.yaml still has a local hook (id: lint-staged) that runs scripts/lint-staged.sh. With the script removed, running pre-commit will fail. Update/remove that hook or replace it with the new yarn ui-checkstyle/equivalent entry point.
There was a problem hiding this comment.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 162 out of 165 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (4)
openmetadata-ui/src/main/resources/ui/src/utils/QueryBuilderUtils.tsx:538
JsonLogicwas changed to an index signature ofunknown, but this file accesses properties likeclause.andand treats them as arrays (e.g.,flattenAndClauses(clause.and)andif (clause.and)). Withunknown, those usages become type errors understrict(cannot useunknownin condition / pass toJsonLogic[]). Define explicit optional fields onJsonLogic(e.g.,and?: JsonLogic[]; or?: JsonLogic[];etc.) and/or narrow withArray.isArray(...)before using them, instead of relying on anunknownindex signature alone.
openmetadata-ui/src/main/resources/ui/src/components/common/atoms/table/useCellRenderer.tsx:68entity[column?.key || 'owners']no longer type-checks now thatentityis typed asT(notany) andTdoes not have an index signature. Either constrainTto include the relevant fields (e.g.,T & Record<string, unknown>) or access dynamic keys via a safe cast (e.g.,const entityRecord = entity as Record<string, unknown>), then validate the result is the expected array shape before using.length/ indexing.
openmetadata-ui/src/main/resources/ui/src/components/common/atoms/table/useCellRenderer.tsx:130- Same issue as owners renderer:
entity[column?.key || 'tags']is invalid withentity: Tand no index signature. Please use a typed accessor (column.getValue) or read dynamic keys viaRecord<string, unknown>+ runtime narrowing to the expected tags array type before using it.
openmetadata-ui/src/main/resources/ui/src/components/common/MUIAsyncTreeSelect/atoms/TreeDropdown/TreeDropdown.tsx:45 ClickAwayListeneralready only invokesonClickAwayfor clicks outside its child. The additionaldropdownElement.contains(target)check is incorrect becauseevent.currentTargetin the native document listener is typically thedocument, sodocument.contains(target)is always true and the dropdown will never close. Remove this manual containment check, or compare against an explicit ref to the dropdown element instead ofevent.currentTarget.
Code Review
|
| Auto-apply | Compact |
|
|
Was this helpful? React with 👍 / 👎 | Gitar
|



This pull request makes significant improvements to type safety and code clarity in the UI core components by replacing generic
anytypes with specificThemeColorsand related interfaces, especially in theming and button utilities. It also cleans up and modernizes the codebase by removing unused configuration files and dependencies, updating scripts, and refining formatting and Playwright-related settings.Type safety and theming improvements:
anywithThemeColorsin theme-related functions and components, such as inbutton-theme.ts,data-display-theme.ts,form-theme.ts, andnavigation-theme.ts, ensuring better type safety and clearer contracts for color configuration. [1] [2] [3] [4] [5] [6]ButtonShadows,ColorVariantConfig, etc.) for button constants and color variants, further improving type safety and code readability inbuttonConstants.ts. [1] [2] [3] [4]generateMuiPalettes.tsto use proper typings for shade keys and improved assignment toColorPalette.Codebase and configuration cleanup:
.husky/pre-commitand.lintstagedrc.yamlfiles, and dropped related dependencies (husky,lint-staged) frompackage.json, shifting away from Husky/lint-staged for pre-commit checks. [1] [2] [3]package.jsonfor linting, formatting, organizing imports, and Playwright/test utilities, making development workflows more explicit and modular.Formatting and Playwright improvements:
.prettierignoreto avoid formatting generated artifacts.check_search_index_status.mjs,check_trigger_search_index.mjs) by expanding object literals and clarifying async logic. [1] [2] [3]These changes collectively make the codebase more maintainable, type-safe, and developer-friendly.
Describe your changes:
Fixes
I worked on ... because ...
Type of change:
Checklist:
Fixes <issue-number>: <short explanation>