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

Bump Style Rules and Linting #2084

Merged
merged 9 commits into from
Jan 4, 2021
Merged
2 changes: 1 addition & 1 deletion app/components/Comments/Comment.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class LoginPage extends Component<Props, State> {
title = 'Glemt passord';
form = <ForgotPasswordForm />;
break;
default:
break;
}
return (
<Content>
Expand Down
8 changes: 4 additions & 4 deletions app/components/Poll/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ 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
13 changes: 6 additions & 7 deletions app/components/Reactions/ReactionPicker.js
Original file line number Diff line number Diff line change
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 @@ -178,9 +176,10 @@ const ReactionPicker = ({
const onCategoryClick = useCallback((category) => {
setActiveCategory(category);
setSearchString(null);
});
const onSearch = useCallback((searchString) =>
setSearchString(searchString.trim().toLowerCase())
}, []);
const onSearch = useCallback(
(searchString) => setSearchString(searchString.trim().toLowerCase()),
[]
);

return (
Expand Down
2 changes: 1 addition & 1 deletion app/components/Reactions/ReactionPickerHeader.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
4 changes: 4 additions & 0 deletions app/components/Tooltip/index.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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