Pushkal-Gupta opened a new pull request, #74402:
URL: https://github.com/apache/airflow/pull/74402

   `ts-compile-lint-ui` currently fails on main, so every open PR inherits a 
red `Static checks` whatever it touches. Two ternaries trip 
`unicorn/prefer-logical-operator-over-ternary`:
   
   ```
   src/hooks/useAdvancedSearch.ts:43:14       error  
unicorn/prefer-logical-operator-over-ternary
   src/queries/useRecentTaskStateCounts.tsx:54:22  error  
unicorn/prefer-logical-operator-over-ternary
   
   185 problems (2 errors, 183 warnings)
   ```
   
   Both arrived on 2026-10-06, in #74289 and #69619.
   
   ### `useRecentTaskStateCounts.tsx`
   
   ```diff
   -    refetchInterval: hasUnfinishedRun ? refetchInterval : false,
   +    refetchInterval: hasUnfinishedRun && refetchInterval,
   ```
   
   Straightforward, and exactly the operator the rule derives: the consequent 
is not a boolean constant, the alternate is `false`, so it wants `&&` with no 
negation.
   
   ### `useAdvancedSearch.ts` — worth a look before approving
   
   ```diff
   -      if (urlValues.includes(key)) {
   -        return true;
   -      }
   -
   -      return urlValues.includes(`-${key}`) ? false : undefined;
   +      return urlValues.includes(key) || (!urlValues.includes(`-${key}`) && 
undefined);
   ```
   
   This reads worse than what it replaces, and I would rather flag that than 
quietly ship it. Behaviour is unchanged across all three inputs:
   
   | `includes(key)` | `includes("-key")` | before | after |
   | --- | --- | --- | --- |
   | true | — | `true` | `true` |
   | false | true | `false` | `false` |
   | false | false | `undefined` | `undefined` |
   
   The readable fix does not survive the linter. Keeping the early-return `if` 
and rewriting only the ternary leaves `unicorn/prefer-ternary` complaining 
about the `if` above it, so the two rules push in opposite directions and the 
combined logical expression is what satisfies both.
   
   If a maintainer would rather keep the original and silence the rule at these 
two sites, or reconsider the rule for this package, that seems a reasonable 
call and I am happy to redo it that way. The aim here is just to get main green.
   
   ### Verification
   
   - `pnpm eslint .` across the UI: **0 errors** (159 warnings, none new)
   - `tsc --noEmit -p tsconfig.json`: clean
   - Reproduced the original failure first by installing the declared
     `[email protected]`; a stale local 73.0.0 does not flag either 
site,
     which is probably why these reached main
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to