Skip to content

Fix operator precedence and unused variable lint errors in App.tsx#1

Open
Copilot wants to merge 2 commits intomainfrom
copilot/fix-typescript-errors
Open

Fix operator precedence and unused variable lint errors in App.tsx#1
Copilot wants to merge 2 commits intomainfrom
copilot/fix-typescript-errors

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 25, 2026

Two static analysis errors in src/App.tsx: mixed ??/|| without explicit precedence grouping, and a declared-but-never-used variable.

Changes

  • Line 261 – operator precedence: Wrap the ?? expression in parentheses so || applies to the result, not just the right operand of ??

    // Before
    custom_goal: goalOverride ?? assocGoal || undefined
    // After
    custom_goal: (goalOverride ?? assocGoal) || undefined
  • Line 607 – unused variable: Rename categories_categories to signal intentional non-use and suppress the lint error

    const _categories = [...new Set(templates.map(t => t.category))];
Original prompt

Fix the 2 remaining errors in src/App.tsx:

Error 1 - Line 261:

There's an expression mixing ?? and || operators that needs parentheses for proper precedence.

Fix: Add parentheses around the ?? part:

// Instead of:   valeur ?? default || autreChose
// Change to:    (valeur ?? default) || autreChose

Error 2 - Line 607:

The variable categories is declared but never used.

Fix: Rename the variable to _categories to indicate it's intentionally unused:

// Change:
const categories = [...new Set(templates.map(t => t.category))];

// To:
const _categories = [...new Set(templates.map(t => t.category))];

This pull request was created from Copilot chat.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sora Error Error Feb 25, 2026 9:21pm

Co-authored-by: Achbelsdn <191762831+Achbelsdn@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix TypeScript errors in App.tsx Fix operator precedence and unused variable lint errors in App.tsx Feb 25, 2026
@Achbelsdn Achbelsdn marked this pull request as ready for review February 25, 2026 21:22
Copilot AI review requested due to automatic review settings February 25, 2026 21:22
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes two lint/static analysis errors in src/App.tsx: one requiring explicit operator precedence for mixed ??/|| operators, and one for an unused variable declaration.

Changes:

  • Added parentheses to clarify operator precedence in the custom_goal expression when invoking the 'associate' function
  • Renamed unused categories variable to _categories to suppress the unused variable lint error

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

activeTemplate: MarketTemplate | null;
}) {
const categories = [...new Set(templates.map(t => t.category))];
const _categories = [...new Set(templates.map(t => t.category))];
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

The variable _categories is computed but never used. While prefixing with underscore suppresses the lint error, consider whether this computation is needed at all. If it was intended for future use (e.g., filtering or displaying categories), it should either be implemented or removed entirely to avoid unnecessary computation on every render of the MarketTab component.

If this variable is truly not needed, delete the line entirely rather than keeping dead code.

Suggested change
const _categories = [...new Set(templates.map(t => t.category))];

Copilot uses AI. Check for mistakes.
try {
const { data, error: fnErr } = await sb.functions.invoke('associate', {
body: { repo_ids: sel, custom_goal: goalOverride ?? assocGoal || undefined },
body: { repo_ids: sel, custom_goal: (goalOverride ?? assocGoal) || undefined },
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

The expression (goalOverride ?? assocGoal) || undefined will convert empty strings to undefined. This means if both goalOverride and assocGoal are empty strings, or if goalOverride is not provided and assocGoal is an empty string, the custom_goal will be undefined.

Verify this is the intended behavior. If empty strings should be preserved and sent to the API, use goalOverride ?? assocGoal instead. If empty values should be filtered out, the current implementation is correct.

Suggested change
body: { repo_ids: sel, custom_goal: (goalOverride ?? assocGoal) || undefined },
body: { repo_ids: sel, custom_goal: goalOverride ?? assocGoal },

Copilot uses AI. Check for mistakes.
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.

3 participants