Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Apply recommended lint rules #3524

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

nicholas-codecov
Copy link
Contributor

@nicholas-codecov nicholas-codecov commented Nov 21, 2024

Description

Note

Requires #3508 to be merged before reviewing.

This PR applies the recommended rules from eslint and typescript-eslint

Ticket: codecov/engineering-team#2124

Notable Changes

  • Enable eslint:recommended and plugin:@typescript-eslint/recommended
  • Fix lint warnings, and errors
    • 99% of these fixes are resolving unused vars and ts-expect-error with no message
      • Unused types may either be removed or by prepending a _ to the argument
    • Replacing args typed as {} to object or correct type
    • There are a couple other changes that have been applied automatically by the linter, they include:
      • Removing double !! when they're not needed such as in conditionals
      • Converting let to const for values that aren't being reassigned

@codecov-staging
Copy link

codecov-staging bot commented Nov 21, 2024

Bundle Report

Changes will decrease total bundle size by 859 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-staging-system-esm 5.61MB 401 bytes (-0.01%) ⬇️
gazebo-staging-system 5.56MB 458 bytes (-0.01%) ⬇️

@codecov-staging
Copy link

codecov-staging bot commented Nov 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@                                 Coverage Diff                                 @@
##           gh-eng-2124-audit-and-update-lint-rules-for-gazebo    #3524   +/-   ##
===================================================================================
  Coverage                                               98.92%   98.93%           
===================================================================================
  Files                                                     806      806           
  Lines                                                   14372    14372           
  Branches                                                 4079     4083    +4     
===================================================================================
+ Hits                                                    14218    14219    +1     
+ Misses                                                    147      146    -1     
  Partials                                                    7        7           
Files with missing lines Coverage Δ
...bs/Admin/ManageAdminCard/AdminTable/AdminTable.tsx 100.00% <ø> (ø)
...rc/pages/AdminSettings/AdminAccess/AdminAccess.tsx 100.00% <ø> (ø)
...inSettings/AdminMembers/MemberList/MemberTable.tsx 100.00% <100.00%> (ø)
src/pages/AnalyticsPage/Chart/useCoverage.ts 100.00% <100.00%> (ø)
...tailPage/CommitCoverage/UploadsCard/UploadItem.tsx 100.00% <ø> (ø)
...age/CommitCoverage/UploadsCard/UploadReference.tsx 100.00% <ø> (ø)
...ailPage/CommitCoverage/UploadsCard/UploadsCard.tsx 100.00% <ø> (ø)
...CommitCoverage/YamlErrorBanner/YamlErrorBanner.tsx 88.88% <ø> (ø)
...mitDetailFileExplorer/CommitDetailFileExplorer.tsx 100.00% <ø> (ø)
...lFileExplorer/hooks/useRepoCommitContentsTable.tsx 100.00% <ø> (ø)
... and 54 more

... and 8 files with indirect coverage changes

Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 100.00% <ø> (ø)
Pages 98.59% <100.00%> (ø)
Services 99.36% <ø> (ø)
Shared 99.40% <ø> (+0.06%) ⬆️
UI 99.21% <ø> (+<0.01%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 614ae25...a8d9dc9. Read the comment docs.

@codecov-qa
Copy link

codecov-qa bot commented Nov 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.93%. Comparing base (3133f8c) to head (a8d9dc9).
Report is 3 commits behind head on main.

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3524   +/-   ##
=======================================
  Coverage   98.93%   98.93%           
=======================================
  Files         806      806           
  Lines       14369    14372    +3     
  Branches     4077     4083    +6     
=======================================
+ Hits        14216    14219    +3     
  Misses        146      146           
  Partials        7        7           
Files with missing lines Coverage Δ
...bs/Admin/ManageAdminCard/AdminTable/AdminTable.tsx 100.00% <ø> (ø)
...rc/pages/AdminSettings/AdminAccess/AdminAccess.tsx 100.00% <ø> (ø)
...inSettings/AdminMembers/MemberList/MemberTable.tsx 100.00% <100.00%> (ø)
src/pages/AnalyticsPage/Chart/useCoverage.ts 100.00% <100.00%> (ø)
...tailPage/CommitCoverage/UploadsCard/UploadItem.tsx 100.00% <ø> (ø)
...age/CommitCoverage/UploadsCard/UploadReference.tsx 100.00% <ø> (ø)
...ailPage/CommitCoverage/UploadsCard/UploadsCard.tsx 100.00% <ø> (ø)
...CommitCoverage/YamlErrorBanner/YamlErrorBanner.tsx 88.88% <ø> (ø)
...mitDetailFileExplorer/CommitDetailFileExplorer.tsx 100.00% <ø> (ø)
...lFileExplorer/hooks/useRepoCommitContentsTable.tsx 100.00% <ø> (ø)
... and 54 more

... and 15 files with indirect coverage changes

Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 100.00% <ø> (ø)
Pages 98.59% <100.00%> (-0.02%) ⬇️
Services 99.36% <ø> (-0.01%) ⬇️
Shared 99.40% <ø> (+0.06%) ⬆️
UI 99.21% <ø> (+<0.01%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3133f8c...a8d9dc9. Read the comment docs.


🚨 Try these New Features:

Copy link

codecov-public-qa bot commented Nov 21, 2024

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
4138 1 4137 0
View the top 1 failed tests by shortest run time
src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/BillingOptions/BillingOptions.test.tsx > BillingOptions &gt; when rendered &gt; planString is set to annual plan &gt; renders annual button as &quot;selected&quot;
Stack Traces | 0.211s run time
Error: expect(element).toHaveClass(&quot;bg-ds-primary-base&quot;)

Expected the element to have class:
  bg-ds-primary-base
Received:
  flex-1 py-1 px-2 text-sm cursor-pointer whitespace-nowrap disabled:text-ds-gray-quaternary disabled:border-ds-gray-tertiary disabled:bg-ds-gray-primary rounded-l
 ❯ .../TeamPlanController/BillingOptions/BillingOptions.test.tsx:127:27

To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard

Copy link

codecov bot commented Nov 21, 2024

Bundle Report

Changes will decrease total bundle size by 859 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-production-system 5.56MB 458 bytes (-0.01%) ⬇️
gazebo-production-system-esm 5.61MB 401 bytes (-0.01%) ⬇️

Copy link

codecov bot commented Nov 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.93%. Comparing base (614ae25) to head (a8d9dc9).

✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@                                 Coverage Diff                                 @@
##           gh-eng-2124-audit-and-update-lint-rules-for-gazebo    #3524   +/-   ##
===================================================================================
  Coverage                                               98.92%   98.93%           
===================================================================================
  Files                                                     806      806           
  Lines                                                   14372    14372           
  Branches                                                 4086     4083    -3     
===================================================================================
+ Hits                                                    14218    14219    +1     
+ Misses                                                    147      146    -1     
  Partials                                                    7        7           
Files with missing lines Coverage Δ
...bs/Admin/ManageAdminCard/AdminTable/AdminTable.tsx 100.00% <ø> (ø)
...rc/pages/AdminSettings/AdminAccess/AdminAccess.tsx 100.00% <ø> (ø)
...inSettings/AdminMembers/MemberList/MemberTable.tsx 100.00% <100.00%> (ø)
src/pages/AnalyticsPage/Chart/useCoverage.ts 100.00% <100.00%> (ø)
...tailPage/CommitCoverage/UploadsCard/UploadItem.tsx 100.00% <ø> (ø)
...age/CommitCoverage/UploadsCard/UploadReference.tsx 100.00% <ø> (ø)
...ailPage/CommitCoverage/UploadsCard/UploadsCard.tsx 100.00% <ø> (ø)
...CommitCoverage/YamlErrorBanner/YamlErrorBanner.tsx 88.88% <ø> (ø)
...mitDetailFileExplorer/CommitDetailFileExplorer.tsx 100.00% <ø> (ø)
...lFileExplorer/hooks/useRepoCommitContentsTable.tsx 100.00% <ø> (ø)
... and 54 more

... and 8 files with indirect coverage changes

Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 100.00% <ø> (ø)
Pages 98.59% <100.00%> (ø)
Services 99.36% <ø> (ø)
Shared 99.40% <ø> (+0.06%) ⬆️
UI 99.21% <ø> (+<0.01%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 614ae25...a8d9dc9. Read the comment docs.

@codecov-releaser
Copy link
Contributor

codecov-releaser commented Nov 21, 2024

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
19770fe Thu, 21 Nov 2024 19:02:05 GMT Expired Expired
4668dd4 Thu, 21 Nov 2024 19:18:05 GMT Expired Expired
a8d9dc9 Thu, 21 Nov 2024 20:24:33 GMT Cloud Enterprise

@@ -31,7 +31,7 @@ const queryClient = new QueryClient({
})
const server = setupServer()

let testLocation: { pathname: string; search: string } = {
const testLocation: { pathname: string; search: string } = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Auto fix as this wasn't being reassigned

@@ -82,7 +82,7 @@ describe('MyContextSwitcher', () => {
return HttpResponse.json({ data: { me: null } })
}

const orgList = !!info.variables?.after ? org2 : org1
const orgList = info.variables?.after ? org2 : org1
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Linter autofix

@@ -79,7 +79,7 @@ describe('useOktaConfig', () => {
})

describe('invalid schema', () => {
let consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {})
const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Linter autofix - wasn't being reassigned

return HttpResponse.json({ data: response })
})
)
}

describe('when calling the mutation', () => {
let consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {})
const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Linter autofix - wasn't being reassigned

@@ -71,7 +71,7 @@ interface CreateTableArgs {
const createTable = ({ tableData, seatData, mutate }: CreateTableArgs) => {
return tableData?.map(
({ ownerid, activated, email, isAdmin, name, username }) => {
let maxSeats = seatData?.seatsUsed === seatData?.seatsLimit
const maxSeats = seatData?.seatsUsed === seatData?.seatsLimit
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Linter autofix - wasn't being reassigned

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove unused setup functions

@@ -206,7 +206,7 @@ const Select = forwardRef(
{
'border overflow-y-auto': isOpen,
},
!!onSearch ? 'top-16' : 'top-8 rounded'
onSearch ? 'top-16' : 'top-8 rounded'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Linter autofix - removing double !!

Comment on lines 193 to +198
const toggleItem = (selectedItem) => {
isItemSelected(selectedItem, selectedItems)
? removeSelectedItem(selectedItem)
: addSelectedItem(selectedItem)
if (isItemSelected(selectedItem, selectedItems)) {
removeSelectedItem(selectedItem)
} else {
addSelectedItem(selectedItem)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TS lint rules don't like ternaries being used unless a value is being set/returned so this is the way around that

Comment on lines +236 to +240
if (isAllButton(selectedItem)) {
reset()
} else {
toggleItem(selectedItem)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See above 👀

}

const listItems = [
SELECT_ALL_BUTTON,
...selectedItems,
...items?.filter((item) => !isItemSelected(item, selectedItems)),
...(items?.filter((item) => !isItemSelected(item, selectedItems)) ?? []),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Handling the case where items is undefined

@nicholas-codecov nicholas-codecov changed the base branch from main to gh-eng-2124-audit-and-update-lint-rules-for-gazebo November 22, 2024 11:09
@nicholas-codecov nicholas-codecov force-pushed the gh-eng-2124-audit-and-update-lint-rules-for-gazebo branch from 614ae25 to 125652e Compare November 27, 2024 12:22
Base automatically changed from gh-eng-2124-audit-and-update-lint-rules-for-gazebo to main November 27, 2024 13:35
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