linting updates

This commit is contained in:
Wyatt Johnson
2018-02-23 14:00:07 -07:00
parent 37dc3a27dc
commit 735ecbcef3
35 changed files with 22 additions and 163 deletions
+1 -33
View File
@@ -2,36 +2,4 @@
dist
docs
node_modules
plugins/*
public
!plugins/talk-plugin-akismet
!plugins/talk-plugin-auth
!plugins/talk-plugin-author-menu
!plugins/talk-plugin-comment-content
!plugins/talk-plugin-deep-reply-count
!plugins/talk-plugin-facebook-auth
!plugins/talk-plugin-featured-comments
!plugins/talk-plugin-flag-details
!plugins/talk-plugin-ignore-user
!plugins/talk-plugin-like
!plugins/talk-plugin-love
!plugins/talk-plugin-member-since
!plugins/talk-plugin-mod
!plugins/talk-plugin-moderation-actions
!plugins/talk-plugin-offtopic
!plugins/talk-plugin-permalink
!plugins/talk-plugin-profile-settings
!plugins/talk-plugin-remember-sort
!plugins/talk-plugin-respect
!plugins/talk-plugin-rich-text
!plugins/talk-plugin-rich-text-pell
!plugins/talk-plugin-sort-most-liked
!plugins/talk-plugin-sort-most-loved
!plugins/talk-plugin-sort-most-replied
!plugins/talk-plugin-sort-most-respected
!plugins/talk-plugin-sort-newest
!plugins/talk-plugin-sort-oldest
!plugins/talk-plugin-subscriber
!plugins/talk-plugin-toxic-comments
!plugins/talk-plugin-viewing-options
public
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
-3
View File
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -3,7 +3,5 @@ import GoogleButton from '../containers/GoogleButton';
import { t } from 'plugin-api/beta/client/services';
export default () => {
return (
<GoogleButton>{t('talk-plugin-google-auth.sign_in')}</GoogleButton>
);
return <GoogleButton>{t('talk-plugin-google-auth.sign_in')}</GoogleButton>;
};
@@ -3,7 +3,5 @@ import GoogleButton from '../containers/GoogleButton';
import { t } from 'plugin-api/beta/client/services';
export default () => {
return (
<GoogleButton>{t('talk-plugin-google-auth.sign_up')}</GoogleButton>
);
return <GoogleButton>{t('talk-plugin-google-auth.sign_up')}</GoogleButton>;
};
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
-3
View File
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
-3
View File
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,23 +1,3 @@
{
"env": {
"browser": true,
"es6": true,
"mocha": true
},
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
}
},
"parser": "babel-eslint",
"plugins": [
"react"
],
"rules": {
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"no-console": ["warn", { "allow": ["warn", "error"] }]
}
"extends": "@coralproject/eslint-config-talk/client"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -5,7 +5,9 @@ const config = {
if (process.env.NODE_ENV !== 'test' && !config.SLACK_WEBHOOK_URL) {
// TODO this error should point users to Talk's Slack app once that's in place
throw new Error('Please set the TALK_SLACK_WEBHOOK_URL environment variable to use the slack-notifications plugin.');
throw new Error(
'Please set the TALK_SLACK_WEBHOOK_URL environment variable to use the slack-notifications plugin.'
);
}
module.exports = config;
@@ -1,5 +1,5 @@
const fetch = require('node-fetch');
const {SLACK_WEBHOOK_URL, SLACK_WEBHOOK_TIMEOUT} = require('./config');
const { SLACK_WEBHOOK_URL, SLACK_WEBHOOK_TIMEOUT } = require('./config');
const debug = require('debug')('talk:plugin:slack-notifications');
// We don't add the hooks during _test_ as the Slack API is not available.
@@ -10,14 +10,9 @@ if (process.env.NODE_ENV === 'test') {
module.exports = {
RootMutation: {
createComment: {
async post(_, {input}, context, _info, result) {
async post(_, _, context, info, result) {
debug(`Posting notification to Slack webhook: ${SLACK_WEBHOOK_URL}`);
const {
comment: {
body: text,
created_at: createdAt
}
} = result;
const { comment: { body: text, created_at: createdAt } } = result;
const username = context.user.username;
process.nextTick(async () => {
const response = await fetch(SLACK_WEBHOOK_URL, {
@@ -27,16 +22,22 @@ module.exports = {
},
timeout: SLACK_WEBHOOK_TIMEOUT,
body: JSON.stringify({
attachments: [{
text: text,
footer: `Comment by ${username}`,
ts: Math.floor(Date.parse(createdAt) / 1000),
}]
attachments: [
{
text: text,
footer: `Comment by ${username}`,
ts: Math.floor(Date.parse(createdAt) / 1000),
},
],
}),
});
if (!response.ok) {
const responseText = await response.text();
console.trace(`Posting to Slack failed with HTTP code ${response.status} and body '${responseText}'`);
console.trace(
`Posting to Slack failed with HTTP code ${
response.status
} and body '${responseText}'`
);
}
});
return result;
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,4 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}
@@ -1,3 +0,0 @@
{
"extends": "@coralproject/eslint-config-talk"
}