From 4b22c1f99cb05be5ca187f2fd70ee2664c34de57 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Thu, 3 Sep 2015 10:49:36 -0400 Subject: Upgrading ESLint and adding some more rules. Refactoring to meet these new rules --- web/react/.eslintrc | 35 +++++++++-- web/react/components/channel_info_modal.jsx | 30 +++++----- web/react/components/channel_invite_modal.jsx | 4 +- web/react/components/create_post.jsx | 9 ++- web/react/components/edit_post_modal.jsx | 14 +++-- web/react/components/email_verify.jsx | 14 +++-- web/react/components/error_bar.jsx | 3 +- web/react/components/file_attachment.jsx | 20 ++++--- web/react/components/file_attachment_list.jsx | 6 +- web/react/components/find_team.jsx | 5 +- web/react/components/member_list.jsx | 18 +++--- web/react/components/member_list_item.jsx | 23 ++++--- web/react/components/mention.jsx | 13 ++-- web/react/components/mention_list.jsx | 9 ++- web/react/components/more_channels.jsx | 26 +++++--- web/react/components/navbar_dropdown.jsx | 52 +++++++++------- web/react/components/new_channel.jsx | 21 ++++--- web/react/components/post.jsx | 15 +++-- web/react/components/post_list.jsx | 2 +- web/react/components/rhs_comment.jsx | 3 +- web/react/components/rhs_root_post.jsx | 3 +- web/react/components/rhs_thread.jsx | 3 +- web/react/components/search_bar.jsx | 14 +++-- web/react/components/setting_item_max.jsx | 17 ++++-- web/react/components/setting_picture.jsx | 13 ++-- web/react/components/setting_upload.jsx | 18 +++--- web/react/components/sidebar_header.jsx | 10 ++-- web/react/components/sidebar_right.jsx | 10 ++-- web/react/components/sidebar_right_menu.jsx | 3 +- web/react/components/signup_team_complete.jsx | 70 +++++++++++++--------- web/react/components/team_import_tab.jsx | 29 +++++++-- web/react/components/team_signup_choose_auth.jsx | 4 +- .../components/team_signup_display_name_page.jsx | 17 ++++-- web/react/components/view_image.jsx | 8 ++- web/react/package.json | 4 +- web/react/pages/channel.jsx | 9 ++- web/react/pages/login.jsx | 3 +- web/react/pages/signup_team_complete.jsx | 3 +- web/react/pages/signup_user_complete.jsx | 3 +- web/react/pages/verify.jsx | 3 +- 40 files changed, 359 insertions(+), 207 deletions(-) diff --git a/web/react/.eslintrc b/web/react/.eslintrc index ab000e941..41558aacd 100644 --- a/web/react/.eslintrc +++ b/web/react/.eslintrc @@ -4,7 +4,9 @@ "jsx": true, "blockBindings": true, "modules": true, - "classes": true + "classes": true, + "arrowFunctions": true, + "defaultParams": true, }, "plugins": [ "react" @@ -34,16 +36,16 @@ "no-inner-declarations": 0, "no-invalid-regexp": 2, "no-irregular-whitespace": 2, + "no-unexpected-multiline": 2, "no-unreachable": 2, "valid-typeof": 2, - "no-unexpected-multiline": 2, "block-scoped-var": 1, "complexity": [0, 8], "consistent-return": 2, "curly": [2, "all"], - "dot-notation": 2, "dot-location": [2, "object"], + "dot-notation": 2, "eqeqeq": [2, "smart"], "guard-for-in": 1, "no-alert": 1, @@ -78,8 +80,9 @@ "no-self-compare": 2, "no-sequences": 2, "no-throw-literal": 2, - "no-unused-expressions": 2, "no-undef-init": 2, + "no-unused-expressions": 2, + "no-useless-concat": 0, "no-void": 2, "no-warning-comments": 0, "no-with": 2, @@ -135,12 +138,31 @@ "space-unary-ops": [2, { "words": true, "nonwords": false }], "wrap-regex": 2, + // ES6 stuff + "arrow-parens": [2, "always"], + "arrow-spacing": [2, { "before": true, "after": true }], + "constructor-super": 2, + "generator-star-spacing": [2, {"before": false, "after": true}], + "no-class-assign": 2, + "no-const-assign": 2, + "no-dupe-class-members": 2, + "no-this-before-super": 2, + "no-var": 0, + "object-shorthand": [0, "always"], + "prefer-arrow-callback": 0, + "prefer-const": 0, + "prefer-spread": 2, + "prefer-reflect": 0, + "prefer-template": 0, + "require-yield": 0, + // React Specific "react/display-name": [2, { "acceptTranspilerName": true }], "react/jsx-boolean-value": [2, "always"], + "react/jsx-closing-bracket-location": [2, { "location": "tag-aligned" }], "react/jsx-curly-spacing": [2, "never"], + "react/jsx-indent-props": [2, 4], "react/jsx-max-props-per-line": [2, { "maximum": 1 }], - // SOON "react/jsx-indent-props": [2, 4], "react/jsx-no-duplicate-props": [2, { "ignoreCase": false }], "react/jsx-no-literals": 0, "react/jsx-no-undef": 2, @@ -151,10 +173,11 @@ "react/no-did-mount-set-state": 2, "react/no-did-update-set-state": 2, "react/no-multi-comp": 2, + "react/no-set-state": 0, "react/no-unknown-property": 2, "react/prop-types": 2, - "react/sort-comp": 0, "react/self-closing-comp": 2, + "react/sort-comp": 0, "react/wrap-multilines": 2 } } diff --git a/web/react/components/channel_info_modal.jsx b/web/react/components/channel_info_modal.jsx index fae86b4b9..fdd9a5c17 100644 --- a/web/react/components/channel_info_modal.jsx +++ b/web/react/components/channel_info_modal.jsx @@ -34,27 +34,27 @@ export default class CommandList extends React.Component { return (