Merge pull request #91 from Mavrin/master

Adds eslint check and fixes linting issues
This commit is contained in:
Igor Adamenko
2018-06-23 12:18:41 +03:00
committed by GitHub
15 changed files with 2837 additions and 3334 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
import { siteId, url } from './settings';
import fetcher from './fetcher'
import fetcher from './fetcher';
// TODO: rename actions
@@ -22,7 +22,7 @@ export const counts = ({ urls, siteId }) => fetcher.post({
export const getComment = ({ id }) => fetcher.get(`/id/${id}?url=${url}`);
export const getUserComments = ({ user, limit }) => fetcher.get(`/comments?user=${user}&limit=${limit}`)
export const getUserComments = ({ user, limit }) => fetcher.get(`/comments?user=${user}&limit=${limit}`);
export const vote = ({ id, url, value }) => fetcher.put({
url: `/vote/${id}?url=${url}&vote=${value}`,
+1 -1
View File
@@ -44,7 +44,7 @@ methods.forEach(method => {
.then(res => resolve(res.data))
.catch(error => reject(error));
});
}
};
});
export default fetcher;
+1 -1
View File
@@ -4,7 +4,7 @@ if (!Element.prototype.matches)
if (!Element.prototype.closest)
Element.prototype.closest = function(s) {
var el = this;
let el = this;
if (!document.documentElement.contains(el)) return null;
do {
if (el.matches(s)) return el;
+3 -4
View File
@@ -50,7 +50,7 @@ class Store {
again = false;
return root;
}
};
const paste = (root, commentObj) => {
if (!again) return root;
@@ -63,10 +63,9 @@ class Store {
root.replies = root.replies.map(reply => {
if (reply.comment.id === commentObj.comment.pid) {
return concatReply(reply, commentObj);
} else {
return paste(reply, commentObj);
}
})
return paste(reply, commentObj);
});
}
return root;
+2 -4
View File
@@ -24,9 +24,7 @@ export default class AuthPanel extends Component {
toggleBlockedVisibility() {
if (!this.state.isBlockedVisible) {
if (this.props.onBlockedUsersShow) this.props.onBlockedUsersShow();
} else {
if (this.props.onBlockedUsersHide) this.props.onBlockedUsersHide();
}
} else if (this.props.onBlockedUsersHide) this.props.onBlockedUsersHide();
this.setState({ isBlockedVisible: !this.state.isBlockedVisible });
}
@@ -70,7 +68,7 @@ export default class AuthPanel extends Component {
onClick={() => props.onSignIn(provider)}
>{PROVIDER_NAMES[provider]}</span>
</span>
)
);
})
}
{'.'}
@@ -1,6 +1,6 @@
import { h, Component } from 'preact';
import api from 'common/api'
import api from 'common/api';
export default class BlockedUsers extends Component {
constructor(props) {
@@ -8,7 +8,7 @@ export default class BlockedUsers extends Component {
this.state = {
unblockedUsers: [],
}
};
}
block(user) {
@@ -73,7 +73,7 @@ export default class BlockedUsers extends Component {
)
}
</li>
)
);
})
}
</ul>
+2 -2
View File
@@ -331,8 +331,8 @@ export default class Comment extends Component {
? 'This user was blocked'
: (
deleted
? 'This comment was deleted'
: data.text
? 'This comment was deleted'
: data.text
)
),
time: formatTime(new Date(data.time)),
+3 -3
View File
@@ -22,7 +22,7 @@ export default class Root extends Component {
try {
sort = localStorage.getItem(LS_SORT_KEY) || DEFAULT_SORT;
} catch(e) {
} catch (e) {
sort = DEFAULT_SORT;
}
@@ -117,7 +117,7 @@ export default class Root extends Component {
store.set('user', user);
this.setState({ user });
})
.catch(() => {}) // TODO: we need to handle it and write error to user
.catch(() => {}); // TODO: we need to handle it and write error to user
}
}, checkMsDelay);
}
@@ -178,7 +178,7 @@ export default class Root extends Component {
});
}
render({}, { config = {}, comments = [], user, sort, isLoaded, isBlockedVisible, isCommentsListLoading, bannedUsers, commentsShown }) {
render(props, { config = {}, comments = [], user, sort, isLoaded, isBlockedVisible, isCommentsListLoading, bannedUsers, commentsShown }) {
if (!isLoaded) {
return (
<div id={NODE_ID}>
+2 -2
View File
@@ -1,4 +1,4 @@
import { COUNTER_NODE_CLASSNAME } from './common/constants'
import { COUNTER_NODE_CLASSNAME } from './common/constants';
import api from 'common/api';
@@ -17,7 +17,7 @@ function init() {
}
try {
remark_config = remark_config || {}
remark_config = remark_config || {};
} catch (e) {
console.error('Remark42: Config object is undefined.');
return;
+1 -1
View File
@@ -15,7 +15,7 @@ function init() {
}
try {
remark_config = remark_config || {}
remark_config = remark_config || {};
} catch (e) {
console.error('Remark42: Config object is undefined.');
return;
+3 -3
View File
@@ -1,6 +1,6 @@
import { h, render } from 'preact';
import { BASE_URL, DEFAULT_LAST_COMMENTS_MAX, LAST_COMMENTS_NODE_CLASSNAME } from './common/constants'
import { BASE_URL, DEFAULT_LAST_COMMENTS_MAX, LAST_COMMENTS_NODE_CLASSNAME } from './common/constants';
import api from 'common/api';
@@ -21,7 +21,7 @@ function init() {
}
try {
remark_config = remark_config || {}
remark_config = remark_config || {};
} catch (e) {
console.error('Remark42: Config object is undefined.');
return;
@@ -42,7 +42,7 @@ function init() {
api.last({ max, siteId: remark_config.site_id })
.then(comments => {
try {
render(<ListComments comments={comments}/>, node)
render(<ListComments comments={comments}/>, node);
} catch (e) {
console.error('Remark42: Something went wrong with last comments rendering');
console.error(e);