Skip to content

Commit

Permalink
Revert "Revert "Bump ESLint, prettier and stylelint""
Browse files Browse the repository at this point in the history
  • Loading branch information
odinuge committed Nov 11, 2020
1 parent db69882 commit 57ae0ea
Show file tree
Hide file tree
Showing 78 changed files with 665 additions and 410 deletions.
2 changes: 1 addition & 1 deletion app/components/Comments/Comment.js
Expand Up @@ -74,7 +74,7 @@ export default class Comment extends Component<Props, State> {
<Button flat onClick={this.toggleReply}>
{this.state.replyOpen ? 'Lukk svar' : 'Svar'}
</Button>
{user && author.id == user.id && (
{user && author.id === user.id && (
<Button
flat
className={styles.delete}
Expand Down
4 changes: 3 additions & 1 deletion app/components/Comments/__tests__/fixtures/comments.js
@@ -1,4 +1,4 @@
export default [
const comments = [
{
id: 2,
text: 'blaargarhgh',
Expand Down Expand Up @@ -40,3 +40,5 @@ export default [
},
},
];

export default comments;
2 changes: 1 addition & 1 deletion app/components/Form/legoForm.js
Expand Up @@ -56,7 +56,7 @@ const legoForm = ({
try {
// We should instead check if error is SubmissionError. Does not work now
let [firstErrorField] = Object.keys(errors);
if (firstErrorField == '_error') {
if (firstErrorField === '_error') {
// This is because of the stange usage of SubmissionError in
// app/routes/surveys/components/SubmissionEditor/SubmissionEditor.js
// That code should instead use redux-form FieldArray :smile:
Expand Down
12 changes: 10 additions & 2 deletions app/components/Header/index.js
Expand Up @@ -85,7 +85,13 @@ function AccountDropdownItems({
</Dropdown.ListItem>
<Dropdown.Divider />
<Dropdown.ListItem>
<Button flat onClick={() => (logout(), onClose())}>
<Button
flat
onClick={() => {
logout();
onClose();
}}
>
Logg ut
<Icon name="log-out" size={24} />
</Button>
Expand Down Expand Up @@ -121,7 +127,7 @@ class Header extends Component<Props, State> {
const isLogin = this.state.mode === 'login';
let title, form;

if (loggedIn && currentUser && currentUser.selectedTheme != getTheme()) {
if (loggedIn && currentUser && currentUser.selectedTheme !== getTheme()) {
applySelectedTheme(currentUser.selectedTheme || 'light');
}

Expand All @@ -138,6 +144,8 @@ class Header extends Component<Props, State> {
title = 'Glemt passord';
form = <ForgotPasswordForm />;
break;
default:
break;
}

const MeetingButton = withRouter(({ history }) => (
Expand Down
3 changes: 2 additions & 1 deletion app/components/LegoReactions/index.js
Expand Up @@ -36,7 +36,8 @@ const LegoReactions = (props: Props) => {
const foundReaction =
parentEntity.reactionsGrouped &&
parentEntity.reactionsGrouped.find(
(reaction) => emoji.shortCode == reaction.emoji && reaction.hasReacted
(reaction) =>
emoji.shortCode === reaction.emoji && reaction.hasReacted
);
return {
...emoji,
Expand Down
2 changes: 2 additions & 0 deletions app/components/LoginForm/LoginPage.js
Expand Up @@ -52,6 +52,8 @@ class LoginPage extends Component<Props, State> {
title = 'Glemt passord';
form = <ForgotPasswordForm />;
break;
default:
break;
}
return (
<Content>
Expand Down
7 changes: 3 additions & 4 deletions app/components/Poll/index.js
Expand Up @@ -19,16 +19,15 @@ type Props = {
details?: boolean,
};

type OptionEntityRatio = OptionEntity & {
ratio: number,
};
type State = {
truncateOptions: boolean,
shuffledOptions: Array<OptionEntityRatio>,
expanded: boolean,
};

type OptionEntityRatio = OptionEntity & {
ratio: number,
};

class Poll extends React.Component<Props, State> {
constructor(props: Props) {
super(props);
Expand Down
18 changes: 8 additions & 10 deletions app/components/Reactions/ReactionPicker.js
@@ -1,7 +1,7 @@
// @flow

// $FlowFixMe
import React, { useMemo, useState, useCallback } from 'react';
import React, { useMemo, useState } from 'react';
import fuzzy from 'fuzzy';
import type { EmojiEntity } from 'app/reducers/emojis';
import type { ID } from 'app/models';
Expand Down Expand Up @@ -39,9 +39,7 @@ const searchEmojis = (emojis, searchString) => {
matchingEmojis.push(emoji);
return false;
}
{
return true;
}
return true;
});

/*
Expand Down Expand Up @@ -105,7 +103,7 @@ const searchEmojis = (emojis, searchString) => {
currentEmojis = currentEmojis.filter((emoji) => {
if (
emoji.keywords.find(
(keyword) => keyword.toLowerCase() == searchString
(keyword) => keyword.toLowerCase() === searchString
) !== undefined
) {
matchingEmojis.push(emoji);
Expand Down Expand Up @@ -175,13 +173,13 @@ const ReactionPicker = ({
return searchEmojis(emojis, searchString);
}, [searchString, emojis]);

const onCategoryClick = useCallback((category) => {
const onCategoryClick = (category) => {
setActiveCategory(category);
setSearchString(null);
});
const onSearch = useCallback((searchString) =>
setSearchString(searchString.trim().toLowerCase())
);
};

const onSearch = (searchString) =>
setSearchString(searchString.trim().toLowerCase());

return (
<div className={styles.reactionPicker}>
Expand Down
2 changes: 1 addition & 1 deletion app/components/Reactions/ReactionPickerHeader.js
Expand Up @@ -20,7 +20,7 @@ const ReactionPickerHeader = ({
<ReactionPickerCategory
key={category}
name={category}
isActive={category == activeCategory}
isActive={category === activeCategory}
onCategoryClick={onCategoryClick}
/>
))}
Expand Down
3 changes: 3 additions & 0 deletions app/components/Search/SearchPage.js
Expand Up @@ -64,6 +64,9 @@ class SearchPage extends Component<Props, State> {
e.preventDefault();
this.handleSelect(this.props.results[this.state.selectedIndex]);
break;

default:
break;
}
};

Expand Down
2 changes: 1 addition & 1 deletion app/components/Search/utils.js
Expand Up @@ -146,7 +146,7 @@ function retrieveAllowed(links: Array<Link>, { allowed, loggedIn }: Options) {
return links
.filter(({ key, requireLogin }) => {
// If we have a mapping for this from the server, check that:
if (allowed.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(allowed, key)) {
return allowed[key];
}

Expand Down
2 changes: 1 addition & 1 deletion app/components/Search/withAutocomplete.js
Expand Up @@ -55,7 +55,7 @@ function withAutocomplete<Props>({
// Set the result to the response result
let finalResult = result;
// Retain a query with no match
if (retainFailedQuery && result.length == 0) {
if (retainFailedQuery && result.length === 0) {
finalResult = [{ title: query, label: query }];
}

Expand Down
2 changes: 1 addition & 1 deletion app/components/Table/index.js
Expand Up @@ -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) || {};

if (!inlineFiltering) return true;

Expand Down
6 changes: 3 additions & 3 deletions app/components/Time/Time.spec.js
Expand Up @@ -62,7 +62,7 @@ describe('<FormatTime />', () => {
});

describe('<FromToTime />', () => {
it('should only render day once when start day == end day', () => {
it('should only render day once when start day === end day', () => {
const from = '2016-01-18T20:00:00Z';
const to = '2016-01-18T22:00:00Z';
const output = 'Monday 18. Jan 2016 20:00 - 22:00';
Expand All @@ -80,7 +80,7 @@ describe('<FromToTime />', () => {
expect(wrapper.render().text()).toEqual(output);
});

it('should not render year if year == currentYear', () => {
it('should not render year if year === currentYear', () => {
const from = '2017-01-18T20:00:00Z';
const to = '2017-01-19T22:00:00Z';
const output = 'Wednesday 18. January, 20:00 - Thursday 19. January, 22:00';
Expand All @@ -96,7 +96,7 @@ describe('<FromToTime />', () => {
}
});

it('should not render year if year == currentYear, and day only once if equal', () => {
it('should not render year if year === currentYear, and day only once if equal', () => {
const from = '2017-01-18T20:00:00Z';
const to = '2017-01-18T21:00:00Z';
const output = 'Wednesday 18. January, 20:00 - 21:00';
Expand Down
4 changes: 4 additions & 0 deletions app/components/Tooltip/index.js
Expand Up @@ -89,6 +89,8 @@ export default class Tooltip extends Component<Props, State> {
case 'right':
renderDirectionClass = styles.renderDirectionRight;
break;
default:
break;
}
switch (pointerPosition) {
case 'left':
Expand All @@ -97,6 +99,8 @@ export default class Tooltip extends Component<Props, State> {
case 'right':
startPointChildren = 10 / 9;
break;
default:
break;
}
}
const tooltipClass = this.state.hovered
Expand Down
2 changes: 1 addition & 1 deletion app/components/Upload/ImageUpload.js
Expand Up @@ -164,7 +164,7 @@ export default class ImageUpload extends Component<Props, State> {
};

componentDidUpdate = (props: Object) => {
if (props.img != this.props.img) {
if (props.img !== this.props.img) {
this.setState({ img: this.props.img });
}
};
Expand Down

0 comments on commit 57ae0ea

Please sign in to comment.