-
Notifications
You must be signed in to change notification settings - Fork 25
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
Conversation
Bundle ReportChanges will increase total bundle size by 5.04kB (0.03%) ⬆️. This is within the configured threshold ✅ Detailed changes
|
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #3524 +/- ##
=======================================
Coverage 98.90% 98.90%
=======================================
Files 806 806
Lines 14484 14484
Branches 4111 4115 +4
=======================================
+ Hits 14325 14326 +1
+ Misses 152 151 -1
Partials 7 7
... and 9 files with indirect coverage changes
Continue to review full report in Codecov by Sentry.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #3524 +/- ##
=======================================
Coverage 98.90% 98.90%
=======================================
Files 806 806
Lines 14484 14484
Branches 4118 4108 -10
=======================================
+ Hits 14325 14326 +1
+ Misses 152 151 -1
Partials 7 7
... and 9 files with indirect coverage changes
Continue to review full report in Codecov by Sentry.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #3524 +/- ##
=======================================
Coverage 98.90% 98.90%
=======================================
Files 806 806
Lines 14484 14484
Branches 4111 4108 -3
=======================================
+ Hits 14325 14326 +1
+ Misses 152 151 -1
Partials 7 7
... and 9 files with indirect coverage changes
Continue to review full report in Codecov by Sentry.
|
Bundle ReportChanges will increase total bundle size by 5.04kB (0.03%) ⬆️. This is within the configured threshold ✅ Detailed changes
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #3524 +/- ##
=======================================
Coverage 98.90% 98.90%
=======================================
Files 806 806
Lines 14484 14484
Branches 4111 4108 -3
=======================================
+ Hits 14325 14326 +1
+ Misses 152 151 -1
Partials 7 7
... and 9 files with indirect coverage changes
Continue to review full report in Codecov by Sentry.
|
✅ Deploy preview for gazebo ready!Previews expire after 1 month automatically.
|
@@ -31,7 +31,7 @@ const queryClient = new QueryClient({ | |||
}) | |||
const server = setupServer() | |||
|
|||
let testLocation: { pathname: string; search: string } = { | |||
const testLocation: { pathname: string; search: string } = { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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(() => {}) |
There was a problem hiding this comment.
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(() => {}) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linter autofix - removing double !!
const toggleItem = (selectedItem) => { | ||
isItemSelected(selectedItem, selectedItems) | ||
? removeSelectedItem(selectedItem) | ||
: addSelectedItem(selectedItem) | ||
if (isItemSelected(selectedItem, selectedItems)) { | ||
removeSelectedItem(selectedItem) | ||
} else { | ||
addSelectedItem(selectedItem) | ||
} |
There was a problem hiding this comment.
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
if (isAllButton(selectedItem)) { | ||
reset() | ||
} else { | ||
toggleItem(selectedItem) | ||
} |
There was a problem hiding this comment.
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)) ?? []), |
There was a problem hiding this comment.
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
614ae25
to
125652e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left one nit comment but can be applied overall: what was your rule of thumb for deleting unused function arguments vs switching them to underscore variables?
LGTM
a8d9dc9
to
223bc79
Compare
Hrrm, thinking about this a bit more, we should only use ignored unused variables when they're required in the function (i.e. positional arguments rather than an object where we can select where we want) For example if we wanted to iterate over an array and we only want access to the index: const data = [ /* ... */]
data.forEach((_item, index) => {
// do something with the index
}) |
Hrrm for some reason (not really certain), I was required to bring the hash length down from 22 to 21, we got this error here: |
0f2baf4
to
afb5473
Compare
Description
Note
Requires #3508 to be merged before reviewing.This PR applies the recommended rules from
eslint
andtypescript-eslint
Ticket: codecov/engineering-team#2124
Notable Changes
eslint:recommended
andplugin:@typescript-eslint/recommended
ts-expect-error
with no message_
to the argument{}
toobject
or correct type!!
when they're not needed such as in conditionalslet
toconst
for values that aren't being reassigned