Skip to content

🤖 Fix all outstanding eslint warnings#43387

Draft
iansltx wants to merge 13 commits intomainfrom
lint-cleanup
Draft

🤖 Fix all outstanding eslint warnings#43387
iansltx wants to merge 13 commits intomainfrom
lint-cleanup

Conversation

@iansltx
Copy link
Copy Markdown
Member

@iansltx iansltx commented Apr 10, 2026

No description provided.

iansltx added 7 commits April 9, 2026 14:38
Zed + Opus 4.6; prompt: Run `make lint-js`. You'll get a lot of warnings back. Fix _at least_ the easiest 20%.
Zed + Opus 4.6; prompt: Resolve the low-hanging fruit on `no-explicit-any`. Goal is to cut the number of warnings there in half.
Zed + Opus 4.6, same conversation as the primary commit; prompt: Nice. Next up, fix the `consistent-return` issues.
Zed + Opus 4.6, same conversation as previous commit; prompt: Next, fix the `react/no-unused-prop-types` warnings.
Zed + Opus 4.6, same conversation as previous commit; prompt: Next, fix the `react-hooks/exhaustive-deps` issues
Zed + Opus 4.6 from same conversation as last commit; prompt: Next, fix the `@typescript-eslint/no-non-null-assertion` issues
Zed + Opus 4.6; prompt: Next, fix no-constant-condition and no-alert issues, then react/no-danger, at which point we should have a clean linting run
Zed + Opus 4.6; prompt: Tests are broken on this branch right now, including an OOM. See job-logs.txt for more details (particularly toward the end of the file). Fix the issues so tests pass.
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

❌ Patch coverage is 50.68493% with 72 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.87%. Comparing base (3c1b8fc) to head (6bbd300).

Files with missing lines Patch % Lines
frontend/interfaces/package_type.ts 23.52% 13 Missing ⚠️
...policies/ManagePoliciesPage/ManagePoliciesPage.tsx 0.00% 12 Missing ⚠️
frontend/utilities/helpers.tsx 50.00% 7 Missing ⚠️
...crets/components/AddSecretModal/AddSecretModal.tsx 0.00% 4 Missing ⚠️
...ditionalAccessModal/OktaConditionalAccessModal.tsx 0.00% 4 Missing ⚠️
...policies/edit/components/PolicyForm/PolicyForm.tsx 42.85% 4 Missing ⚠️
...tPage/components/SelectRoleForm/SelectRoleForm.tsx 0.00% 3 Missing ⚠️
...tailsPage/modals/RunScriptModal/RunScriptModal.tsx 0.00% 3 Missing ⚠️
...re/SelfService/SelfServiceCard/SelfServiceCard.tsx 25.00% 3 Missing ⚠️
...ts/SyntaxHighlightedCode/SyntaxHighlightedCode.tsx 33.33% 2 Missing ⚠️
... and 14 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #43387      +/-   ##
==========================================
- Coverage   66.90%   66.87%   -0.03%     
==========================================
  Files        2596     2591       -5     
  Lines      208220   207635     -585     
  Branches     9208     9226      +18     
==========================================
- Hits       139314   138861     -453     
+ Misses      56235    56144      -91     
+ Partials    12671    12630      -41     
Flag Coverage Δ
frontend 54.73% <50.68%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.


interface IAppProps {
children: JSX.Element;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

destruct type we expect

const [addedSoftwareToken, setAddedSoftwareToken] = useState<string | null>(
null
);
const [addedSoftwareToken] = useState<string | null>(null);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why is this a use state then, double check.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

⏺ So the intent was: when you add software via VPP or package upload, set a token to trigger a React Query refetch on the sibling software
list. The token goes into the query key, so changing it invalidates the cache.

The problem is setAddedSoftwareToken is never called — the wiring from the add-software flow to the setter was either never completed or
got lost in a refactor. Let me check if React Query invalidation is handling this differently now:

Searched for 4 patterns (ctrl+o to expand)

⏺ The add-software flows (VPP, Fleet-maintained, custom package) all now use queryClient.invalidateQueries({ queryKey: [{ scope:
"software-titles" }] }) to bust the cache directly. The addedSoftwareToken approach was the original solution from PR #20973, but it's
been superseded by proper query invalidation. The token mechanism is dead code now — setAddedSoftwareToken is never called, and
addedSoftwareToken is permanently null.

Safe to remove entirely. It's vestigial from before the invalidateQueries calls were added.

TODO: Removing this completely

<SoftwareAndroidForm
onSubmit={onAddSoftware}
onCancel={goBackToSoftwareTitles}
onClickPreviewEndUserExperience={onClickPreviewEndUserExperience}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

look to see if this was intentional

onSubmit,
isLoading = false,
onCancel,
onClickPreviewEndUserExperience,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

look to see if this was intentional

setLastEditedQueryDiscardData(DEFAULT_QUERY.discard_data);
}
}, [queryId]);
}, [
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

will need to go through all use effect dependencies, I vaguely remember adverse effects many moons ago

hostStatusWebhookHostPercentage,
(val) => `${val}%`
),
// intentionally omit dependency so options only computed initially
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this. So will need to fix accordingly

// it's safe to assume that frequency is a number
(frequency: number | string) => `${frequency as number} days`
),
// intentionally leave activityExpiryWindow out of the dependencies, so that the custom
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this. So will need to fix accordingly

{}
);
const [error, setError] = useState<Error | null>(null);
const [error] = useState<Error | null>(null);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

wut


// Create a simple mock SVG component for matched icons
const MockSvgIcon = ({ width, height, className }: any) => (
/* eslint-disable react/prop-types */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

don't be lazy bot

iansltx added a commit that referenced this pull request Apr 11, 2026
## Issue
- First batch of @iansltx 's work of cleaning up lint warnings #43387 

## Description
- Quick PR review and grabbed as many confirmed low-risk quick wins as I
could `git checkout lint-cleanup <file/path/1> <file/path/2>`

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Release Notes

This release contains internal code improvements with one minor UI
tweak:

* **Style**
* Dropdown menu background color adjusted for clearer contrast in action
lists
* **Refactor**
* Improved type safety across the codebase with stricter TypeScript
annotations
  * Removed unused imports and constants to reduce code clutter
* Enhanced React hook dependency arrays for more consistent component
behavior
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Rachel Perkins <rachel@Rachels-MacBook-Pro.local>
Co-authored-by: Ian Littman <iansltx@gmail.com>
/>
);
}, [curTargetedPlatformFilter, queryParams, router]);
}, [curTargetedPlatformFilter, handlePlatformFilterDropdownChange]);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

setCurrentTeam(querysTeam);
}
}, [storedQuery]);
}, [storedQuery, availableTeams, setCurrentTeam]);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Adding availableTeams is safe and correct — there's a real scenario where storedQuery loads before availableTeams is populated, so the
.find() returns undefined. When availableTeams later fills in, the effect should re-run.

Adding setCurrentTeam is safe but unnecessary — it's a context setter, so its reference is stable. Including it won't cause extra re-runs,
and it satisfies the exhaustive-deps lint rule.

const { hosts: hostResponses, uiHostCounts, serverHostCounts, errors } =
campaign || {};

const totalRowsCount = get(campaign, ["hosts_count", "successful"], 0);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

unused, we use uiHostCounts defined above


const onQueryChange = useCallback(
(queryData: any) => {
(queryData: ITableQueryData) => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍 it's what we do elsewhere too

return IPadOSUpdateScreenshot;
default:
MacOSUpdateScreenshot;
return MacOSUpdateScreenshot;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice catch

INumberDropdownOption,
false,
GroupBase<INumberDropdownOption>
>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

@RachelElysia RachelElysia mentioned this pull request Apr 13, 2026
1 task
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.

2 participants