diff --git a/webapp/.eslintrc.json b/webapp/.eslintrc.json
index c5c100e6e3..2762483ef9 100644
--- a/webapp/.eslintrc.json
+++ b/webapp/.eslintrc.json
@@ -36,6 +36,7 @@
"block-scoped-var": 2,
"brace-style": [2, "1tbs", { "allowSingleLine": false }],
"camelcase": [2, {"properties": "never"}],
+ "class-methods-use-this": 1,
"comma-dangle": [2, "never"],
"comma-spacing": [2, {"before": false, "after": true}],
"comma-style": [2, "last"],
@@ -48,6 +49,7 @@
"dot-location": [2, "object"],
"dot-notation": 2,
"eqeqeq": [2, "smart"],
+ "func-call-spacing": [2, "never"],
"func-names": 2,
"func-style": [2, "declaration"],
"generator-star-spacing": [2, {"before": false, "after": true}],
@@ -56,14 +58,16 @@
"id-blacklist": 0,
"indent": [2, 4, {"SwitchCase": 0}],
"jsx-quotes": [2, "prefer-single"],
- "key-spacing": [2, {"beforeColon": false, "afterColon": true}],
+ "key-spacing": [2, {"beforeColon": false, "afterColon": true, "mode": "strict"}],
"keyword-spacing": [2, {"before": true, "after": true, "overrides": {}}],
+ "line-comment-position": 0,
"linebreak-style": 2,
"lines-around-comment": [2, { "beforeBlockComment": true, "beforeLineComment": true, "allowBlockStart": true, "allowBlockEnd": true }],
"max-lines": [1, {"max": 450, "skipBlankLines": true, "skipComments": false}],
"max-nested-callbacks": [1, {"max":1}],
"max-nested-callbacks": [2, {"max":2}],
"max-statements-per-line": [2, {"max": 1}],
+ "multiline-ternary": [1, "never"],
"new-cap": 2,
"new-parens": 2,
"newline-before-return": 0,
@@ -99,6 +103,8 @@
"no-fallthrough": 2,
"no-floating-decimal": 2,
"no-func-assign": 2,
+ "no-global-assign": 2,
+ "no-implicit-coercion": 2,
"no-implicit-globals": 0,
"no-implied-eval": 2,
"no-inner-declarations": 0,
@@ -131,12 +137,14 @@
"no-redeclare": 2,
"no-return-assign": [2, "always"],
"no-script-url": 2,
- "no-self-assign": 2,
+ "no-self-assign": [2, {"props": true}],
"no-self-compare": 2,
"no-sequences": 2,
"no-shadow": [2, {"hoist": "functions"}],
"no-shadow-restricted-names": 2,
"no-spaced-func": 2,
+ "no-tabs": 0,
+ "no-template-curly-in-string": 2,
"no-ternary": 0,
"no-this-before-super": 2,
"no-throw-literal": 2,
@@ -149,6 +157,7 @@
"no-unneeded-ternary": [2, {"defaultAssignment": false}],
"no-unreachable": 2,
"no-unsafe-finally": 2,
+ "no-unsafe-negation": 2,
"no-unused-expressions": 2,
"no-unused-vars": [2, {"vars": "all", "args": "after-used"}],
"no-use-before-define": [2, "nofunc"],
@@ -172,6 +181,7 @@
"padded-blocks": [2, "never"],
"prefer-arrow-callback": 2,
"prefer-const": 2,
+ "prefer-numeric-literals": 2,
"prefer-reflect": 2,
"prefer-rest-params": 2,
"prefer-spread": 2,
@@ -184,6 +194,7 @@
"react/jsx-closing-bracket-location": [2, { "location": "tag-aligned" }],
"react/jsx-curly-spacing": [2, "never"],
"react/jsx-equals-spacing": [2, "never"],
+ "react/jsx-filename-extension": 2,
"react/jsx-first-prop-new-line": [2, "multiline"],
"react/jsx-handler-names": 0,
"react/jsx-indent": [2, 4],
@@ -196,11 +207,10 @@
"react/jsx-no-target-blank": 2,
"react/jsx-no-undef": 2,
"react/jsx-pascal-case": 2,
- "react/jsx-filename-extension": 2,
"react/jsx-space-before-closing": [2, "never"],
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
- "react/no-comment-textnodes": 2,
+ "react/jsx-no-comment-textnodes": 2,
"react/no-danger": 0,
"react/no-deprecated": 2,
"react/no-did-mount-set-state": 2,
@@ -219,19 +229,28 @@
"react/require-render-return": 2,
"react/self-closing-comp": 2,
"react/sort-comp": 0,
- "react/wrap-multilines": 2,
+ "react/jsx-wrap-multilines": 2,
+ "react/no-find-dom-node": 1,
+ "react/forbid-component-props": 0,
+ "react/no-danger-with-children": 2,
+ "react/no-unused-prop-types": [1, {"skipShapeProps": true}],
+ "react/style-prop-object": 2,
+ "react/no-children-prop": 2,
+ "react/no-unescaped-entities": 2,
"require-yield": 2,
"rest-spread-spacing": [2, "never"],
"semi": [2, "always"],
"semi-spacing": [2, {"before": false, "after": true}],
"sort-imports": 0,
+ "sort-keys": 0,
"space-before-blocks": [2, "always"],
"space-before-function-paren": [2, "never"],
"space-in-parens": [2, "never"],
"space-infix-ops": 2,
"space-unary-ops": [2, { "words": true, "nonwords": false }],
+ "symbol-description": 2,
"template-curly-spacing": [2, "never"],
- "valid-typeof": 2,
+ "valid-typeof": [2, {"requireStringLiterals": false}],
"vars-on-top": 0,
"wrap-iife": [2, "outside"],
"wrap-regex": 2,
diff --git a/webapp/actions/global_actions.jsx b/webapp/actions/global_actions.jsx
index 3b38d16b0d..bc7562d44e 100644
--- a/webapp/actions/global_actions.jsx
+++ b/webapp/actions/global_actions.jsx
@@ -253,7 +253,7 @@ export function loadMorePostsTop(id, isFocusPost) {
export function emitLoadMorePostsFocusedBottomEvent() {
const id = PostStore.getFocusedPostId();
const latestPostId = PostStore.getLatestPost(id).id;
- AsyncClient.getPostsAfter(latestPostId, 0, Constants.POST_CHUNK_SIZE, !!id);
+ AsyncClient.getPostsAfter(latestPostId, 0, Constants.POST_CHUNK_SIZE, Boolean(id));
}
export function emitUserPostedEvent(post) {
diff --git a/webapp/client/client.jsx b/webapp/client/client.jsx
index 4cd9c7c7cf..439d41f78b 100644
--- a/webapp/client/client.jsx
+++ b/webapp/client/client.jsx
@@ -749,7 +749,7 @@ export default class Client {
updateActive(userId, active, success, error) {
var data = {};
data.user_id = userId;
- data.active = '' + active;
+ data.active = String(active);
request.
post(`${this.getUsersRoute()}/update_active`).
@@ -1336,7 +1336,7 @@ export default class Client {
set(this.defaultHeaders).
type('application/json').
accept('application/json').
- send({channelId, command, suggest: '' + suggest}).
+ send({channelId, command, suggest: String(suggest)}).
end(this.handleResponse.bind(this, 'executeCommand', success, error));
this.track('api', 'api_integrations_used');
diff --git a/webapp/components/activity_log_modal.jsx b/webapp/components/activity_log_modal.jsx
index 7560cf5d91..2c093e1d21 100644
--- a/webapp/components/activity_log_modal.jsx
+++ b/webapp/components/activity_log_modal.jsx
@@ -90,7 +90,7 @@ export default class ActivityLogModal extends React.Component {
this.setState({moreInfo: newMoreInfo});
}
render() {
- let activityList = [];
+ const activityList = [];
for (let i = 0; i < this.state.sessions.length; i++) {
const currentSession = this.state.sessions[i];
diff --git a/webapp/components/admin_console/admin_navbar_dropdown.jsx b/webapp/components/admin_console/admin_navbar_dropdown.jsx
index 0bac263efc..f57635a11c 100644
--- a/webapp/components/admin_console/admin_navbar_dropdown.jsx
+++ b/webapp/components/admin_console/admin_navbar_dropdown.jsx
@@ -77,7 +77,7 @@ export default class AdminNavbarDropdown extends React.Component {
+ />
);
}
@@ -118,7 +118,7 @@ export default class AdminNavbarDropdown extends React.Component {
+ />
+ />
diff --git a/webapp/components/admin_console/audits.jsx b/webapp/components/admin_console/audits.jsx
index cb500f29c0..5e0e03607b 100644
--- a/webapp/components/admin_console/audits.jsx
+++ b/webapp/components/admin_console/audits.jsx
@@ -86,7 +86,7 @@ export default class Audits extends React.Component {
className='btn btn-link pull-right'
onClick={this.reload}
>
-
+
-
+
-
+
-
+
- |
+ |
-
+
-
+
-
+
;
+ return ;
}
let testMessage = null;
if (this.state.fail) {
testMessage = (
-
+
;
+ return ;
}
let testMessage = null;
if (this.state.fail) {
testMessage = (
-
+
-
+
{currentRoles}
-
+
{auditInfo.sessionId};
}
- let descStyle = {};
+ const descStyle = {};
if (auditInfo.desc.toLowerCase().indexOf('fail') !== -1) {
descStyle.color = 'red';
}
diff --git a/webapp/components/backstage/components/backstage_header.jsx b/webapp/components/backstage/components/backstage_header.jsx
index 37b4be349f..c2dc187b76 100644
--- a/webapp/components/backstage/components/backstage_header.jsx
+++ b/webapp/components/backstage/components/backstage_header.jsx
@@ -20,7 +20,7 @@ export default class BackstageHeader extends React.Component {
key={'divider' + index}
className='backstage-header__divider'
>
-
+
);
}
diff --git a/webapp/components/backstage/components/backstage_list.jsx b/webapp/components/backstage/components/backstage_list.jsx
index ecb8783b79..974a552398 100644
--- a/webapp/components/backstage/components/backstage_list.jsx
+++ b/webapp/components/backstage/components/backstage_list.jsx
@@ -89,7 +89,7 @@ export default class BackstageList extends React.Component {
-
+
+ />
diff --git a/webapp/components/emoji/components/emoji_list.jsx b/webapp/components/emoji/components/emoji_list.jsx
index 273fc8a257..340fc6afcf 100644
--- a/webapp/components/emoji/components/emoji_list.jsx
+++ b/webapp/components/emoji/components/emoji_list.jsx
@@ -69,7 +69,7 @@ export default class EmojiList extends React.Component {
const filter = this.state.filter.toLowerCase();
const isSystemAdmin = Utils.isSystemAdmin(this.props.user.roles);
- let emojis = [];
+ const emojis = [];
if (this.state.loading) {
emojis.push(
@@ -129,7 +129,7 @@ export default class EmojiList extends React.Component {
|
);
diff --git a/webapp/components/file_upload_overlay.jsx b/webapp/components/file_upload_overlay.jsx
index 25fafddf17..86697cd628 100644
--- a/webapp/components/file_upload_overlay.jsx
+++ b/webapp/components/file_upload_overlay.jsx
@@ -26,7 +26,7 @@ export default class FileUploadOverlay extends React.Component {
src={fileOverlayImage}
alt='Files'
/>
-
+
{
const filter = this.state.filter.toLowerCase();
- return !!((chan.name.toLowerCase().indexOf(filter) !== -1 || chan.display_name.toLowerCase().indexOf(filter) !== -1) && chan.delete_at === 0);
+ return Boolean((chan.name.toLowerCase().indexOf(filter) !== -1 || chan.display_name.toLowerCase().indexOf(filter) !== -1) && chan.delete_at === 0);
});
}
diff --git a/webapp/components/get_link_modal.jsx b/webapp/components/get_link_modal.jsx
index 0f41b3b29d..5363ad217f 100644
--- a/webapp/components/get_link_modal.jsx
+++ b/webapp/components/get_link_modal.jsx
@@ -97,7 +97,7 @@ export default class GetLinkModal extends React.Component {
if (this.state.copiedLink) {
copyLinkConfirm = (
-
+
{this.props.children}
-
+
diff --git a/webapp/components/integrations/components/installed_outgoing_webhook.jsx b/webapp/components/integrations/components/installed_outgoing_webhook.jsx
index 4b478255c8..6644398430 100644
--- a/webapp/components/integrations/components/installed_outgoing_webhook.jsx
+++ b/webapp/components/integrations/components/installed_outgoing_webhook.jsx
@@ -115,7 +115,7 @@ export default class InstalledOutgoingWebhook extends React.Component {
);
}
- let urls = (
+ const urls = (
-
+
);
diff --git a/webapp/components/loading_screen.jsx b/webapp/components/loading_screen.jsx
index 288eda3894..fe2cd6b11c 100644
--- a/webapp/components/loading_screen.jsx
+++ b/webapp/components/loading_screen.jsx
@@ -31,9 +31,9 @@ export default class LoadingScreen extends React.Component {
{message}
-
-
-
+
+
+
);
diff --git a/webapp/components/navbar.jsx b/webapp/components/navbar.jsx
index 1e7711d2cc..d55c2723bf 100644
--- a/webapp/components/navbar.jsx
+++ b/webapp/components/navbar.jsx
@@ -446,7 +446,7 @@ export default class Navbar extends React.Component {
aria-expanded='true'
>
{channelTitle}
-
+
-
-
-
+
+
+
);
} else {
@@ -517,9 +517,9 @@ export default class Navbar extends React.Component {
defaultMessage='Toggle sidebar'
/>
-
-
-
+
+
+
);
diff --git a/webapp/components/navbar_dropdown.jsx b/webapp/components/navbar_dropdown.jsx
index c29bf61c37..60be477677 100644
--- a/webapp/components/navbar_dropdown.jsx
+++ b/webapp/components/navbar_dropdown.jsx
@@ -278,7 +278,7 @@ export default class NavbarDropdown extends React.Component {
+ />
);
for (var index in this.state.teamMembers) {
@@ -409,15 +409,15 @@ export default class NavbarDropdown extends React.Component {
/>
-
+
{integrationsLink}
{this.renderCustomEmojiLink()}
-
+
{teamSettings}
{manageLink}
{sysAdminLink}
{teams}
-
+
{helpLink}
{reportLink}
diff --git a/webapp/components/permalink_view.jsx b/webapp/components/permalink_view.jsx
index 55e250d04a..5cd2d0fff1 100644
--- a/webapp/components/permalink_view.jsx
+++ b/webapp/components/permalink_view.jsx
@@ -81,7 +81,7 @@ export default class PermalinkView extends React.Component {
id='center_panel.recent'
defaultMessage='Click here to jump to recent messages. '
/>
-
+
diff --git a/webapp/components/post_view/components/post_attachment.jsx b/webapp/components/post_view/components/post_attachment.jsx
index 4442b735ad..57335b94a0 100644
--- a/webapp/components/post_view/components/post_attachment.jsx
+++ b/webapp/components/post_view/components/post_attachment.jsx
@@ -87,7 +87,7 @@ class PostAttachment extends React.Component {
return '';
}
- let fieldTables = [];
+ const fieldTables = [];
let headerCols = [];
let bodyCols = [];
@@ -104,7 +104,7 @@ class PostAttachment extends React.Component {
>
- {headerCols}
+ {headerCols}
@@ -134,8 +134,7 @@ class PostAttachment extends React.Component {
className='attachment-field'
key={'attachment__field-' + i + '__' + nrTables}
dangerouslySetInnerHTML={{__html: TextFormatting.formatText(field.value || '')}}
- >
-
+ />
);
rowPos += 1;
lastWasLong = !(field.short === true);
@@ -175,8 +174,7 @@ class PostAttachment extends React.Component {
-
+ />
);
}
@@ -250,8 +248,7 @@ class PostAttachment extends React.Component {
-
+ />
);
}
@@ -307,7 +304,7 @@ class PostAttachment extends React.Component {
{fields}
{thumb}
-
+
diff --git a/webapp/components/post_view/components/post_attachment_list.jsx b/webapp/components/post_view/components/post_attachment_list.jsx
index 7da9efbeeb..7e9d7980de 100644
--- a/webapp/components/post_view/components/post_attachment_list.jsx
+++ b/webapp/components/post_view/components/post_attachment_list.jsx
@@ -7,7 +7,7 @@ import React from 'react';
export default class PostAttachmentList extends React.Component {
render() {
- let content = [];
+ const content = [];
this.props.attachments.forEach((attachment, i) => {
content.push(
-
+
);
diff --git a/webapp/components/rhs_thread.jsx b/webapp/components/rhs_thread.jsx
index 73c2fb9dcc..7d0de85900 100644
--- a/webapp/components/rhs_thread.jsx
+++ b/webapp/components/rhs_thread.jsx
@@ -247,7 +247,7 @@ export default class RhsThread extends React.Component {
if (postsArray == null || selected == null) {
return (
-
+
);
}
diff --git a/webapp/components/search_bar.jsx b/webapp/components/search_bar.jsx
index 970da79259..dc00095edd 100644
--- a/webapp/components/search_bar.jsx
+++ b/webapp/components/search_bar.jsx
@@ -148,7 +148,7 @@ export default class SearchBar extends React.Component {
render() {
var isSearching = null;
if (this.state.isSearching) {
- isSearching = ;
+ isSearching = ;
}
let helpClass = 'search-help-popover';
@@ -162,7 +162,7 @@ export default class SearchBar extends React.Component {
className='sidebar__collapse'
onClick={this.handleClose}
>
-
+
{Constants.BOT_NAME};
}
- let profilePic = (
+ const profilePic = (
-
+ />
);
}
diff --git a/webapp/components/settings_sidebar.jsx b/webapp/components/settings_sidebar.jsx
index 3ccd372f70..d537b6d108 100644
--- a/webapp/components/settings_sidebar.jsx
+++ b/webapp/components/settings_sidebar.jsx
@@ -23,8 +23,8 @@ export default class SettingsSidebar extends React.Component {
}
}
render() {
- let tabList = this.props.tabs.map((tab) => {
- let key = `${tab.name}_li`;
+ const tabList = this.props.tabs.map((tab) => {
+ const key = `${tab.name}_li`;
let className = '';
if (this.props.activeTab === tab.name) {
className = 'active';
diff --git a/webapp/components/sidebar.jsx b/webapp/components/sidebar.jsx
index df1df22a87..712d755483 100644
--- a/webapp/components/sidebar.jsx
+++ b/webapp/components/sidebar.jsx
@@ -529,9 +529,9 @@ export default class Sidebar extends React.Component {
var icon = null;
if (channel.type === 'O') {
- icon =
;
+ icon =
;
} else if (channel.type === 'P') {
- icon =
;
+ icon =
;
} else {
// set up status icon for direct message channels (status is null for other channel types)
icon = ;
diff --git a/webapp/components/sidebar_right.jsx b/webapp/components/sidebar_right.jsx
index 7d99349194..ffafb94345 100644
--- a/webapp/components/sidebar_right.jsx
+++ b/webapp/components/sidebar_right.jsx
@@ -37,7 +37,7 @@ export default class SidebarRight extends React.Component {
this.state = {
searchVisible: SearchStore.getSearchResults() !== null,
isMentionSearch: SearchStore.getIsMentionSearch(),
- postRightVisible: !!PostStore.getSelectedPost(),
+ postRightVisible: Boolean(PostStore.getSelectedPost()),
expanded: false,
fromSearch: false,
currentUser: UserStore.getCurrentUser(),
@@ -88,7 +88,7 @@ export default class SidebarRight extends React.Component {
$('.app__body .inner-wrap').removeClass('move--left').removeClass('move--right');
$('.app__body .sidebar--right').removeClass('move--left');
return (
-
+
);
}
@@ -118,7 +118,7 @@ export default class SidebarRight extends React.Component {
onSelectedChange(fromSearch, fromFlaggedPosts) {
this.setState({
- postRightVisible: !!PostStore.getSelectedPost(),
+ postRightVisible: Boolean(PostStore.getSelectedPost()),
fromSearch,
fromFlaggedPosts
});
diff --git a/webapp/components/sidebar_right_menu.jsx b/webapp/components/sidebar_right_menu.jsx
index a281252646..6f6a32a5ea 100644
--- a/webapp/components/sidebar_right_menu.jsx
+++ b/webapp/components/sidebar_right_menu.jsx
@@ -177,7 +177,7 @@ export default class SidebarRightMenu extends React.Component {
href='#'
onClick={GlobalActions.showInviteMemberModal}
>
-
+