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
[WIP] Revert "Revert "Bump ESLint, prettier and stylelint"" #2056
Conversation
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.
nice!
Would be nice if you could split the various things into separate commits, so that we can review flow changes separate from logical changes in the code.
@@ -175,13 +173,13 @@ const ReactionPicker = ({ | |||
return searchEmojis(emojis, searchString); | |||
}, [searchString, emojis]); | |||
|
|||
const onCategoryClick = useCallback((category) => { | |||
const onCategoryClick = (category) => { |
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.
What was the warning/reason for this? I guess we should declare an empty array as deps, but not sure why it warns.
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.
This was caused by: warning React Hook useCallback does nothing when called with only one argument. Did you forget to pass an array of dependencies? react-hooks/exhaustive-deps` eslint-plugin-react-hooks
Fixed this by passing an empty array as you suggested. 💯
@@ -273,7 +273,7 @@ export default class Table extends Component<Props, State> { | |||
|
|||
const match = Object.keys(this.state.filters).filter((key) => { | |||
const { inlineFiltering = true, filterMapping = (val) => val } = | |||
this.props.columns.find((col) => col.dataIndex == key) || {}; | |||
this.props.columns.find((col) => col.dataIndex === key) || {}; |
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.
Sure this logic stays 100% similar and works if the dataIndex is a number?
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.
As far as i can tell, dataIndex is always a string (In our codebase). If the dataIndex is a "number", it will probably just be typeof string anyways. 🤷
@@ -327,7 +330,7 @@ export const selectAllRegistrationsForEvent = createSelector( | |||
updatedBy, | |||
}); | |||
}) | |||
.filter((reg) => reg.event == eventId) | |||
.filter((reg) => reg.event === eventId) |
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.
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.
Rip int
and string
comparison. Fixed by wrapping eventId
in parseInt()
@@ -95,6 +95,7 @@ function loadData({ query, match: { params }, location }, dispatch) { | |||
|
|||
function mapStateToProps(state, props) { | |||
const { pathname, search } = state.router.location; | |||
// eslint-disable-next-line no-restricted-globals |
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.
What about fixing this instead of ignoring it, since the warning is legit?
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.
You're right. I fixed this with window.location
instead of location
and ConfirmModalWithParent
instead of confirm()
@@ -44,9 +44,12 @@ const GroupMembersList = ({ | |||
filters, | |||
}: Props) => { | |||
const GroupMembersListColumns = (fullName, membership) => { | |||
console.log(groupsById); |
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.
🥇
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.
Ripperino 😅
@@ -155,6 +158,7 @@ export const getContactedStatuses = ( | |||
) { | |||
contacted.splice(contacted.indexOf(status), 1); | |||
} | |||
return null; |
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.
Is there a reason to have a map
and not a forEach
here?
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.
Yeah, I agree. Moved these to forEach.
'403': 'Denne siden har du ikke tilgang på', | ||
'404': 'Denne siden finnes ikke', | ||
'500': 'Noe gikk veldig galt, Webkom er på saken!', | ||
// Non-string literal property keys is not supported in flow yet |
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.
Same here, is there a reason?
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.
Not an issue in the latest version of eslint.
@@ -53,10 +53,12 @@ const OnKeyDownHandler = ({ | |||
}) => ( | |||
useEffect( | |||
() => ( | |||
// eslint-disable-next-line no-sequences |
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.
When we have to have this warning, isn't it better to just rewrite the code?
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.
I fixed these, but I am unsure of the () => (func1(), func2()) syntax meaning. Does this first execute func1, and then return func2? Hopefully you can review my suggested solution in my recently created PR. 🙂
@@ -158,6 +158,7 @@ const validateMandatory = (inputAnswers: Array<Object>, props) => { | |||
if (question.mandatory && !answeredQuestionIds.includes(question.id)) { | |||
errors.questions[question.id] = 'Dette feltet er obligatorisk'; | |||
} | |||
return null; |
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.
map
?
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.
Yup, moved to forEach. 😄
@@ -158,6 +160,7 @@ export function deleteEntities(deleteTypes: ?EntityReducerTypes) { | |||
? [Number(resultId), resultId.toString()] | |||
: [resultId]) | |||
), | |||
// eslint-disable-next-line no-sequences |
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.
Maybe rewrite this instead?
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.
Also unsure of the syntax here 🙂, but I think the rewrite should be about right. 🙃
57ae0ea
to
d1f5580
Compare
This PR should be resolved in #2084 |
Reverts #2055
EDIT: This is solved by: #2084