Skip to content

Refactor/lint electron#24

Merged
kilbot merged 9 commits intomainfrom
refactor/lint-electron
Jan 30, 2026
Merged

Refactor/lint electron#24
kilbot merged 9 commits intomainfrom
refactor/lint-electron

Conversation

@kilbot
Copy link
Copy Markdown
Contributor

@kilbot kilbot commented Jan 29, 2026

Summary by CodeRabbit

  • New Features

    • Automated translation string extraction workflow triggered on source code updates.
  • Chores

    • Removed unused Android immersive navigation mode handling.
    • Removed development query devtools interface.
    • Cleaned up unused imports and type declarations across codebase.
    • Refactored ref mutations to follow React best practices.
    • Updated ESLint configuration to exclude certain packages from linting and testing.

✏️ Tip: You can customize this high-level summary in your review settings.

Safe, no-behavior-change fixes across the monorepo:
- Remove 75+ unused imports, variables, and type declarations
- Fix no-undef errors by adding eslint-env node to Node.js scripts
- Fix react/no-unescaped-entities by escaping apostrophes in JSX
- Remove unused catch parameters
- Add missing displayName to forwardRef components
- Fix missing key props in iterators
- Replace empty interfaces with type aliases

Packages affected:
- @wcpos/core: 82 → 36 problems
- @wcpos/components: 43 → 25 problems
- @wcpos/web-bundle: 2 → 2 problems (all fixed, remaining are no-undef)
- @wcpos/main: 4 → 2 problems
- @wcpos/utils: 4 → 3 problems

Total reduction: 213 → 138 problems (~35% reduction)
Fixes for hooks dependency issues:
- Add eslint-disable comments for intentional patterns (cache busters, identity keys)
- Remove unnecessary dependencies where safe
- Add txInstance to translations context dependencies
- Fix stable ref patterns in collapsible primitives
- Remove unused type declarations and imports from query hooks

Query hooks cleaned:
- categories.tsx, customers.tsx, orders.tsx, products.ts
- tags.tsx, tax-rates.tsx, variations.ts

Packages affected:
- @wcpos/query: 33 → 15 problems
- @wcpos/components: Added eslint-disable for intentional patterns

Total reduction: 138 → 116 problems
Fixed mutation-during-render issues in UI settings forms:
- Moved ref mutations to useEffect (customers, orders, logs, reports, pos-cart, pos-products, products)
- Added eslint-disable comments for intentional ref mutations from useObservableRef

Fixed mutation issues in:
- pos/cart/cells/actions.tsx - moved newRowUUIDs update to useEffect
- use-date-format.tsx - suppress warning for intentional visibleRef mutation
- pos/products/index.tsx - suppress for expandedRef mutations in table config
- products/products.tsx - same expandedRef pattern

Note: Some react-compiler "skipped optimizing" warnings remain as an acceptable
trade-off for maintaining the ref mutation patterns required by the architecture.
Removed unused files:
- packages/components/src/icon/styles.ts (legacy styled-components code)
- packages/query/src/devtools/ folder (commented out, uses non-existent components)
- apps/main/hooks/use-sticky-immersive-reset.ts (unused, packages not installed)

Cleanup:
- Removed commented export from packages/query/src/index.ts

This resolves 8 import/no-unresolved errors.
Updates apps/electron submodule to include:
- Remove unused catch parameter 'e' in database.ts
- Remove unused ROOT, SCHEME imports in util.ts
- Use LatestRelease interface to type data in update.ts
- Add eslint-disable comments for intentional require() calls

All 11 Electron package warnings resolved.
Instead of removing submodules from the workspace (which breaks builds),
use turbo filters to exclude them from lint and test tasks:

- Keep apps/electron and apps/web in pnpm-workspace.yaml
- Add --filter='!@wcpos/app-electron' --filter='!@wcpos/web-bundle' to lint/test scripts
- Keep eslint ignores for the submodule directories

This allows:
- pnpm dev:electron and build commands to still work
- lint/test at root to skip submodules (they manage their own)
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

This PR performs extensive code cleanup and refactoring across the monorepo, including: adding a GitHub Actions workflow for automated translation updates, removing unused imports and type declarations, relocating mutable ref assignments from render time to useEffect hooks, eliminating devtools components, and adding ESLint pragmas to suppress linting warnings for intentional patterns.

Changes

Cohort / File(s) Summary
Workflow & Scripts
.github/workflows/update-translations.yml, package.json, apps/main/package.json
Added new translation extraction workflow triggered on source file changes. Updated test and lint scripts to exclude app-electron and web-bundle scopes. Removed hooks directory from linting scope.
Component Import Cleanup
packages/components/src/{collapsible/primitives.web.tsx, combobox/utils/fuzzy-search.ts, command/index.tsx, data-table/*.tsx, format/list.tsx, format-number/format-number.tsx, icon/styles.ts, input/index.tsx, label/index.tsx, loader/index.tsx, logo/logo.tsx, numpad/index.tsx, pressable/index.tsx, print/text.tsx, select/index.tsx, tooltip/index.web.tsx, virtualized-list/virtualized-list.tsx, webview/index.tsx}
Removed numerous unused imports (React, ActivityIndicator, FadeInUp/FadeOutUp, Platform, PressableRef, LayoutChangeEvent, isRxDocument, etc.). Changed CommandSeparatorProps from interface to type alias. Removed PressableIcon styled component export. Updated Text import to named export in format-number. Added displayName assignments to Pressable and Numpad components. Updated Item signature with explicit type annotation. Added ESLint disable pragmas for augmentedRef and other patterns.
Core Context & Utilities Cleanup
packages/core/src/{contexts/**/*.ts, lib/url/parse-link-header.ts, utils/merge-stores.ts}, packages/utils/src/logger/index.ts
Removed unused React and RxDB imports. Simplified error handling in catch clauses (removed explicit error bindings). Changed TranslationProvider to collect only translationsState. Updated merge-stores to use Set-based lookup instead of map-based for remote store IDs.
Query Hooks Type Removals
packages/query/src/hooks/{categories.tsx, customers.tsx, orders.tsx, products.ts, tags.tsx, variations.ts, tax-rates.tsx}
Removed previously exported type declarations (ProductDocument variants, APIQueryParams interfaces) from multiple hook files. Added explicit parameter typing to filterApiQueryParams functions. Created new categories.ts and tags.ts files with filterApiQueryParams utility.
Ref Assignment Refactoring
packages/core/src/screens/main/{customers/ui-settings-form.tsx, logs/ui-settings-form.tsx, orders/ui-settings-form.tsx, pos/{cart/ui-settings-form.tsx, products/ui-settings-form.tsx}, products/ui-settings-form.tsx, reports/ui-settings-form.tsx}
Moved buttonPressHandlerRef.current assignments from render time to useEffect hooks with appropriate dependency arrays. Added explanatory comments and ESLint disable pragmas for intentional mutations in effects.
Table & Row Mutations
packages/core/src/screens/main/pos/cart/{cells/actions.tsx, rows/{line-item.tsx, shipping-line.tsx, fee-line.tsx}, table.tsx}
Removed TableProps import and RenderItem type aliases from row components. Moved newRowUUIDs mutations from render to useEffect in actions. Simplified CartTable imports and changed meta onChange type to unknown. Refactored cart-item-buttons to remove router-based navigation.
Cart & Orders Cleanup
apps/main/app/(app)/(drawer)/(pos)/(modals)/cart/add-misc-product.tsx, packages/core/src/screens/main/pos/{cart/{customer.tsx, index.tsx}, hooks/{use-add-product.ts, use-add-variation.ts, use-cart-lines.ts}}
Removed Dialog and React imports from add-misc-product component. Removed Button imports from cart index. Deleted local type aliases (OrderDocument, LineItem, ShippingLine) from multiple files.
Product & Inventory Cleanup
packages/core/src/screens/main/pos/products/{index.tsx, scanner-button.tsx, ui-settings-form.tsx}, packages/core/src/screens/main/products/{add-product/index.tsx, cells/actions.tsx, products.tsx, ui-settings-form.tsx}
Added ESLint pragmas around setRowExpanded helpers to bypass minification issues. Removed disconnect from useWebSerialBarcodeScanner hook. Refactored reset handler to use dedicated handleReset function with useEffect assignment. Removed Link import from products cells.
Devtools & Query Exports
packages/query/src/{devtools/{devtools.tsx, index.tsx}, index.ts, use-query.ts, use-relational-query.ts, use-replication-state.ts}
Completely removed Devtools UI component and QueryDevtools wrapper (102 lines deleted). Removed commented QueryDevtools export from index. Added ESLint disable comments to suppress exhaustive-deps warnings in useMemo/useCallback blocks.
Unused Imports Removal
apps/main/hooks/use-sticky-immersive-reset.ts, packages/core/src/screens/main/{hooks/{use-base-tax-location.ts, use-collection.ts, use-date-format.tsx, use-tax-incl-or-excl.ts}, components/{incl-excl-tax-radio-group.tsx, tax-display-radio-group.tsx, product/filter-bar/index.tsx}, contexts/tax-rates/tax-rates.helpers.ts, hooks/barcodes/use-barcode-detection.ts, pos/contexts/current-order/use-new-order.ts, pos/cart/cells/edit-shipping-line/form.tsx, reports/orders/index.tsx}, packages/core/src/modules/versions/versions.stories.tsx
Removed unused React, RxDB, lodash, and rxjs imports across numerous files. Deleted entire use-sticky-immersive-reset.ts hook file containing Android immersive mode logic.
ESLint Configuration
packages/eslint/index.js
Added global ignore patterns for apps/electron and apps/web directories to top-level eslint config array.
Submodule Update
apps/electron
Updated electron submodule commit reference.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Poem

🐰 Unused imports drift away, types cleaned with care,
Refs find their rightful home in effects fair,
Devtools say goodbye to their last stand,
A monorepo polished across the land! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 23.08% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Refactor/lint electron' is vague and overly broad, using generic terms that don't clearly convey the actual scope of changes across the monorepo. Consider a more specific title that captures the primary change, such as 'Clean up unused imports and remove dev tools' or 'Remove translation extraction workflow and electron app submodule' to better reflect the actual modifications.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/lint-electron

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Triggers extract-js workflow in wcpos/translations when TS/TSX files
change on main, using GitHub App token for cross-repo access.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
packages/components/src/format-number/format-number.tsx (2)

132-139: ⚠️ Potential issue | 🔴 Critical

Bug: index is undefined in getMaskAtIndex.

The function references index on line 138, but no such parameter is defined. The function is called with an argument (getMaskAtIndex(hashCount) on line 150), but the definition doesn't accept any parameters.

🐛 Proposed fix
-	const getMaskAtIndex = React.useCallback(() => {
+	const getMaskAtIndex = React.useCallback((index: number) => {
 		const { mask = ' ' } = props;
 		if (typeof mask === 'string') {
 			return mask;
 		}

 		return mask[index] || ' ';
-	}, [props]);
+	}, [props.mask]);

Note: The dependency array should also be narrowed to props.mask since that's the only property accessed.


172-173: ⚠️ Potential issue | 🟡 Minor

Type mismatch: format function expects number but receives string.

The format prop is typed as (value: number) => string (line 28), but formattedValue is a string. This type inconsistency could lead to unexpected behavior.

Consider updating the type definition to match actual usage:

-	format?: string | ((value: number) => string);
+	format?: string | ((value: string) => string);

Or ensure the value is converted to a number before calling the format function.

packages/core/src/screens/main/components/header/user-menu.tsx (1)

58-58: ⚠️ Potential issue | 🟡 Minor

Property name case mismatch: localId vs localID prevents disabled state from being applied.

Line 58 uses store.localId (lowercase 'd'), but the StoreDocument schema defines the property as localID (uppercase 'D'). This causes the comparison to always evaluate to false (comparing undefined to a string), so the disabled state will never apply even for the current store.

Proposed fix
 <DropdownMenuItem
   key={store.localID}
   onPress={() => switchStore(store)}
-  disabled={store.localId === currentStoreID}
+  disabled={store.localID === currentStoreID}
 >
packages/core/src/screens/main/pos/cart/table.tsx (1)

208-210: ⚠️ Potential issue | 🟡 Minor

Replace console.log and avoid any in table meta onChange.
Use the logger and a safer type to align with project rules.

🔧 Suggested fix
 import { Text } from '@wcpos/components/text';
+import log from '@wcpos/utils/logger';
@@
-		onChange: (data: any) => {
-			console.log('onChange called without handler', data);
-		},
+		onChange: (data: unknown) => {
+			log.warn('onChange called without handler', data);
+		},
🤖 Fix all issues with AI agents
In @.github/workflows/update-translations.yml:
- Around line 1-33: The workflow uses an outdated
actions/create-github-app-token@v1 and lacks fail-fast handling for the shell
command; update the step that uses actions/create-github-app-token to a current
version (use `@v2` or pin to `@v2.2.1`) in the "Generate GitHub App token" step, and
make the "Trigger translations repo extraction" step's shell run safer by
enabling fail-fast (e.g., use set -e or equivalent) so the gh workflow run
command fails the job on errors; reference these changes in the steps named
"Generate GitHub App token" and "Trigger translations repo extraction" within
the trigger job.

In `@apps/main/app/`+not-found.tsx:
- Line 14: Replace the HTML entity &apos; inside the JSX text with a real
apostrophe so it renders correctly; locate the <Text> element in +not-found.tsx
(the JSX node containing "This screen doesn&apos;t exist.") and change the
string to use either a plain apostrophe ("This screen doesn't exist.") or the
Unicode escape form ({'\u0027'}) inside the Text component.

In `@apps/main/components/root-error.tsx`:
- Line 95: The JSX text currently uses the HTML entity &apos; which will render
literally; update the Text node in root-error.tsx (the <Text
style={styles.subtitle}> element in the RootError component) to use a real
apostrophe or an expression string instead (e.g., {"There's an error"} or
"There's an error") so it displays as "There's an error" instead of
"There&apos;s an error".

In `@packages/core/src/screens/main/pos/cart/ui-settings-form.tsx`:
- Around line 40-44: This useEffect is required because we must assign the
resetUI function to the mutable buttonPressHandlerRef after render/mount rather
than during render to avoid mutating refs during rendering and to ensure the
dialog/button handler is synchronized with the mounted component lifecycle;
update the comment to state that useEffect sets buttonPressHandlerRef.current =
resetUI post-mount so the external dialog/button handler sees the latest resetUI
without causing render-time side-effects.

In `@packages/query/src/hooks/categories.tsx`:
- Around line 4-6: Rename the file from categories.tsx to categories.ts (no JSX
present) and remove the empty JSDoc comment at the top; inside the file ensure
the function filterApiQueryParams retains the explicit type signature (params:
Record<string, unknown>) => Record<string, unknown> (or at least keep the
current typed params) and export/usage unchanged, and also update the analogous
function in tags.tsx to include the same Record<string, unknown> type for
consistency (and rename tags.tsx to tags.ts if it likewise contains no JSX).
🧹 Nitpick comments (13)
packages/components/src/virtualized-list/virtualized-list.tsx (1)

83-87: Consider adding type annotation for children parameter.

The Item component's children parameter lacks a type annotation. While this is pre-existing code, it conflicts with the project's strict typing guideline.

♻️ Suggested type annotation
-function Item({ children }) {
+function Item({ children }: { children: React.ReactNode }) {
 	// const { item, index } = useItemContext();
 
 	return <>{children}</>;
 }

Also, the commented-out code could be removed if it's no longer needed.

packages/components/src/format/list.tsx (1)

12-15: Prefer a stable key over index to avoid reorder bugs.
If array can reorder or have insertions/removals, using index can cause state mismatches. Since items are strings, prefer item (or \${item}-${index}`` if duplicates are possible).

Proposed change
-					return <Text key={index}>{item}, </Text>;
+					return <Text key={item}>{item}, </Text>;
packages/core/src/screens/main/components/customer-select.tsx (1)

100-100: Consider replacing any with a proper type.

The query parameter uses any, which violates the coding guideline to use strict types. Since useQuery is from @wcpos/query, consider typing it properly.

♻️ Suggested improvement
-export function CustomerList({ query, withGuest }: { query: any; withGuest: boolean }) {
+export function CustomerList({ query, withGuest }: { query: ReturnType<typeof useQuery>; withGuest: boolean }) {

Or define a dedicated type/interface for the query object if ReturnType<typeof useQuery> is too verbose.

As per coding guidelines: "Do not use 'any' type; use strict types and generics instead".

packages/query/src/use-relational-query.ts (1)

91-105: Consider clarifying the ESLint disable comment.

The comment on line 103 only mentions parentIdentityKey, but the re-registration logic is also affected by childIdentityKey (transitively through registerQueries). While functionally correct, updating the comment to reference both identity keys would improve clarity.

📝 Suggested comment update
-		// eslint-disable-next-line react-hooks/exhaustive-deps -- parentIdentityKey triggers re-registration when query identity changes
+		// eslint-disable-next-line react-hooks/exhaustive-deps -- identity keys trigger re-registration when query identity changes (childIdentityKey via registerQueries)
packages/components/src/command/index.tsx (2)

61-72: Avoid using any type for the scroll event parameter.

The event: any violates the coding guidelines. Consider using the proper React Native type for scroll events.

♻️ Suggested fix
+import { Pressable, ScrollView, Text, View, NativeScrollEvent, NativeSyntheticEvent } from 'react-native';
...
 	const handleScroll = React.useCallback(
-		(event: any) => {
+		(event: NativeSyntheticEvent<NativeScrollEvent>) => {
 			const { layoutMeasurement, contentOffset, contentSize } = event.nativeEvent;

As per coding guidelines: "Do not use 'any' type; use strict types and generics instead".


107-109: Replace hardcoded color with semantic color class.

The hardcoded backgroundColor: '#e5e7eb' and inline style violate the styling guidelines. Consider using a semantic color class via className for theme compatibility.

♻️ Suggested fix
 const CommandSeparator = React.forwardRef<View, CommandSeparatorProps>((props, ref) => (
-	<View ref={ref} style={[{ height: 1, backgroundColor: '#e5e7eb' }]} {...props} />
+	<View ref={ref} className="h-px bg-muted" {...props} />
 ));

As per coding guidelines: "Always prefer semantic color classes (bg-background, bg-card, bg-sidebar, bg-muted, bg-table-header) over hardcoded colors" and "Prefer className over inline styles".

packages/components/src/format-number/format-number.tsx (1)

186-188: Add explicit type annotation for val parameter.

The val parameter has an implicit any type, which violates the coding guideline to use strict types. As per coding guidelines: "Do not use 'any' type; use strict types and generics instead."

♻️ Proposed fix
-	const formatInput = React.useCallback((val) => {
+	const formatInput = React.useCallback((val: string) => {
 		return val;
 	}, []);
packages/components/src/data-table/index.tsx (1)

98-99: Replace console.log with logger.

Per coding guidelines, use the logger library exclusively for logging instead of console.log.

Suggested fix
+import log from '@wcpos/utils/logger';
 onChange: (data: any) => {
-	console.log('onChange called without handler', data);
+	log.warn('onChange called without handler', data);
 },

As per coding guidelines: "Use the logger library exclusively for logging; DO NOT use console.log. Import: import log from '@wcpos/utils/logger'"

packages/components/src/data-table/index.web.tsx (1)

87-88: Replace console.log with logger.

Same issue as in index.tsx - per coding guidelines, use the logger library instead of console.log.

Suggested fix
+import log from '@wcpos/utils/logger';
 onChange: (data: any) => {
-	console.log('onChange called without handler', data);
+	log.warn('onChange called without handler', data);
 },

As per coding guidelines: "Use the logger library exclusively for logging; DO NOT use console.log. Import: import log from '@wcpos/utils/logger'"

packages/core/src/utils/merge-stores.ts (1)

41-41: Avoid using any type.

The [key: string]: any index signature violates the coding guideline to use strict types instead of any. Consider defining a proper interface for the store object or using unknown with type guards.

♻️ Suggested improvement
-	remoteStores: { id: number; [key: string]: any }[];
+	remoteStores: { id: number; [key: string]: unknown }[];

Or better, define a dedicated type:

interface RemoteStore {
	id: number;
	name?: string;
	// ... other known properties
}

As per coding guidelines: "Do not use 'any' type; use strict types and generics instead".

packages/query/src/hooks/categories.tsx (2)

1-8: Consider renaming file extension from .tsx to .ts.

This file contains no JSX or React code—only a pure utility function. Using the .tsx extension is unnecessary and could be misleading. Consider renaming to categories.ts for consistency.


1-3: Empty JSDoc comment provides no value.

The JSDoc block is empty and doesn't document anything useful. Either add meaningful documentation or remove it.

♻️ Suggested fix
-/**
- *
- */
 const filterApiQueryParams = (params: Record<string, unknown>) => {

Or add useful documentation:

-/**
- *
- */
+/**
+ * Filters API query parameters before sending to the WooCommerce API.
+ * `@param` params - The query parameters to filter
+ * `@returns` The filtered parameters
+ */
 const filterApiQueryParams = (params: Record<string, unknown>) => {
packages/core/src/screens/main/components/header/user-menu.tsx (1)

103-103: Consider using a semantic color class for the hover state.

hover:bg-white/10 is a hardcoded color that may not adapt well to all themes. As per coding guidelines, prefer semantic color classes to ensure theme compatibility.

Comment on lines +1 to +33
name: Update Translation Strings

on:
push:
branches:
- main
paths:
- 'apps/**/*.ts'
- 'apps/**/*.tsx'
- 'packages/**/*.ts'
- 'packages/**/*.tsx'
workflow_dispatch:

jobs:
trigger:
runs-on: ubuntu-latest
steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.TRANSLATION_APP_ID }}
private-key: ${{ secrets.TRANSLATION_APP_PRIVATE_KEY }}
owner: wcpos
repositories: translations

- name: Trigger translations repo extraction
run: |
gh workflow run extract-js.yml \
--repo wcpos/translations \
--field ref="${{ github.sha }}"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

actions/create-github-app-token latest version GitHub Action

💡 Result:

The latest release of actions/create-github-app-token is v2.2.1 (released 2025-12-05). [1]

In workflows you can either:

  • Track the latest v2.x automatically: actions/create-github-app-token@v2 (current major recommended in the Marketplace docs) [2]
  • Or pin to the current latest exact release: actions/create-github-app-token@v2.2.1 [1]

Sources: [1] [2]


Update actions/create-github-app-token to a current version.

The workflow uses actions/create-github-app-token@v1, which is outdated. The latest stable version is v2.2.1. Update to @v2 (for automatic major version updates) or pin to @v2.2.1 for consistency.

Additionally, consider adding error handling to the gh workflow run command by including set -e to fail explicitly on errors, improving observability if the target workflow doesn't exist or authentication fails.

♻️ Suggested error handling
       - name: Trigger translations repo extraction
         run: |
+          set -e
           gh workflow run extract-js.yml \
             --repo wcpos/translations \
             --field ref="${{ github.sha }}"
         env:
           GH_TOKEN: ${{ steps.app-token.outputs.token }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
name: Update Translation Strings
on:
push:
branches:
- main
paths:
- 'apps/**/*.ts'
- 'apps/**/*.tsx'
- 'packages/**/*.ts'
- 'packages/**/*.tsx'
workflow_dispatch:
jobs:
trigger:
runs-on: ubuntu-latest
steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.TRANSLATION_APP_ID }}
private-key: ${{ secrets.TRANSLATION_APP_PRIVATE_KEY }}
owner: wcpos
repositories: translations
- name: Trigger translations repo extraction
run: |
gh workflow run extract-js.yml \
--repo wcpos/translations \
--field ref="${{ github.sha }}"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
name: Update Translation Strings
on:
push:
branches:
- main
paths:
- 'apps/**/*.ts'
- 'apps/**/*.tsx'
- 'packages/**/*.ts'
- 'packages/**/*.tsx'
workflow_dispatch:
jobs:
trigger:
runs-on: ubuntu-latest
steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.TRANSLATION_APP_ID }}
private-key: ${{ secrets.TRANSLATION_APP_PRIVATE_KEY }}
owner: wcpos
repositories: translations
- name: Trigger translations repo extraction
run: |
set -e
gh workflow run extract-js.yml \
--repo wcpos/translations \
--field ref="${{ github.sha }}"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
🤖 Prompt for AI Agents
In @.github/workflows/update-translations.yml around lines 1 - 33, The workflow
uses an outdated actions/create-github-app-token@v1 and lacks fail-fast handling
for the shell command; update the step that uses actions/create-github-app-token
to a current version (use `@v2` or pin to `@v2.2.1`) in the "Generate GitHub App
token" step, and make the "Trigger translations repo extraction" step's shell
run safer by enabling fail-fast (e.g., use set -e or equivalent) so the gh
workflow run command fails the job on errors; reference these changes in the
steps named "Generate GitHub App token" and "Trigger translations repo
extraction" within the trigger job.

Comment on lines +4 to 6
const filterApiQueryParams = (params: Record<string, unknown>) => {
return params;
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

cat -n packages/query/src/hooks/categories.tsx

Repository: wcpos/monorepo

Length of output: 245


🏁 Script executed:

# Find all instances of filterApiQueryParams in the codebase
rg "filterApiQueryParams" --type ts --type tsx -B 2 -A 5

Repository: wcpos/monorepo

Length of output: 85


🏁 Script executed:

# Search for filterApiQueryParams function definitions specifically
ast-grep --pattern 'const filterApiQueryParams = ($$$) => {
  $$$
}' -A 3

Repository: wcpos/monorepo

Length of output: 10826


File extension and empty JSDoc comment should be addressed.

The type annotation improvement with Record<string, unknown> is good and complies with guidelines. The function's no-op behavior (returning params unchanged) is intentional—it mirrors the identical pattern in tags.tsx, as categories and tags don't require query parameter filtering unlike products, orders, and customers.

However, two minor issues should be fixed:

  1. Change file extension from .tsx to .ts since there is no JSX or React code
  2. Remove the empty JSDoc comment block (lines 1-3)

Also consider adding the same type annotation to tags.tsx for consistency, as it currently lacks typing.

🤖 Prompt for AI Agents
In `@packages/query/src/hooks/categories.tsx` around lines 4 - 6, Rename the file
from categories.tsx to categories.ts (no JSX present) and remove the empty JSDoc
comment at the top; inside the file ensure the function filterApiQueryParams
retains the explicit type signature (params: Record<string, unknown>) =>
Record<string, unknown> (or at least keep the current typed params) and
export/usage unchanged, and also update the analogous function in tags.tsx to
include the same Record<string, unknown> type for consistency (and rename
tags.tsx to tags.ts if it likewise contains no JSX).

kilbot and others added 2 commits January 30, 2026 17:48
- Wrap non-string items in keyed React.Fragment to avoid key warnings
- Clarify useEffect comment explaining animation callback timing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix getMaskAtIndex missing index parameter in format-number
- Fix localId vs localID case mismatch in user-menu
- Fix HTML entities rendering literally in JSX (+not-found, root-error)
- Replace console.log/any with comment/unknown in cart table
- Improve useEffect comments in ui-settings-form
- Add type annotation for children in virtualized-list
- Rename categories.tsx/tags.tsx to .ts (no JSX) and add typing
- Update actions/create-github-app-token to v2

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@packages/query/src/hooks/categories.ts`:
- Around line 1-5: Add a colocated unit test file for the filterApiQueryParams
utility that asserts it returns the exact same object reference passed in
(identity passthrough). Create a file named filterApiQueryParams.test.ts next to
the source, import filterApiQueryParams, call it with a single object instance
and use a strict identity assertion (e.g., expect(result).toBe(input)) and also
include a simple primitive or empty object case to cover edge inputs; ensure the
test runs with the repository test runner configuration.

In `@packages/query/src/hooks/tags.ts`:
- Around line 1-5: Add a colocated unit test file
packages/query/src/hooks/tags.test.ts that imports the filterApiQueryParams
function and asserts its identity passthrough behavior (e.g., passing an object
with various keys and verifying the returned value is deeply equal to the input,
and optionally that it returns the same reference when appropriate). Name the
test suite to reference filterApiQueryParams and include at least one test case
for a typical params object and one for an empty object to cover edge cases.

Comment on lines +1 to +5
const filterApiQueryParams = (params: Record<string, unknown>) => {
return params;
};

export { filterApiQueryParams };
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add a colocated unit test for this utility.

This new utility should have a colocated *.test.ts to validate the identity passthrough behavior (e.g., ensuring the same object reference is returned).
As per coding guidelines: Add unit tests in *.test.ts files colocated with source code for utility functions, helpers, business logic, data transformations, and hooks with complex logic.

🤖 Prompt for AI Agents
In `@packages/query/src/hooks/categories.ts` around lines 1 - 5, Add a colocated
unit test file for the filterApiQueryParams utility that asserts it returns the
exact same object reference passed in (identity passthrough). Create a file
named filterApiQueryParams.test.ts next to the source, import
filterApiQueryParams, call it with a single object instance and use a strict
identity assertion (e.g., expect(result).toBe(input)) and also include a simple
primitive or empty object case to cover edge inputs; ensure the test runs with
the repository test runner configuration.

Comment on lines +1 to +5
const filterApiQueryParams = (params: Record<string, unknown>) => {
return params;
};

export { filterApiQueryParams };
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add a colocated unit test for this utility.

This is a new utility function, but there’s no accompanying *.test.ts coverage shown. Please add a small test (e.g., verifying the identity passthrough behavior) in a colocated test file such as packages/query/src/hooks/tags.test.ts.
As per coding guidelines: Add unit tests in *.test.ts files colocated with source code for utility functions, helpers, business logic, data transformations, and hooks with complex logic.

🤖 Prompt for AI Agents
In `@packages/query/src/hooks/tags.ts` around lines 1 - 5, Add a colocated unit
test file packages/query/src/hooks/tags.test.ts that imports the
filterApiQueryParams function and asserts its identity passthrough behavior
(e.g., passing an object with various keys and verifying the returned value is
deeply equal to the input, and optionally that it returns the same reference
when appropriate). Name the test suite to reference filterApiQueryParams and
include at least one test case for a typical params object and one for an empty
object to cover edge cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant