You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by am...@apache.org on 2018/01/03 05:21:00 UTC

[couchdb-fauxton] branch upgrade-to-eslint-v4 updated (f3fd095 -> 44ea520)

This is an automated email from the ASF dual-hosted git repository.

amaranhao pushed a change to branch upgrade-to-eslint-v4
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git.


 discard f3fd095  Enable eslint-react recommended rules
 discard 430df0b  Fix lint issues
 discard 235c239  Use eslint recommended config
 discard 28da76b  Upgrade eslint to v4
     new 9f9db0f  Upgrade eslint to v4 with recommended config
     new e5ce26a  Fix lint issues
     new 44ea520  Enable eslint-react recommended rules

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (f3fd095)
            \
             N -- N -- N   refs/heads/upgrade-to-eslint-v4 (44ea520)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <co...@couchdb.apache.org>'].

[couchdb-fauxton] 03/03: Enable eslint-react recommended rules

Posted by am...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

amaranhao pushed a commit to branch upgrade-to-eslint-v4
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git

commit 44ea52078766e7d2112f568327986f6a9fa180b0
Author: Antonio Maranhao <an...@Antonios-MacBook-Pro.local>
AuthorDate: Tue Jan 2 17:40:22 2018 -0500

    Enable eslint-react recommended rules
---
 .eslintrc                                          | 12 ++++++----
 app/addons/activetasks/components.js               |  2 +-
 app/addons/auth/components/changepasswordform.js   |  4 ++--
 app/addons/auth/components/createadminform.js      |  4 ++--
 app/addons/auth/components/loginform.js            | 23 ++++++++++---------
 app/addons/components/components/bulkaction.js     |  4 ++--
 app/addons/components/components/codeeditor.js     |  8 +++----
 .../components/components/codeeditorpanel.js       |  7 +++---
 .../components/components/deletedatabasemodal.js   |  2 +-
 app/addons/components/components/menudropdown.js   |  1 -
 .../components/components/stringeditmodal.js       |  6 +++--
 app/addons/components/components/tray.js           |  1 -
 app/addons/components/components/zenmodeoverlay.js |  6 ++---
 app/addons/config/components.js                    |  4 ++--
 app/addons/databases/components.js                 |  4 ++--
 app/addons/documents/__tests__/table-row.test.js   |  1 -
 app/addons/documents/changes/components.js         | 11 ++++++---
 .../documents/components/header-docs-left.js       |  4 ++--
 .../__tests__/doc-editor.components.test.js        |  2 +-
 app/addons/documents/doc-editor/components.js      | 12 +++++-----
 .../index-editor/components/ReduceEditor.js        |  7 +++---
 .../components/queryoptions/KeySearchFields.js     | 26 +++++++++++++++++-----
 .../documents/mango/components/MangoIndexEditor.js | 10 ++++-----
 .../documents/mango/components/MangoQueryEditor.js | 10 ++++-----
 .../rev-browser/rev-browser.components.js          | 11 +++++----
 app/addons/documents/sidebar/sidebar.js            |  4 ++--
 app/addons/fauxton/notifications/notifications.js  |  2 +-
 app/addons/replication/controller.js               |  2 --
 28 files changed, 107 insertions(+), 83 deletions(-)

diff --git a/.eslintrc b/.eslintrc
index e062325..491dae8 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -6,7 +6,10 @@
     "react"
   ],
 
-  "extends": "eslint:recommended",
+  "extends": [
+    "eslint:recommended",
+    "plugin:react/recommended"
+  ],
 
   "rules": {
     "semi": [2, "always"],
@@ -19,15 +22,16 @@
     "computed-property-spacing": [2, "never"],
     "eol-last": 2,
     "no-case-declarations": 0,
-    "no-console": [2, { "allow": ["warn", "error", "info"] }],
+    "no-console": [1, { "allow": ["warn", "error", "info"] }],
     "no-mixed-spaces-and-tabs": [2, "smart-tabs"],
     "no-trailing-spaces": 2,
     "semi-spacing": [2, {"before": false, "after": true}],
     "space-in-parens": [2, "never"],
     "space-unary-ops": 2,
     "no-unused-vars": [2, {"varsIgnorePattern": "ReactDOM"}],
-    "react/jsx-uses-vars": 2,
-    "react/jsx-uses-react": 2
+    "react/display-name": 0,
+    // disabling for now since there are too many components without PropTypes
+    "react/prop-types": 0    
   },
 
   "parserOptions": {
diff --git a/app/addons/activetasks/components.js b/app/addons/activetasks/components.js
index c63927a..9ae1ce9 100644
--- a/app/addons/activetasks/components.js
+++ b/app/addons/activetasks/components.js
@@ -299,7 +299,7 @@ class ActiveTasksTableBody extends React.Component {
 
     return (
       <tr className="no-matching-database-on-search">
-        <td colSpan="6">No active {type} tasks match with filter: "{this.props.searchTerm}"</td>
+        <td colSpan="6">No active {type} tasks match with filter: &quot;{this.props.searchTerm}&quot;</td>
       </tr>
     );
   };
diff --git a/app/addons/auth/components/changepasswordform.js b/app/addons/auth/components/changepasswordform.js
index da77375..7ca0b8f 100644
--- a/app/addons/auth/components/changepasswordform.js
+++ b/app/addons/auth/components/changepasswordform.js
@@ -38,7 +38,7 @@ export class ChangePasswordForm extends React.Component {
   }
 
   componentDidMount() {
-    ReactDOM.findDOMNode(this.refs.password).focus();
+    this.passwordField.focus();
   }
 
   changePassword(e) {
@@ -59,7 +59,7 @@ export class ChangePasswordForm extends React.Component {
           <input
             id="password"
             type="password"
-            ref="password"
+            ref={node => this.passwordField = node}
             name="password"
             placeholder="Password"
             size="24"
diff --git a/app/addons/auth/components/createadminform.js b/app/addons/auth/components/createadminform.js
index 7229256..f92049b 100644
--- a/app/addons/auth/components/createadminform.js
+++ b/app/addons/auth/components/createadminform.js
@@ -37,7 +37,7 @@ export class CreateAdminForm extends React.Component {
   }
 
   componentDidMount() {
-    ReactDOM.findDOMNode(this.refs.username).focus();
+    this.usernameField.focus();
   }
 
   createAdmin(e) {
@@ -74,7 +74,7 @@ export class CreateAdminForm extends React.Component {
           <input
             id="username"
             type="text"
-            ref="username"
+            ref={node => this.usernameField = node}
             name="name"
             placeholder="Username"
             size="24"
diff --git a/app/addons/auth/components/loginform.js b/app/addons/auth/components/loginform.js
index 528d173..070a337 100644
--- a/app/addons/auth/components/loginform.js
+++ b/app/addons/auth/components/loginform.js
@@ -24,10 +24,13 @@ class LoginForm extends React.Component {
       password: ""
     };
   }
-  onInputChange(e) {
-    this.state[e.target.name] = e.target.value;
-    this.setState(this.state);
+  onUsernameChange(e) {
+    this.setState({username: e.target.value});
   }
+  onPasswordChange(e) {
+    this.setState({password: e.target.value});
+  }
+
   submit(e) {
     e.preventDefault();
     if (!this.checkUnrecognizedAutoFill()) {
@@ -42,10 +45,10 @@ class LoginForm extends React.Component {
     }
     let username = this.props.testBlankUsername
       ? this.props.testBlankUsername
-      : ReactDOM.findDOMNode(this.refs.username).value;
+      : this.usernameField.value;
     let password = this.props.testBlankPassword
       ? this.props.testBlankPassword
-      : ReactDOM.findDOMNode(this.refs.password).value;
+      : this.passwordField.value;
     this.setState({ username: username, password: password }); // doesn't set immediately, hence separate login() call
     this.login(username, password);
 
@@ -55,7 +58,7 @@ class LoginForm extends React.Component {
     login(username, password, this.props.urlBack);
   }
   componentDidMount() {
-    ReactDOM.findDOMNode(this.refs.username).focus();
+    this.usernameField.focus();
   }
   render() {
     return (
@@ -70,10 +73,10 @@ class LoginForm extends React.Component {
                 id="username"
                 type="text"
                 name="username"
-                ref="username"
+                ref={node => this.usernameField = node}
                 placeholder="Username"
                 size="24"
-                onChange={this.onInputChange.bind(this)}
+                onChange={this.onUsernameChange.bind(this)}
                 value={this.state.username}
               />
               <br />
@@ -81,10 +84,10 @@ class LoginForm extends React.Component {
                 id="password"
                 type="password"
                 name="password"
-                ref="password"
+                ref={node => this.passwordField = node}
                 placeholder="Password"
                 size="24"
-                onChange={this.onInputChange.bind(this)}
+                onChange={this.onPasswordChange.bind(this)}
                 value={this.state.password}
               />
               <br />
diff --git a/app/addons/components/components/bulkaction.js b/app/addons/components/components/bulkaction.js
index 12958be..fc63a81 100644
--- a/app/addons/components/components/bulkaction.js
+++ b/app/addons/components/components/bulkaction.js
@@ -70,14 +70,14 @@ export class BulkActionComponent extends React.Component {
   };
 
   selectAll = () => {
-    this.refs.bulkActionPopover.hide();
+    this.bulkActionPopover.hide();
     this.props.selectAll();
   };
 
   getOverlay = () => {
     return (
       <OverlayTrigger
-        ref="bulkActionPopover"
+        ref={node => this.bulkActionPopover = node}
         trigger="click"
         placement="bottom"
         rootClose={true}
diff --git a/app/addons/components/components/codeeditor.js b/app/addons/components/components/codeeditor.js
index 602de08..b9f8bf8 100644
--- a/app/addons/components/components/codeeditor.js
+++ b/app/addons/components/components/codeeditor.js
@@ -78,7 +78,7 @@ export class CodeEditor extends React.Component {
   };
 
   setupAce = (props, shouldUpdateCode) => {
-    this.editor = ace.edit(ReactDOM.findDOMNode(this.refs.ace));
+    this.editor = ace.edit(this.ace);
 
     // suppresses an Ace editor error
     this.editor.$blockScrolling = Infinity;
@@ -351,13 +351,13 @@ export class CodeEditor extends React.Component {
   render() {
     return (
       <div>
-        <div ref="ace" className="js-editor" id={this.props.id}></div>
-        <button ref="stringEditIcon" className="btn string-edit" title="Edit string" disabled={!this.state.stringEditIconVisible}
+        <div ref={node => this.ace = node} className="js-editor" id={this.props.id}></div>
+        <button ref={node => this.stringEditIcon = node} className="btn string-edit" title="Edit string" disabled={!this.state.stringEditIconVisible}
           style={this.state.stringEditIconStyle} onClick={this.openStringEditModal}>
           <i className="icon icon-edit"></i>
         </button>
         <StringEditModal
-          ref="stringEditModal"
+          ref={node => this.stringEditModal = node}
           visible={this.state.stringEditModalVisible}
           value={this.state.stringEditModalValue}
           onSave={this.saveStringEditModal}
diff --git a/app/addons/components/components/codeeditorpanel.js b/app/addons/components/components/codeeditorpanel.js
index 714304d..4853042 100644
--- a/app/addons/components/components/codeeditorpanel.js
+++ b/app/addons/components/components/codeeditorpanel.js
@@ -63,6 +63,7 @@ export class CodeEditorPanel extends React.Component {
           data-bypass="true"
           href={this.props.docLink}
           target="_blank"
+          rel="noopener noreferrer"
         >
           <i className="icon-question-sign"></i>
         </a>
@@ -85,7 +86,7 @@ export class CodeEditorPanel extends React.Component {
   enterZenMode = () => {
     this.setState({
       zenModeEnabled: true,
-      code: this.refs.codeEditor.getValue()
+      code: this.codeEditor.getValue()
     });
   };
 
@@ -95,7 +96,7 @@ export class CodeEditorPanel extends React.Component {
   };
 
   getEditor = () => {
-    return this.refs.codeEditor;
+    return this.codeEditor;
   };
 
   getValue = () => {
@@ -127,7 +128,7 @@ export class CodeEditorPanel extends React.Component {
         </label>
         <CodeEditor
           id={this.props.id}
-          ref="codeEditor"
+          ref={node => this.codeEditor = node}
           mode="javascript"
           defaultCode={this.state.code}
           showGutter={true}
diff --git a/app/addons/components/components/deletedatabasemodal.js b/app/addons/components/components/deletedatabasemodal.js
index e8213fe..65a2f33 100644
--- a/app/addons/components/components/deletedatabasemodal.js
+++ b/app/addons/components/components/deletedatabasemodal.js
@@ -94,7 +94,7 @@ export class DeleteDatabaseModal extends React.Component {
           <p>
             Warning: This action will permanently delete <code>{dbId}</code>.
             To confirm the deletion of the database and all of the
-            database's documents, you must enter the database's name.
+            database&apos;s documents, you must enter the database&apos;s name.
           </p>
           <input
             type="text"
diff --git a/app/addons/components/components/menudropdown.js b/app/addons/components/components/menudropdown.js
index a2e90c4..d10f014 100644
--- a/app/addons/components/components/menudropdown.js
+++ b/app/addons/components/components/menudropdown.js
@@ -72,7 +72,6 @@ export class MenuDropDown extends React.Component {
         <CustomMenu bsRole="menu" className="arrow">
           {menuItems}
         </CustomMenu>
-        }
       </Dropdown>
     );
   }
diff --git a/app/addons/components/components/stringeditmodal.js b/app/addons/components/components/stringeditmodal.js
index 9b8f06f..f960dd7 100644
--- a/app/addons/components/components/stringeditmodal.js
+++ b/app/addons/components/components/stringeditmodal.js
@@ -56,7 +56,7 @@ export class StringEditModal extends React.Component {
   }
 
   initEditor = (val) => {
-    this.editor = ace.edit(ReactDOM.findDOMNode(this.refs.stringEditor));
+    this.editor = ace.edit(this.stringEditor);
     this.editor.$blockScrolling = Infinity; // suppresses an Ace editor error
     this.editor.setShowPrintMargin(false);
     this.editor.setOption('highlightActiveLine', true);
@@ -80,7 +80,9 @@ export class StringEditModal extends React.Component {
         </Modal.Header>
         <Modal.Body>
           <div id="modal-error" className="hide alert alert-error"/>
-          <div id="string-editor-wrapper"><div ref="stringEditor" className="doc-code"></div></div>
+          <div id="string-editor-wrapper">
+            <div ref={node => this.stringEditor = node} className="doc-code"></div>
+          </div>
         </Modal.Body>
         <Modal.Footer>
           <a className="cancel-link" onClick={this.closeModal}>Cancel</a>
diff --git a/app/addons/components/components/tray.js b/app/addons/components/components/tray.js
index 41be571..335c36a 100644
--- a/app/addons/components/components/tray.js
+++ b/app/addons/components/components/tray.js
@@ -82,7 +82,6 @@ export class TrayContents extends React.Component {
        placement={"bottom"}
        container={this.props.container}
        rootClose={true}
-       target={() => ReactDOM.findDOMNode(this.refs.target)}
        onEnter={this.props.onEnter}
       >
         <TransitionMotion
diff --git a/app/addons/components/components/zenmodeoverlay.js b/app/addons/components/components/zenmodeoverlay.js
index 7cffb62..2834123 100644
--- a/app/addons/components/components/zenmodeoverlay.js
+++ b/app/addons/components/components/zenmodeoverlay.js
@@ -56,7 +56,7 @@ export class ZenModeOverlay extends React.Component {
   };
 
   getValue = () => {
-    return this.refs.ace.getValue();
+    return this.ace.getValue();
   };
 
   toggleTheme = () => {
@@ -107,7 +107,7 @@ export class ZenModeOverlay extends React.Component {
             </li>
             <li>
               <OverlayTrigger placement="left" overlay={tooltipTheme}>
-                <span ref="theme"
+                <span
                   className="fonticon fonticon-picture js-toggle-theme"
                   data-container=".zen-mode-controls .tooltips"
                   title="Switch zen theme"
@@ -119,7 +119,7 @@ export class ZenModeOverlay extends React.Component {
           <div className="tooltips"></div>
         </div>
         <CodeEditor
-          ref="ace"
+          ref={node => this.ace = node}
           autoFocus={true}
           theme={themes[this.state.theme]}
           defaultCode={this.props.defaultCode}
diff --git a/app/addons/config/components.js b/app/addons/config/components.js
index 3bd0d68..6fd6240 100644
--- a/app/addons/config/components.js
+++ b/app/addons/config/components.js
@@ -366,7 +366,7 @@ class AddOptionButton extends React.Component {
         <Button
           id="add-option-button"
           onClick={this.togglePopover.bind(this)}
-          ref="target">
+          ref={node => this.target = node}>
           <i className="icon icon-plus header-icon"></i>
           Add Option
         </Button>
@@ -376,7 +376,7 @@ class AddOptionButton extends React.Component {
           onHide={this.hidePopover.bind(this)}
           placement="bottom"
           rootClose={true}
-          target={() => ReactDOM.findDOMNode(this.refs.target)}>
+          target={() => this.target}>
           {this.getPopover()}
         </Overlay>
       </div>
diff --git a/app/addons/databases/components.js b/app/addons/databases/components.js
index 0bb9c31..f339679 100644
--- a/app/addons/databases/components.js
+++ b/app/addons/databases/components.js
@@ -227,7 +227,7 @@ class AddDatabaseWidget extends React.Component {
   };
 
   focusInput = () => {
-    ReactDOM.findDOMNode(this.refs.newDbName).focus();
+    this.newDbName.focus();
   };
 
   onKeyUpInInput = (e) => {
@@ -258,7 +258,7 @@ class AddDatabaseWidget extends React.Component {
           <span className="add-on">Create Database</span>
           <input
             id="js-new-database-name"
-            ref="newDbName"
+            ref={node => this.newDbName = node}
             type="text"
             value={this.state.databaseName}
             onChange={this.onChange} onKeyUp={this.onKeyUpInInput}
diff --git a/app/addons/documents/__tests__/table-row.test.js b/app/addons/documents/__tests__/table-row.test.js
index b2636c8..5f727f3 100644
--- a/app/addons/documents/__tests__/table-row.test.js
+++ b/app/addons/documents/__tests__/table-row.test.js
@@ -41,7 +41,6 @@ describe('Docs Table Row', () => {
     const wrapper = shallow(<TableRow
       onClick={sinon.stub()}
       docChecked={sinon.stub()}
-      isSelected={sinon.stub()}
       el={elem}
       data={data}
       index={0}
diff --git a/app/addons/documents/changes/components.js b/app/addons/documents/changes/components.js
index 60afcd8..cb5ff21 100644
--- a/app/addons/documents/changes/components.js
+++ b/app/addons/documents/changes/components.js
@@ -178,7 +178,7 @@ class AddFilterForm extends React.Component {
   }
 
   focusFilterField () {
-    ReactDOM.findDOMNode(this.refs.addItem).focus();
+    this.addItem.focus();
   }
 
   inputClassNames () {
@@ -194,8 +194,13 @@ class AddFilterForm extends React.Component {
       <form className="form-inline js-filter-form" onSubmit={this.submitForm}>
         <fieldset>
           <i className="fonticon-filter" />
-          <input type="text" ref="addItem" className={this.inputClassNames()} placeholder="Sequence or ID"
-                 onChange={(e) => this.setState({ filter: e.target.value })} value={this.state.filter} />
+          <input
+            type="text"
+            ref={node => this.addItem = node}
+            className={this.inputClassNames()}
+            placeholder="Sequence or ID"
+            onChange={(e) => this.setState({ filter: e.target.value })}
+            value={this.state.filter} />
           <button type="submit" className="btn btn-secondary">Filter</button>
           <div className="help-block"></div>
         </fieldset>
diff --git a/app/addons/documents/components/header-docs-left.js b/app/addons/documents/components/header-docs-left.js
index 1d14778..8be0e58 100644
--- a/app/addons/documents/components/header-docs-left.js
+++ b/app/addons/documents/components/header-docs-left.js
@@ -31,11 +31,11 @@ function getDropdownItems (items) {
 
     if (el.title && el.links) {
       const items = el.links.map((subel) => {
-        return <Item onClick={subel.onClick} icon={subel.icon} url={subel.url}>{subel.title}</Item>;
+        return <Item key={subel.title} onClick={subel.onClick} icon={subel.icon} url={subel.url}>{subel.title}</Item>;
       });
 
       return ([
-        <li className="header-label">{el.title}</li>,
+        <li key={el.title} className="header-label">{el.title}</li>,
         items
       ]);
     }
diff --git a/app/addons/documents/doc-editor/__tests__/doc-editor.components.test.js b/app/addons/documents/doc-editor/__tests__/doc-editor.components.test.js
index bc72537..178eb47 100644
--- a/app/addons/documents/doc-editor/__tests__/doc-editor.components.test.js
+++ b/app/addons/documents/doc-editor/__tests__/doc-editor.components.test.js
@@ -202,7 +202,7 @@ describe("Custom Extension Buttons", () => {
       render() {
         return (
           <div>
-            <button>Oh no she di'n't!</button>
+            <button>Oh no she di&apos;n&apos;t!</button>
             <span id="testDatabaseName">{this.props.database.id}</span>
           </div>
         );
diff --git a/app/addons/documents/doc-editor/components.js b/app/addons/documents/doc-editor/components.js
index 7c9afbc..8f98824 100644
--- a/app/addons/documents/doc-editor/components.js
+++ b/app/addons/documents/doc-editor/components.js
@@ -60,7 +60,7 @@ class DocEditorController extends React.Component {
     return (
       <GeneralComponents.CodeEditor
         id="doc-editor"
-        ref="docEditor"
+        ref={node => this.docEditor = node}
         defaultCode={code}
         mode="json"
         autoFocus={true}
@@ -110,7 +110,7 @@ class DocEditorController extends React.Component {
   };
 
   getEditor = () => {
-    return (this.refs.docEditor) ? this.refs.docEditor.getEditor() : null;
+    return (this.docEditor) ? this.docEditor.getEditor() : null;
   };
 
   checkDocIsValid = () => {
@@ -124,7 +124,7 @@ class DocEditorController extends React.Component {
   };
 
   clearChanges = () => {
-    this.refs.docEditor.clearChanges();
+    this.docEditor.clearChanges();
   };
 
   getExtensionIcons = () => {
@@ -184,7 +184,7 @@ class DocEditorController extends React.Component {
         </div>
 
         <UploadModal
-          ref="uploadModal"
+          ref={node => this.uploadModal = node}
           visible={this.state.uploadModalVisible}
           doc={this.state.doc} />
         <CloneDocModal
@@ -346,7 +346,7 @@ class UploadModal extends React.Component {
         <Modal.Body>
           <div className={errorClasses}>{this.state.errorMessage}</div>
           <div>
-            <form ref="uploadForm" className="form">
+            <form ref={node => this.uploadForm = node} className="form">
               <p>
                 Select a file to upload as an attachment to this document. Uploading a file saves the document as a new
                 revision.
@@ -430,7 +430,7 @@ class CloneDocModal extends React.Component {
             <p>
               You can modify the following generated ID for your new document.
             </p>
-            <input ref="newDocId" type="text" autoFocus={true} className="input-block-level"
+            <input ref={node => this.newDocId = node} type="text" autoFocus={true} className="input-block-level"
               onChange={this.docIDChange} value={this.state.uuid} />
           </form>
         </Modal.Body>
diff --git a/app/addons/documents/index-editor/components/ReduceEditor.js b/app/addons/documents/index-editor/components/ReduceEditor.js
index 3158f1c..3b4a4c1 100644
--- a/app/addons/documents/index-editor/components/ReduceEditor.js
+++ b/app/addons/documents/index-editor/components/ReduceEditor.js
@@ -65,11 +65,11 @@ export default class ReduceEditor extends Component {
       return this.state.reduce;
     }
 
-    return this.refs.reduceEditor.getValue();
+    return this.reduceEditor.getValue();
   }
 
   getEditor() {
-    return this.refs.reduceEditor.getEditor();
+    return this.reduceEditor.getEditor();
   }
 
   updateReduceCode(code) {
@@ -86,7 +86,7 @@ export default class ReduceEditor extends Component {
 
     if (this.state.hasCustomReduce) {
       customReduceSection = <CodeEditorPanel
-        ref='reduceEditor'
+        ref={node => this.reduceEditor = node}
         id='reduce-function'
         title={'Custom Reduce function'}
         defaultCode={this.state.reduce}
@@ -115,7 +115,6 @@ export default class ReduceEditor extends Component {
             selectId="reduce-function-selector"
             selectValue={this.state.reduceSelectedOption} />
         </div>
-
         {customReduceSection}
       </div>
     );
diff --git a/app/addons/documents/index-results/components/queryoptions/KeySearchFields.js b/app/addons/documents/index-results/components/queryoptions/KeySearchFields.js
index 76d192a..1fb2f90 100644
--- a/app/addons/documents/index-results/components/queryoptions/KeySearchFields.js
+++ b/app/addons/documents/index-results/components/queryoptions/KeySearchFields.js
@@ -28,8 +28,8 @@ export default class KeySearchFields extends React.Component {
 
   updateBetweenKeys () {
     this.props.updateBetweenKeys({
-      startkey: ReactDOM.findDOMNode(this.refs.startkey).value,
-      endkey: ReactDOM.findDOMNode(this.refs.endkey).value,
+      startkey: this.startkey.value,
+      endkey: this.endkey.value,
       include: this.props.betweenKeys.include
     });
   }
@@ -91,13 +91,29 @@ export default class KeySearchFields extends React.Component {
             <div className="controls controls-row">
               <div>
                 <label htmlFor="startkey" className="drop-down">Start key</label>
-                <input id="startkey" ref="startkey" type="text" onChange={this.updateBetweenKeys.bind(this)} value={this.props.betweenKeys.startkey} placeholder='e.g., "1234"' />
+                <input
+                  id="startkey"
+                  ref={node => this.startkey = node}
+                  type="text"
+                  onChange={this.updateBetweenKeys.bind(this)}
+                  value={this.props.betweenKeys.startkey}
+                  placeholder='e.g., "1234"' />
               </div>
               <div>
                 <label htmlFor="endkey" className="drop-down">End key</label>
-                <input id="endkey" ref="endkey" onChange={this.updateBetweenKeys.bind(this)} value={this.props.betweenKeys.endkey} type="text" placeholder='e.g., "1234"'/>
+                <input
+                  id="endkey"
+                  ref={node => this.endkey = node}
+                  onChange={this.updateBetweenKeys.bind(this)}
+                  value={this.props.betweenKeys.endkey}
+                  type="text"
+                  placeholder='e.g., "1234"'/>
                 <div className="controls include-end-key-row checkbox controls-row inline">
-                  <input id="qoIncludeEndKeyInResults" ref="inclusive_end" type="checkbox" onChange={this.updateInclusiveEnd.bind(this)} checked={this.props.betweenKeys.include}/>
+                  <input
+                    id="qoIncludeEndKeyInResults"
+                    type="checkbox"
+                    onChange={this.updateInclusiveEnd.bind(this)}
+                    checked={this.props.betweenKeys.include}/>
                   <label htmlFor="qoIncludeEndKeyInResults">Include End Key in results</label>
                 </div>
               </div>
diff --git a/app/addons/documents/mango/components/MangoIndexEditor.js b/app/addons/documents/mango/components/MangoIndexEditor.js
index 6e98af7..739a651 100644
--- a/app/addons/documents/mango/components/MangoIndexEditor.js
+++ b/app/addons/documents/mango/components/MangoIndexEditor.js
@@ -48,15 +48,15 @@ export default class MangoIndexEditor extends Component {
   }
 
   setEditorValue(newValue = '') {
-    return this.refs.codeEditor.getEditor().setValue(newValue);
+    return this.codeEditor.getEditor().setValue(newValue);
   }
 
   getEditorValue() {
-    return this.refs.codeEditor.getValue();
+    return this.codeEditor.getValue();
   }
 
   editorHasErrors() {
-    return this.refs.codeEditor.getEditor().hasErrors();
+    return this.codeEditor.getEditor().hasErrors();
   }
 
   onTemplateSelected(selectedItem) {
@@ -72,7 +72,7 @@ export default class MangoIndexEditor extends Component {
             <ReactSelect
               className="mango-select"
               options={this.props.templates}
-              ref="templates"
+              ref={node => this.templates = node}
               placeholder="Examples"
               searchable={false}
               clearable={false}
@@ -83,7 +83,7 @@ export default class MangoIndexEditor extends Component {
           <PaddedBorderedBox>
             <CodeEditorPanel
               id="query-field"
-              ref="codeEditor"
+              ref={node => this.codeEditor = node}
               title="Index"
               docLink={getDocUrl('MANGO_INDEX')}
               defaultCode={this.props.queryIndexCode} />
diff --git a/app/addons/documents/mango/components/MangoQueryEditor.js b/app/addons/documents/mango/components/MangoQueryEditor.js
index 88e9a2f..f04a158 100644
--- a/app/addons/documents/mango/components/MangoQueryEditor.js
+++ b/app/addons/documents/mango/components/MangoQueryEditor.js
@@ -46,15 +46,15 @@ export default class MangoQueryEditor extends Component {
   }
 
   setEditorValue (newValue = '') {
-    return this.refs.codeEditor.getEditor().setValue(newValue);
+    return this.codeEditor.getEditor().setValue(newValue);
   }
 
   getEditorValue () {
-    return this.refs.codeEditor.getValue();
+    return this.codeEditor.getValue();
   }
 
   editorHasErrors () {
-    return this.refs.codeEditor.getEditor().hasErrors();
+    return this.codeEditor.getEditor().hasErrors();
   }
 
   onHistorySelected(selectedItem) {
@@ -69,7 +69,7 @@ export default class MangoQueryEditor extends Component {
             <ReactSelect
               className="mango-select"
               options={this.props.history}
-              ref="history"
+              ref={node => this.history = node}
               placeholder="Query history"
               searchable={false}
               clearable={false}
@@ -80,7 +80,7 @@ export default class MangoQueryEditor extends Component {
           <PaddedBorderedBox>
             <CodeEditorPanel
               id="query-field"
-              ref="codeEditor"
+              ref={node => this.codeEditor = node}
               title={this.props.editorTitle}
               docLink={getDocUrl('MANGO_SEARCH')}
               defaultCode={this.props.queryFindCode} />
diff --git a/app/addons/documents/rev-browser/rev-browser.components.js b/app/addons/documents/rev-browser/rev-browser.components.js
index 7edf906..a6e4504 100644
--- a/app/addons/documents/rev-browser/rev-browser.components.js
+++ b/app/addons/documents/rev-browser/rev-browser.components.js
@@ -139,8 +139,8 @@ class SplitScreenArea extends React.Component {
     const format = (input) => { return JSON.stringify(input, null, '  '); };
 
     const jsmode = new JavaScriptMode();
-    const left = ReactDOM.findDOMNode(this.refs.revLeftOurs);
-    const right = ReactDOM.findDOMNode(this.refs.revRightTheirs);
+    const left = this.revLeftOurs;
+    const right = this.revRightTheirs;
 
     const leftRes = highlight.render(format(this.props.ours), jsmode, theme, 0, true);
     left.innerHTML = leftRes.html;
@@ -159,12 +159,12 @@ class SplitScreenArea extends React.Component {
       <div className="revision-split-area">
         <div data-id="ours" style={{width: '50%'}}>
           <div style={{marginBottom: '20px'}}>{ours._rev} (Server-Selected Rev)</div>
-          <pre ref="revLeftOurs"></pre>
+          <pre ref={node => this.revLeftOurs = node}></pre>
         </div>
 
         <div data-id="theirs" style={{width: '50%'}}>
           <div style={{marginBottom: '20px'}}>{theirs._rev}</div>
-          <pre ref="revRightTheirs"></pre>
+          <pre ref={node => this.revRightTheirs = node}></pre>
         </div>
       </div>
     );
@@ -184,8 +184,7 @@ const RevisionDiffArea = ({ours, theirs}) => {
       <div
         style={{marginTop: '30px'}}
         dangerouslySetInnerHTML={{__html: html}}
-      >
-      </div>
+      ></div>
     </div>
   );
 };
diff --git a/app/addons/documents/sidebar/sidebar.js b/app/addons/documents/sidebar/sidebar.js
index 90760bb..6ccc240 100644
--- a/app/addons/documents/sidebar/sidebar.js
+++ b/app/addons/documents/sidebar/sidebar.js
@@ -574,7 +574,7 @@ class CloneIndexModal extends React.Component {
   };
 
   submit = () => {
-    if (!this.refs.designDocSelector.validate()) {
+    if (!this.designDocSelector.validate()) {
       return;
     }
     if (this.props.newIndexName === '') {
@@ -615,7 +615,7 @@ class CloneIndexModal extends React.Component {
 
             <div className="row">
               <DesignDocSelector
-                ref="designDocSelector"
+                ref={node => this.designDocSelector = node}
                 designDocList={this.props.designDocArray}
                 selectedDesignDocName={this.props.selectedDesignDoc}
                 newDesignDocName={this.props.newDesignDocName}
diff --git a/app/addons/fauxton/notifications/notifications.js b/app/addons/fauxton/notifications/notifications.js
index 3e0f8f4..930bebb 100644
--- a/app/addons/fauxton/notifications/notifications.js
+++ b/app/addons/fauxton/notifications/notifications.js
@@ -282,7 +282,7 @@ class Notification extends React.Component {
         <div
           style={{opacity: style.opacity, minHeight: style.minHeight + 'px'}}
           className={'global-notification alert alert-' + this.props.type}
-          ref="notification">
+          ref={node => this.notification = node}>
           <a data-bypass href="#" onClick={this.hide}><i className="pull-right fonticon-cancel" /></a>
           <i className={'notification-icon ' + iconMap[this.props.type]} />
           <span dangerouslySetInnerHTML={this.getMsg()}></span>
diff --git a/app/addons/replication/controller.js b/app/addons/replication/controller.js
index 3d312b1..6e96f0c 100644
--- a/app/addons/replication/controller.js
+++ b/app/addons/replication/controller.js
@@ -170,7 +170,6 @@ export default class ReplicationController extends React.Component {
         selectAllDocs={Actions.selectAllReplicates}
         allDocsSelected={allReplicateSelected}
         someDocsSelected={someReplicateSelected}
-        deleteDocs={Actions.deleteDocs}
         activitySort={activitySort}
         changeActivitySort={Actions.changeActivitySort}
         deleteDocs={Actions.deleteReplicates}
@@ -187,7 +186,6 @@ export default class ReplicationController extends React.Component {
       onFilterChange={Actions.filterDocs}
       selectAllDocs={Actions.selectAllDocs}
       selectDoc={Actions.selectDoc}
-      selectAllDocs={Actions.selectAllDocs}
       allDocsSelected={allDocsSelected}
       someDocsSelected={someDocsSelected}
       deleteDocs={Actions.deleteDocs}

-- 
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <co...@couchdb.apache.org>.

[couchdb-fauxton] 02/03: Fix lint issues

Posted by am...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

amaranhao pushed a commit to branch upgrade-to-eslint-v4
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git

commit e5ce26aa60f785879778510696e8525d554378b8
Author: Antonio Maranhao <an...@Antonios-MacBook-Pro.local>
AuthorDate: Tue Jan 2 14:36:54 2018 -0500

    Fix lint issues
---
 Gruntfile.js                                             |  2 +-
 app/addons/components/components/codeeditor.js           |  2 +-
 app/addons/cors/reducers.js                              |  5 ++---
 .../documents/__tests__/queryoptions-actions.test.js     | 12 ++++++------
 app/addons/documents/__tests__/reducers.test.js          |  8 ++++----
 app/addons/documents/__tests__/resources.test.js         | 12 ++++++------
 app/addons/documents/header/header.js                    |  2 +-
 .../documents/index-results/actions/queryoptions.js      |  4 ++--
 .../components/pagination/PaginationFooter.js            |  2 +-
 .../components/queryoptions/AdditionalParams.js          |  2 +-
 .../components/queryoptions/KeySearchFields.js           |  2 +-
 .../index-results/components/results/ResultsScreen.js    |  2 +-
 .../index-results/components/results/TableRow.js         |  4 ++--
 .../index-results/components/results/TableView.js        |  2 +-
 .../components/results/WrappedAutocomplete.js            |  2 +-
 app/addons/documents/index-results/reducers.js           |  2 +-
 app/addons/documents/mango/components/ExecutionStats.js  |  8 ++++----
 app/addons/documents/mango/components/ExplainPage.js     |  6 +++---
 app/addons/documents/mango/mango.reducers.js             |  2 +-
 app/addons/documents/mangolayout.js                      |  4 ++--
 app/addons/documents/resources.js                        |  2 +-
 app/addons/documents/sidebar/reducers.js                 |  2 +-
 .../documents/tests/nightwatch/selectDocViaTypeahead.js  |  2 +-
 app/addons/fauxton/appwrapper.js                         |  2 +-
 app/addons/fauxton/navigation/components/NavLink.js      |  2 +-
 app/addons/permissions/components/PermissionsItem.js     |  2 +-
 app/addons/permissions/reducers.js                       |  2 +-
 app/addons/replication/api.js                            |  1 -
 app/addons/replication/components/common-table.js        |  1 -
 app/addons/replication/controller.js                     |  3 ---
 app/addons/replication/stores.js                         | 11 +----------
 app/addons/replication/tests/nightwatch/replication.js   |  1 -
 app/helpers.js                                           |  2 +-
 bin/remove-test-dbs.js                                   |  4 ++--
 devserver.js                                             | 16 ++++++++--------
 index.js                                                 |  9 +++++----
 tasks/fauxton.js                                         |  2 +-
 webpack.config.dev.js                                    |  4 ++--
 webpack.config.release.js                                | 16 ++++++----------
 39 files changed, 75 insertions(+), 94 deletions(-)

diff --git a/Gruntfile.js b/Gruntfile.js
index 62cc59d..6ca330e 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -211,7 +211,7 @@ module.exports = function (grunt) {
    */
   // dev server
   grunt.registerTask('dev', function () {
-    console.log('This is deprecated. Please run npm run dev instead');
+    console.warn('This is deprecated. Please run npm run dev instead');
   });
 
   // build a debug release
diff --git a/app/addons/components/components/codeeditor.js b/app/addons/components/components/codeeditor.js
index b8862e7..602de08 100644
--- a/app/addons/components/components/codeeditor.js
+++ b/app/addons/components/components/codeeditor.js
@@ -251,7 +251,7 @@ export class CodeEditor extends React.Component {
     // one JS(ON) string can't span more than one line - we edit one string, so ensure we don't select several lines
     if (selStart >= 0 && selEnd >= 0 && selStart === selEnd && this.isRowExpanded(selStart)) {
       var editLine = this.getLine(selStart),
-          editMatch = editLine.match(/^([ \t]*)("[a-zA-Z0-9_\-]*["|']: )?(["|'].*",?[ \t]*)$/);
+          editMatch = editLine.match(/^([ \t]*)("[a-zA-Z0-9_-]*["|']: )?(["|'].*",?[ \t]*)$/);
 
       if (editMatch) {
         return editMatch;
diff --git a/app/addons/cors/reducers.js b/app/addons/cors/reducers.js
index 9b8d3f2..3e85cbb 100644
--- a/app/addons/cors/reducers.js
+++ b/app/addons/cors/reducers.js
@@ -28,7 +28,7 @@ export default function cors (state = initialState, action) {
   switch (action.type) {
 
     case ActionTypes.EDIT_CORS:
-      const corsOptions = action.options;
+    const corsOptions = action.options;
       return {
         ...state,
         isLoading: false,
@@ -63,5 +63,4 @@ export default function cors (state = initialState, action) {
     default:
       return state;
   }
-};
-
+}
diff --git a/app/addons/documents/__tests__/queryoptions-actions.test.js b/app/addons/documents/__tests__/queryoptions-actions.test.js
index 0fa54f3..7072617 100644
--- a/app/addons/documents/__tests__/queryoptions-actions.test.js
+++ b/app/addons/documents/__tests__/queryoptions-actions.test.js
@@ -77,16 +77,16 @@ describe('Docs Query Options API', () => {
   it('queryOptionsUpdateBetweenKeys returns the proper event to dispatch', () => {
     const newBetweenKeys = {
       include: true,
-      startkey: '\"_design\"',
-      endkey: '\"_design\"'
+      startkey: '"_design"',
+      endkey: '"_design"'
     };
     expect(Actions.queryOptionsUpdateBetweenKeys(newBetweenKeys)).toEqual({
       type: ActionTypes.INDEX_RESULTS_REDUX_NEW_QUERY_OPTIONS,
       options: {
         betweenKeys: {
           include: true,
-          startkey: '\"_design\"',
-          endkey: '\"_design\"'
+          startkey: '"_design"',
+          endkey: '"_design"'
         }
       }
     });
@@ -148,8 +148,8 @@ describe('Docs Query Options API', () => {
       options: {
         betweenKeys: {
           include: false,
-          startkey: '\"_design\"',
-          endkey: '\"_design0\"'
+          startkey: '"_design"',
+          endkey: '"_design0"'
         },
         showBetweenKeys: true,
         showByKeys: false
diff --git a/app/addons/documents/__tests__/reducers.test.js b/app/addons/documents/__tests__/reducers.test.js
index 1257300..f9a08d9 100644
--- a/app/addons/documents/__tests__/reducers.test.js
+++ b/app/addons/documents/__tests__/reducers.test.js
@@ -381,8 +381,8 @@ describe('Docs Reducers', () => {
           showBetweenKeys: true,
           betweenKeys: {
             include: true,
-            startkey: '\"_design\"',
-            endkey: '\"_design0\"'
+            startkey: '"_design"',
+            endkey: '"_design0"'
           }
         }
       };
@@ -390,8 +390,8 @@ describe('Docs Reducers', () => {
       const newState = Reducers.default(initialState, action);
       expect(Reducers.getQueryOptionsParams(newState)).toEqual({
         inclusive_end: true,
-        start_key: '\"_design\"',
-        end_key: '\"_design0\"'
+        start_key: '"_design"',
+        end_key: '"_design0"'
       });
     });
 
diff --git a/app/addons/documents/__tests__/resources.test.js b/app/addons/documents/__tests__/resources.test.js
index cbcf28d..c6951ea 100644
--- a/app/addons/documents/__tests__/resources.test.js
+++ b/app/addons/documents/__tests__/resources.test.js
@@ -93,8 +93,8 @@ describe('QueryParams', () => {
 
     it('parses startkey, endkey', () => {
       const params = {
-        'startkey':'[\"a\",\"b\"]',
-        'endkey':'[\"c\",\"d\"]'
+        'startkey':'["a","b"]',
+        'endkey':'["c","d"]'
       };
       const result = Models.QueryParams.parse(params);
 
@@ -115,7 +115,7 @@ describe('QueryParams', () => {
 
     it('does not modify input', () => {
       const params = {
-        key:'[\"a\",\"b\"]'
+        key:'["a","b"]'
       };
       const clone = _.clone(params);
       Models.QueryParams.parse(params);
@@ -140,8 +140,8 @@ describe('QueryParams', () => {
       const result = Models.QueryParams.stringify(params);
 
       assert.deepEqual(result, {
-        'startkey':'[\"a\",\"b\"]',
-        'endkey':'[\"c\",\"d\"]'
+        'startkey':'["a","b"]',
+        'endkey':'["c","d"]'
       });
     });
 
@@ -149,7 +149,7 @@ describe('QueryParams', () => {
       const params = {'key':['a', 'b']};
       const result = Models.QueryParams.stringify(params);
 
-      assert.deepEqual(result, { 'key': '[\"a\",\"b\"]' });
+      assert.deepEqual(result, { 'key': '["a","b"]' });
     });
 
     it('does not modify input', () => {
diff --git a/app/addons/documents/header/header.js b/app/addons/documents/header/header.js
index 2a0382a..ba54213 100644
--- a/app/addons/documents/header/header.js
+++ b/app/addons/documents/header/header.js
@@ -95,4 +95,4 @@ export default class BulkDocumentHeaderController extends React.Component {
       return;
     }
   }
-};
+}
diff --git a/app/addons/documents/index-results/actions/queryoptions.js b/app/addons/documents/index-results/actions/queryoptions.js
index efba5fa..33c277d 100644
--- a/app/addons/documents/index-results/actions/queryoptions.js
+++ b/app/addons/documents/index-results/actions/queryoptions.js
@@ -112,8 +112,8 @@ export const queryOptionsFilterOnlyDdocs = () => {
   return updateQueryOptions({
     betweenKeys: {
       include: false,
-      startkey: '\"_design\"',
-      endkey: '\"_design0\"'
+      startkey: '"_design"',
+      endkey: '"_design0"'
     },
     showBetweenKeys: true,
     showByKeys: false
diff --git a/app/addons/documents/index-results/components/pagination/PaginationFooter.js b/app/addons/documents/index-results/components/pagination/PaginationFooter.js
index 9d00674..5f1c663 100644
--- a/app/addons/documents/index-results/components/pagination/PaginationFooter.js
+++ b/app/addons/documents/index-results/components/pagination/PaginationFooter.js
@@ -89,4 +89,4 @@ export default class PaginationFooter extends React.Component {
       </footer>
     );
   }
-};
+}
diff --git a/app/addons/documents/index-results/components/queryoptions/AdditionalParams.js b/app/addons/documents/index-results/components/queryoptions/AdditionalParams.js
index f3be5f0..48f09b9 100644
--- a/app/addons/documents/index-results/components/queryoptions/AdditionalParams.js
+++ b/app/addons/documents/index-results/components/queryoptions/AdditionalParams.js
@@ -75,4 +75,4 @@ export default class AdditionalParams extends React.Component {
       </div>
     );
   }
-};
+}
diff --git a/app/addons/documents/index-results/components/queryoptions/KeySearchFields.js b/app/addons/documents/index-results/components/queryoptions/KeySearchFields.js
index dddb63e..76d192a 100644
--- a/app/addons/documents/index-results/components/queryoptions/KeySearchFields.js
+++ b/app/addons/documents/index-results/components/queryoptions/KeySearchFields.js
@@ -108,4 +108,4 @@ export default class KeySearchFields extends React.Component {
       </div>
     );
   }
-};
+}
diff --git a/app/addons/documents/index-results/components/results/ResultsScreen.js b/app/addons/documents/index-results/components/results/ResultsScreen.js
index 4cdb0f6..8420c61 100644
--- a/app/addons/documents/index-results/components/results/ResultsScreen.js
+++ b/app/addons/documents/index-results/components/results/ResultsScreen.js
@@ -130,4 +130,4 @@ export default class ResultsScreen extends React.Component {
     );
   }
 
-};
+}
diff --git a/app/addons/documents/index-results/components/results/TableRow.js b/app/addons/documents/index-results/components/results/TableRow.js
index b983d86..2ec380b 100644
--- a/app/addons/documents/index-results/components/results/TableRow.js
+++ b/app/addons/documents/index-results/components/results/TableRow.js
@@ -63,11 +63,11 @@ export default class TableRow extends React.Component {
   }
 
   getAdditionalInfoRow (el) {
-    const attachmentCount = Object.keys(el._attachments || {}).length;
+    const attachmentCount = Object.keys(el._attachments || {}).length;
     let attachmentIndicator = null;
     let textAttachments = null;
 
-    const conflictCount = Object.keys(el._conflicts || {}).length;
+    const conflictCount = Object.keys(el._conflicts || {}).length;
     let conflictIndicator = null;
     let textConflicts = null;
 
diff --git a/app/addons/documents/index-results/components/results/TableView.js b/app/addons/documents/index-results/components/results/TableView.js
index 580f2a0..550a088 100644
--- a/app/addons/documents/index-results/components/results/TableView.js
+++ b/app/addons/documents/index-results/components/results/TableView.js
@@ -101,4 +101,4 @@ export default class TableView extends React.Component {
       </div>
     );
   }
-};
+}
diff --git a/app/addons/documents/index-results/components/results/WrappedAutocomplete.js b/app/addons/documents/index-results/components/results/WrappedAutocomplete.js
index 5b1c52a..17c9814 100644
--- a/app/addons/documents/index-results/components/results/WrappedAutocomplete.js
+++ b/app/addons/documents/index-results/components/results/WrappedAutocomplete.js
@@ -38,4 +38,4 @@ export default function WrappedAutocomplete ({
       </div>
     </div>
   );
-};
+}
diff --git a/app/addons/documents/index-results/reducers.js b/app/addons/documents/index-results/reducers.js
index cfa73d5..3263ea3 100644
--- a/app/addons/documents/index-results/reducers.js
+++ b/app/addons/documents/index-results/reducers.js
@@ -173,7 +173,7 @@ export default function resultsState(state = initialState, action) {
     default:
       return state;
   }
-};
+}
 
 // we don't want to muddy the waters with autogenerated mango docs
 export const removeGeneratedMangoDocs = (doc) => {
diff --git a/app/addons/documents/mango/components/ExecutionStats.js b/app/addons/documents/mango/components/ExecutionStats.js
index 3b070d7..9198796 100644
--- a/app/addons/documents/mango/components/ExecutionStats.js
+++ b/app/addons/documents/mango/components/ExecutionStats.js
@@ -49,7 +49,7 @@ export default class ExecutionStats extends React.Component {
   }
 
   warningPopupComponent(warningText) {
-    if (!!warningText) {
+    if (warningText) {
       return (<div className="warning">
         <i className="fonticon-attention-circled"></i> {warningText}
       </div>);
@@ -95,7 +95,7 @@ export default class ExecutionStats extends React.Component {
     const warningText = this.getWarning(executionStats, warning);
 
     let warningComponent = null;
-    if (!!warningText) {
+    if (warningText) {
       warningComponent = <i className="fonticon-attention-circled"></i>;
     }
 
@@ -104,7 +104,7 @@ export default class ExecutionStats extends React.Component {
       executionStatsComponent = (
         <span className="execution-stats-component">Executed in {this.humanizeDuration(executionStats.execution_time_ms)}</span>
       );
-    } else if (!!warningText) {
+    } else if (warningText) {
       executionStatsComponent = (
         <span className="execution-stats-component">Warning</span>
       );
@@ -120,7 +120,7 @@ export default class ExecutionStats extends React.Component {
         </OverlayTrigger>
     );
   }
-};
+}
 
 ExecutionStats.propTypes = {
   executionStats: PropTypes.object,
diff --git a/app/addons/documents/mango/components/ExplainPage.js b/app/addons/documents/mango/components/ExplainPage.js
index db7eef3..cf44918 100644
--- a/app/addons/documents/mango/components/ExplainPage.js
+++ b/app/addons/documents/mango/components/ExplainPage.js
@@ -17,11 +17,11 @@ import React, { Component } from "react";
 export default class ExplainPage extends Component {
   componentDidMount () {
     prettyPrint();
-  };
+  }
 
   componentDidUpdate () {
     prettyPrint();
-  };
+  }
 
   render () {
     return (
@@ -29,7 +29,7 @@ export default class ExplainPage extends Component {
         <pre className="prettyprint">{JSON.stringify(this.props.explainPlan, null, ' ')}</pre>
       </div>
     );
-  };
+  }
 }
 
 ExplainPage.propTypes = {
diff --git a/app/addons/documents/mango/mango.reducers.js b/app/addons/documents/mango/mango.reducers.js
index 06fd8be..8e4cd80 100644
--- a/app/addons/documents/mango/mango.reducers.js
+++ b/app/addons/documents/mango/mango.reducers.js
@@ -202,4 +202,4 @@ export default function mangoquery(state = initialState, action) {
     default:
       return state;
   }
-};
+}
diff --git a/app/addons/documents/mangolayout.js b/app/addons/documents/mangolayout.js
index ef9d917..c375800 100644
--- a/app/addons/documents/mangolayout.js
+++ b/app/addons/documents/mangolayout.js
@@ -116,7 +116,7 @@ export const MangoContent = ({ edit, designDocs, explainPlan, databaseName, fetc
 class MangoLayout extends Component {
   constructor(props) {
     super(props);
-  };
+  }
 
   render() {
     const { database, edit, docURL, crumbs, designDocs, fetchUrl, databaseName, queryFindCode } = this.props;
@@ -150,7 +150,7 @@ class MangoLayout extends Component {
       </div>
     );
   }
-};
+}
 
 const mapStateToProps = ({ mangoQuery }) => {
   return {
diff --git a/app/addons/documents/resources.js b/app/addons/documents/resources.js
index 15a394a..93bc0c0 100644
--- a/app/addons/documents/resources.js
+++ b/app/addons/documents/resources.js
@@ -107,7 +107,7 @@ Documents.BulkDeleteDocCollection = FauxtonAPI.Collection.extend({
 
   model: Documents.BulkDeleteDoc,
 
-  sync: function () {
+  sync: function () {
 
   },
 
diff --git a/app/addons/documents/sidebar/reducers.js b/app/addons/documents/sidebar/reducers.js
index ef295f4..6359823 100644
--- a/app/addons/documents/sidebar/reducers.js
+++ b/app/addons/documents/sidebar/reducers.js
@@ -27,4 +27,4 @@ export default function resultsState(state = initialState, action) {
     default:
       return state;
   }
-};
+}
diff --git a/app/addons/documents/tests/nightwatch/selectDocViaTypeahead.js b/app/addons/documents/tests/nightwatch/selectDocViaTypeahead.js
index 87e9bee..67c2a52 100644
--- a/app/addons/documents/tests/nightwatch/selectDocViaTypeahead.js
+++ b/app/addons/documents/tests/nightwatch/selectDocViaTypeahead.js
@@ -41,7 +41,7 @@ module.exports = {
         baseUrl = client.globals.test_settings.launch_url;
 
     client
-      .createDocument('MY_CAP_DOC_ID', newDatabaseName, {value: 1, value: 2})
+      .createDocument('MY_CAP_DOC_ID', newDatabaseName, {value: 2})
       .loginToGUI()
       .url(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs')
       .clickWhenVisible('.fonticon-json')
diff --git a/app/addons/fauxton/appwrapper.js b/app/addons/fauxton/appwrapper.js
index 2074c77..8510433 100644
--- a/app/addons/fauxton/appwrapper.js
+++ b/app/addons/fauxton/appwrapper.js
@@ -99,4 +99,4 @@ export default class App extends React.Component {
       </div>
     );
   }
-};
+}
diff --git a/app/addons/fauxton/navigation/components/NavLink.js b/app/addons/fauxton/navigation/components/NavLink.js
index 14a9841..6ba591c 100644
--- a/app/addons/fauxton/navigation/components/NavLink.js
+++ b/app/addons/fauxton/navigation/components/NavLink.js
@@ -31,7 +31,7 @@ const NavLink = ({link, active, isMinimized}) => {
     <span className="faux-navbar__text">{link.title}</span>;
 
   let linkIcon = null;
-  if (!!link.icon) {
+  if (link.icon) {
     linkIcon = (
       <i className={classNames(
         link.icon,
diff --git a/app/addons/permissions/components/PermissionsItem.js b/app/addons/permissions/components/PermissionsItem.js
index 1097b52..069b77a 100644
--- a/app/addons/permissions/components/PermissionsItem.js
+++ b/app/addons/permissions/components/PermissionsItem.js
@@ -14,7 +14,7 @@ import PropTypes from 'prop-types';
 
 import React from 'react';
 
-const PermissionsItem = ({removeItem, section, type, value}) => {
+const PermissionsItem = ({removeItem, section, type, value}) => {
 
   return (
     <li className="permissions__entry">
diff --git a/app/addons/permissions/reducers.js b/app/addons/permissions/reducers.js
index 3bf70b7..20bb27d 100644
--- a/app/addons/permissions/reducers.js
+++ b/app/addons/permissions/reducers.js
@@ -41,7 +41,7 @@ export default function permissions (state = initialState, action) {
     default:
       return state;
   }
-};
+}
 
 function getRoles (type, permissions) {
   if (!permissions[type]) {
diff --git a/app/addons/replication/api.js b/app/addons/replication/api.js
index 8db1204..c017fbd 100644
--- a/app/addons/replication/api.js
+++ b/app/addons/replication/api.js
@@ -120,7 +120,6 @@ export const getTarget = ({
   replicationTarget,
   localTarget,
   remoteTarget,
-  replicationSource,
   username,
   password
 },
diff --git a/app/addons/replication/components/common-table.js b/app/addons/replication/components/common-table.js
index 3912261..457b689 100644
--- a/app/addons/replication/components/common-table.js
+++ b/app/addons/replication/components/common-table.js
@@ -24,7 +24,6 @@ export const formatUrl = (url) => {
     urlObj = new URL(removeCredentialsFromUrl(url));
     encoded = encodeURIComponent(urlObj.pathname.slice(1));
   } catch (error) {
-    console.log('error with url', url);
     return '';
   }
 
diff --git a/app/addons/replication/controller.js b/app/addons/replication/controller.js
index 8de28db..3d312b1 100644
--- a/app/addons/replication/controller.js
+++ b/app/addons/replication/controller.js
@@ -38,7 +38,6 @@ export default class ReplicationController extends React.Component {
       activityLoading: store.isActivityLoading(),
       databases: store.getDatabases(),
       authenticated: store.isAuthenticated(),
-      password: store.getPassword(),
 
       // source fields
       replicationSource: store.getReplicationSource(),
@@ -257,8 +256,6 @@ export default class ReplicationController extends React.Component {
     } else {
       return [{'name': 'Replication'}];
     }
-
-    return [];
   }
 
   getTabs () {
diff --git a/app/addons/replication/stores.js b/app/addons/replication/stores.js
index 19badc7..b726636 100644
--- a/app/addons/replication/stores.js
+++ b/app/addons/replication/stores.js
@@ -26,8 +26,7 @@ const validFieldMap = {
   replicationDocName: '_replicationDocName',
   replicationSource: '_replicationSource',
   replicationTarget: '_replicationTarget',
-  localSource: '_localSource',
-  replicationDocName: '_replicationDocName'
+  localSource: '_localSource'
 };
 
 const ReplicationStore = FauxtonAPI.Store.extend({
@@ -303,10 +302,6 @@ const ReplicationStore = FauxtonAPI.Store.extend({
     return this._isConflictModalVisible;
   },
 
-  getPassword () {
-    return this._password;
-  },
-
   setStateFromDoc (doc) {
     Object.keys(doc).forEach(key => {
       this.updateFormField(key, doc[key]);
@@ -413,10 +408,6 @@ const ReplicationStore = FauxtonAPI.Store.extend({
         this._tabSection = options;
       break;
 
-      case ActionTypes.REPLICATION_CLEAR_SELECTED_DOCS:
-        this._allDocsSelected = false;
-      break;
-
       case ActionTypes.REPLICATION_SUPPORT_NEW_API:
         this._checkingAPI = false;
         this._supportNewApi = options;
diff --git a/app/addons/replication/tests/nightwatch/replication.js b/app/addons/replication/tests/nightwatch/replication.js
index c523c8f..bd0c4a4 100644
--- a/app/addons/replication/tests/nightwatch/replication.js
+++ b/app/addons/replication/tests/nightwatch/replication.js
@@ -39,7 +39,6 @@ module.exports = {
     const waitTime = client.globals.maxWaitTime;
     const baseUrl = client.globals.test_settings.launch_url;
     const password = client.globals.test_settings.password;
-    console.log('PASSWORD', password);
 
     client
       .createDatabase(newDatabaseName1)
diff --git a/app/helpers.js b/app/helpers.js
index 93c750c..1a73538 100644
--- a/app/helpers.js
+++ b/app/helpers.js
@@ -58,7 +58,7 @@ Helpers.getDateFromNow = function (timestamp) {
 };
 
 Helpers.escapeJQuerySelector = function (selector) {
-  return selector && selector.replace(/[!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g, "\\$&");
+  return selector && selector.replace(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, "\\$&");
 };
 
 /**
diff --git a/bin/remove-test-dbs.js b/bin/remove-test-dbs.js
index ac7a8dc..0307560 100755
--- a/bin/remove-test-dbs.js
+++ b/bin/remove-test-dbs.js
@@ -23,14 +23,14 @@ const nano = require('nano')(dbUrl);
 
 nano.db.list((err, body) => {
   if (err) {
-    console.log('ERR', err);
+    console.error('ERR', err);
     return;
   }
   const list = body.filter(db => {
     return /fauxton-selenium-tests/.test(db);
   }).map(db => {
     return (cb) => {
-      console.log('removing', db);
+      console.info('Removing db', db);
       nano.db.destroy(db, (err) => {
         if (err) {
           cb(err);
diff --git a/devserver.js b/devserver.js
index 691d6ee..d3aadcb 100644
--- a/devserver.js
+++ b/devserver.js
@@ -26,7 +26,7 @@ const loadSettings = function () {
 const settings = loadSettings();
 
 const devSetup = function (cb) {
-  console.log('setup dev environment');
+  console.info('setup dev environment');
   let cmd = 'devSetupWithClean';
   if (settings.noClean) {
     cmd = 'devSetup';
@@ -36,15 +36,15 @@ const devSetup = function (cb) {
   const grunt = spawn(gruntCmd, [cmd]);
 
   grunt.stdout.on('data', (data) => {
-    console.log(data.toString());
+    console.info(data.toString());
   });
 
   grunt.stderr.on('error', (data) => {
-    console.log('Setup error:', data.toString());
+    console.info('Setup error:', data.toString());
   });
 
   grunt.on('close', (code) => {
-    console.log('dev setup finished with code', code);
+    console.info('dev setup finished with code', code);
     if (code === 0) {
       cb();
     }
@@ -63,7 +63,7 @@ function getCspHeaders () {
   return {
     'Content-Security-Policy': cspHeader
   };
-};
+}
 
 const runWebpackServer = function () {
   const proxy = httpProxy.createServer({
@@ -113,11 +113,11 @@ const runWebpackServer = function () {
 
   server.listen(options.port, '0.0.0.0', function (err) {
     if (err) {
-      console.log(err);
+      console.error(err);
       return;
     }
-    console.log('listening on', options.host, options.port);
-    console.log('Starting first compile. This will take about 10 seconds...');
+    console.info('listening on', options.host, options.port);
+    console.info('Starting first compile. This will take about 10 seconds...');
   });
 };
 
diff --git a/index.js b/index.js
index a17d629..9c8d022 100644
--- a/index.js
+++ b/index.js
@@ -16,9 +16,9 @@ module.exports = function (options) {
     return send(req, filePath)
     .on('error', function (err) {
       if (err.status === 404) {
-        console.log('Could not locate', filePath);
+        console.error('Could not locate', filePath);
       } else {
-        console.log('ERROR', filePath, err);
+        console.error('ERROR', filePath, err);
       }
 
       res.setHeader("Content-Type", "text/javascript");
@@ -46,7 +46,7 @@ module.exports = function (options) {
     var url = req.url.split(/\?v=|\?noCache/)[0].replace('_utils', '');
     var accept = [];
     if (req.headers.accept) {
-      var accept = req.headers.accept.split(',');
+      accept = req.headers.accept.split(',');
     }
     if (setContentSecurityPolicy) {
       var headerValue = "default-src 'self'; child-src 'self' data: blob:; img-src 'self' data:; font-src 'self'; " +
@@ -93,9 +93,10 @@ module.exports = function (options) {
   ];
 
   _.each(logo, function (line) {
+    // eslint-disable-next-line no-console
     console.log(line.toString());
   });
-
+  // eslint-disable-next-line no-console
   console.log('Listening on ' + port);
 
   this.close = () => {
diff --git a/tasks/fauxton.js b/tasks/fauxton.js
index b93f838..77f3fd5 100644
--- a/tasks/fauxton.js
+++ b/tasks/fauxton.js
@@ -84,7 +84,7 @@ module.exports = function (grunt) {
     var result = _getNightwatchTests(this.data.settings);
     var addonsWithTests = result.addonFolders;
     var excludeTests = result.excludeTests;
-    console.log('addons and excluded', addonsWithTests, excludeTests);
+    console.info('addons and excluded', addonsWithTests, excludeTests);
 
     // if the user passed a --file="X" on the command line, filter out
     var singleTestToRun = grunt.option('file');
diff --git a/webpack.config.dev.js b/webpack.config.dev.js
index 2ba72f9..c4aab29 100644
--- a/webpack.config.dev.js
+++ b/webpack.config.dev.js
@@ -78,8 +78,8 @@ module.exports = {
           loader: "less-loader",
           options: {
             modifyVars: {
-              largeLogoPath: "\'" + settings.variables.largeLogoPath + "\'",
-              smallLogoPath: "\'" + settings.variables.smallLogoPath + "\'"
+              largeLogoPath: "'" + settings.variables.largeLogoPath + "'",
+              smallLogoPath: "'" + settings.variables.smallLogoPath + "'"
             }
           }
         }
diff --git a/webpack.config.release.js b/webpack.config.release.js
index 4490598..ca18e16 100644
--- a/webpack.config.release.js
+++ b/webpack.config.release.js
@@ -68,8 +68,10 @@ module.exports = {
   ],
 
   resolve: {
-    // Allow to omit extensions when requiring these files
-    extensions: ['', '.js', '.jsx']
+    extensions: ['*', '.js', '.jsx'],
+    alias: {
+      "underscore": "lodash"
+    }
   },
 
   module: {
@@ -113,8 +115,8 @@ module.exports = {
             loader: "less-loader",
             options: {
               modifyVars: {
-                largeLogoPath: "\'" + settings.variables.largeLogoPath + "\'",
-                smallLogoPath: "\'" + settings.variables.smallLogoPath + "\'"
+                largeLogoPath: "'" + settings.variables.largeLogoPath + "'",
+                smallLogoPath: "'" + settings.variables.smallLogoPath + "'"
               }
             }
           }
@@ -143,11 +145,5 @@ module.exports = {
     { test: /\.gif(\?v=\d+\.\d+\.\d+)?$/,    loader: 'file-loader?name=dashboard.assets/img/[name].[ext]' },
     { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,    loader: 'url-loader?limit=10000&mimetype=image/svg+xml&name=dashboard.assets/img/[name].[ext]' }
     ]
-  },
-  resolve: {
-    extensions: ['*', '.js', '.jsx'],
-    alias: {
-      "underscore": "lodash"
-    }
   }
 };

-- 
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <co...@couchdb.apache.org>.

[couchdb-fauxton] 01/03: Upgrade eslint to v4 with recommended config

Posted by am...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

amaranhao pushed a commit to branch upgrade-to-eslint-v4
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git

commit 9f9db0feb3e710f4b6cc4af6ecf96689b72a79f9
Author: Antonio Maranhao <an...@reserved-192-168-2-10.rchland.ibm.com>
AuthorDate: Tue Jan 2 11:33:28 2018 -0500

    Upgrade eslint to v4 with recommended config
---
 .eslintrc    | 10 ++++------
 package.json |  6 +++---
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/.eslintrc b/.eslintrc
index a83517b..e062325 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -6,14 +6,10 @@
     "react"
   ],
 
-  "rules-todo": {
-    "space-unary-ops": 2,
-    "camelcase": 2
-  },
+  "extends": "eslint:recommended",
 
   "rules": {
     "semi": [2, "always"],
-    "no-undef": 2,
     "keyword-spacing": 2,
     "space-infix-ops": 2,
     "space-before-blocks": 2,
@@ -22,11 +18,13 @@
     "comma-spacing": [2, {"before": false, "after": true}],
     "computed-property-spacing": [2, "never"],
     "eol-last": 2,
+    "no-case-declarations": 0,
+    "no-console": [2, { "allow": ["warn", "error", "info"] }],
     "no-mixed-spaces-and-tabs": [2, "smart-tabs"],
     "no-trailing-spaces": 2,
     "semi-spacing": [2, {"before": false, "after": true}],
-    "no-empty": 2,
     "space-in-parens": [2, "never"],
+    "space-unary-ops": 2,
     "no-unused-vars": [2, {"varsIgnorePattern": "ReactDOM"}],
     "react/jsx-uses-vars": 2,
     "react/jsx-uses-react": 2
diff --git a/package.json b/package.json
index 9571531..4bb3cce 100644
--- a/package.json
+++ b/package.json
@@ -37,7 +37,7 @@
     "babel": "^6.3.26",
     "babel-cli": "^6.22.2",
     "babel-core": "^6.22.1",
-    "babel-eslint": "~8.0.1",
+    "babel-eslint": "~8.1.2",
     "babel-loader": "^6.2.9",
     "babel-plugin-array-includes": "^2.0.3",
     "babel-plugin-transform-class-properties": "^6.24.1",
@@ -58,9 +58,9 @@
     "couchapp": "~0.11.0",
     "css-loader": "^0.26.1",
     "d3": "^3.4.11",
-    "eslint": "^3.14.1",
+    "eslint": "^4.14.0",
     "eslint-loader": "^1.3.0",
-    "eslint-plugin-react": "^6.7.1",
+    "eslint-plugin-react": "^7.5.1",
     "exports-loader": "^0.6.2",
     "expose-loader": "0.7.1",
     "express": "^4.14.1",

-- 
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <co...@couchdb.apache.org>.