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

Fix eslint warnings #445

Merged
merged 1 commit into from
Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/components/ConditionNav/ConditionNav.styles.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { makeStyles, Theme } from '@material-ui/core';
import { makeStyles } from '@material-ui/core';

export const useStyles = makeStyles(
(theme: Theme) => ({
{
root: {
display: 'flex',
marginBottom: '80px',
Expand All @@ -22,6 +22,6 @@ export const useStyles = makeStyles(
fontWeight: 700,
textDecoration: 'none',
},
}),
},
{ name: 'ConditionsNav' },
);
6 changes: 4 additions & 2 deletions src/components/Editor/CustomModules/ImageFromFileHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ class InsertFromFile {
this.range = null;
this.fileHolder = document.createElement('input');

if (typeof this.options.upload !== 'function')
if (typeof this.options.upload !== 'function') {
// eslint-disable-next-line no-console
console.warn(
'[Missing config] upload function that returns a promise is required',
);

}
const toolbar = this.quill.getModule('toolbar');
toolbar.addHandler('image', this.selectLocalImage.bind(this));

Expand Down Expand Up @@ -96,6 +97,7 @@ class InsertFromFile {
insertFromUrl(imageUrl, this.quill);
},
(error) => {
// eslint-disable-next-line no-console
console.warn(error);
},
);
Expand Down
31 changes: 17 additions & 14 deletions src/components/Editor/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,24 @@ export const modules: StringMap = {
},
insertFromFile: {
upload: (file: string | Blob): Promise<unknown> => {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file as Blob);
reader.onload = () => {
const image = reader.result as string;
const result = image.slice(image.search(/[^,]*$/));
resolve(result);
reject(new Error('Failed image onload'));
};
})
.then((str) => uploadImageToImgur(str as string))
.then((res) => {
return res.data.data.link;
return (
new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file as Blob);
reader.onload = () => {
const image = reader.result as string;
const result = image.slice(image.search(/[^,]*$/));
resolve(result);
reject(new Error('Failed image onload'));
};
})
.catch((err) => console.log(err));
.then((str) => uploadImageToImgur(str as string))
.then((res) => {
return res.data.data.link;
})
// eslint-disable-next-line no-console
.catch((err) => console.error(err))
);
},
},
history: {
Expand Down
1 change: 1 addition & 0 deletions src/models/properties/reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const propertiesSlice = createSlice({
...getAsyncActionsReducer(fetchPostsTypes, 'postTypes'),
...getAsyncActionsReducer(fetchDirections, 'directions'),
...getAsyncActionsReducer(fetchOrigins, 'origins'),
// eslint-disable-next-line @typescript-eslint/no-explicit-any
...getAsyncActionsReducer(fetchPostsTags as any, 'postTags'),
},
});
Expand Down
1 change: 1 addition & 0 deletions src/old/lib/components/Service/Oath2Redirect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const Oath2Redirect: React.FC = () => {
if (token) {
setAuthorization(token);
} else {
// eslint-disable-next-line no-console
console.error('NO TOKEN');
}
}, [token]);
Expand Down
3 changes: 2 additions & 1 deletion src/old/modules/posts/components/PostViewWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ const PostViewWrapper: React.FC = () => {
});
})
.catch((err) => {
console.log(err);
// eslint-disable-next-line no-console
console.error(err);
});
}, []);

Expand Down
8 changes: 0 additions & 8 deletions src/views/Conditions/Conditions.styles.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/views/Conditions/Conditions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ import React from 'react';
import { Container, Box } from '@material-ui/core';
import ConditionNav from '../../components/ConditionNav';
import ContentSection from '../../components/ContentSection';
import { useStyles } from './Conditions.styles';

export default function Conditions(): JSX.Element {
const classes = useStyles();

return (
<Container>
<Box>
Expand Down
2 changes: 1 addition & 1 deletion src/views/postCreation/TextPostCreation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const TextPostCreation: React.FC<IPostCreationProps> = ({
const [typing, setTyping] = useState({ content: false, preview: false });
const [previewing, setPreviewing] = useState(false);
const [authors, setAuthors] = useState<ExpertResponseType[]>([]);
const [author, setAuthor] = useState<ExpertResponseType | null>(null);
const [, setAuthor] = useState<ExpertResponseType | null>(null);
const [searchValue, setSearchValue] = useState('');

const [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const VideoPostCreation: React.FC<IVideoPostCreationProps> = ({
const [typing, setTyping] = useState({ content: false, preview: false });
const [previewing, setPreviewing] = useState(false);
const [authors, setAuthors] = useState<ExpertResponseType[]>([]);
const [author, setAuthor] = useState<ExpertResponseType | null>(null);
const [, setAuthor] = useState<ExpertResponseType | null>(null);
const [searchValue, setSearchValue] = useState('');

const videoUrl = useSelector(selectVideoUrl);
Expand Down