mirror of
https://github.com/wassname/talk.git
synced 2026-07-18 12:40:13 +08:00
lint fixes
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
"no-unneeded-ternary": [1],
|
||||
"object-curly-spacing": [1],
|
||||
"space-infix-ops": ["error"],
|
||||
"space-in-parens": ["error", "never"],
|
||||
"no-const-assign": [2],
|
||||
"no-duplicate-imports": [2],
|
||||
"prefer-template": [1],
|
||||
|
||||
@@ -37,7 +37,7 @@ const User = props => {
|
||||
<div className={styles.flaggedByCount}>
|
||||
<i className="material-icons">flag</i><span className={styles.flaggedByLabel}>{lang.t('community.flags')}({ user.actions.length })</span>:
|
||||
{ user.action_summaries.map(
|
||||
(action, i ) => {
|
||||
(action, i) => {
|
||||
return <span className={styles.flaggedBy} key={i}>
|
||||
{lang.t(`community.${action.reason}`)} ({action.count})
|
||||
</span>;
|
||||
@@ -46,7 +46,7 @@ const User = props => {
|
||||
</div>
|
||||
<div className={styles.flaggedReasons}>
|
||||
{ user.action_summaries.map(
|
||||
(action_sum, i ) => {
|
||||
(action_sum, i) => {
|
||||
return <div key={i}>
|
||||
<span className={styles.flaggedByLabel}>
|
||||
{lang.t(`community.${action_sum.reason}`)} ({action_sum.count})
|
||||
|
||||
@@ -427,7 +427,7 @@ export default Comment;
|
||||
// return whether the comment is editable
|
||||
function commentIsStillEditable (comment) {
|
||||
const editing = comment && comment.editing;
|
||||
if ( ! editing) {return false;}
|
||||
if (! editing) {return false;}
|
||||
const editableUntil = getEditableUntilDate(comment);
|
||||
const editWindowExpired = (editableUntil - new Date) < 0;
|
||||
return ! editWindowExpired;
|
||||
@@ -436,7 +436,7 @@ function commentIsStillEditable (comment) {
|
||||
// return number of milliseconds before edit window expires
|
||||
function editWindowRemainingMs (comment) {
|
||||
const editableUntil = getEditableUntilDate(comment);
|
||||
if ( ! editableUntil) {return;}
|
||||
if (! editableUntil) {return;}
|
||||
const now = new Date();
|
||||
const editWindowRemainingMs = (editableUntil - now);
|
||||
return editWindowRemainingMs;
|
||||
|
||||
@@ -124,7 +124,7 @@ export default compose(
|
||||
* producing a new queryStream result where asset.comments reflects the edit
|
||||
*/
|
||||
function reduceEditCommentActionsToUpdateStreamQuery(previousResult, action) {
|
||||
if ( ! (action.type === 'APOLLO_MUTATION_RESULT' && action.operationName === 'editComment')) {
|
||||
if (! (action.type === 'APOLLO_MUTATION_RESULT' && action.operationName === 'editComment')) {
|
||||
return previousResult;
|
||||
}
|
||||
const resultHasErrors = (result) => {
|
||||
|
||||
@@ -29,7 +29,7 @@ export const BestIndicator = ({children = <Icon name='star'/>}) => (
|
||||
* Component that only renders children if the provided user prop can modify best tags
|
||||
*/
|
||||
export const IfUserCanModifyBest = ({user, children}) => {
|
||||
if ( ! ( user && canModifyBestTag(user))) {return null;}
|
||||
if (! (user && canModifyBestTag(user))) {return null;}
|
||||
return children;
|
||||
};
|
||||
|
||||
@@ -63,7 +63,7 @@ export class BestButton extends Component {
|
||||
async onClickAddBest(e) {
|
||||
e.preventDefault();
|
||||
const {addBest} = this.props;
|
||||
if ( ! addBest) {
|
||||
if (! addBest) {
|
||||
console.warn('BestButton#onClickAddBest called even though there is no addBest prop. doing nothing');
|
||||
return;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ export class BestButton extends Component {
|
||||
async onClickRemoveBest(e) {
|
||||
e.preventDefault();
|
||||
const {removeBest} = this.props;
|
||||
if ( ! removeBest) {
|
||||
if (! removeBest) {
|
||||
console.warn('BestButton#onClickAddBest called even though there is no removeBest prop. doing nothing');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import marked from 'marked';
|
||||
const renderer = new marked.Renderer();
|
||||
|
||||
// Set link target to `_parent` to work properly in an embed.
|
||||
renderer.link = ( href, title, text ) =>
|
||||
renderer.link = (href, title, text) =>
|
||||
`<a target="_parent" href="${href}" title="${title}">${text}</a>`;
|
||||
|
||||
marked.setOptions({renderer});
|
||||
|
||||
@@ -90,7 +90,7 @@ const RootQuery = {
|
||||
|
||||
// get currentUser again since context.user was out of date when running test/graph/mutations/ignoreUser
|
||||
const currentUser = (await Users.getByQuery({ids: [user.id], limit: 1}))[0];
|
||||
if ( ! (currentUser && Array.isArray(currentUser.ignoresUsers) && currentUser.ignoresUsers.length)) {
|
||||
if (! (currentUser && Array.isArray(currentUser.ignoresUsers) && currentUser.ignoresUsers.length)) {
|
||||
return [];
|
||||
}
|
||||
return await Users.getByQuery({ids: currentUser.ignoresUsers});
|
||||
|
||||
Reference in New Issue
Block a user