#552 Lint the Javascript
Merged 6 years ago by abompard. Opened 6 years ago by abompard.
abompard/fedora-hubs fix/lint-js  into  develop

@@ -1,20 +1,10 @@ 

  {

-   "parser": "babel-eslint",

    "env": {

      "browser": true,

-     "node": true,

      "jquery": true

    },

-   "plugins": [

-     "react"

-   ],

-   "rules": {

-     "react/prop-types": "off"

+   "globals": {

+     "__webpack_public_path__": true

    },

-   "parserOptions": {

-     "ecmaFeatures": {

-       "jsx": true

-     }

-   },

-   "extends": ["plugin:react/recommended"]

+   "extends": "react-app"

  }

@@ -1,6 +1,5 @@ 

  import React from 'react';

  import PropTypes from 'prop-types';

- import { connect } from 'react-redux';

  import VisibilitySelect from '../VisibilitySelect';

  

  

@@ -3,7 +3,6 @@ 

    defineMessages,

    FormattedMessage,

    } from 'react-intl';

- import PropTypes from 'prop-types';

  import AddWidgetDialog from './AddWidgetDialog';

  

  

@@ -1,10 +1,5 @@ 

  import React from 'react';

- import PropTypes from 'prop-types';

  import { connect } from 'react-redux';

- import {

-   defineMessages,

-   FormattedMessage,

-   } from 'react-intl';

  import PageStructure from './PageStructure';

  import { monogramColour } from '../core/utils';

  
@@ -43,6 +38,7 @@ 

                                  className="avatar"

                                  src={hub.config.avatar}

                                  width='60px'

+                                 alt=""

                                  />

                          }

                              <div className="text-dark align-self-center ml-3">

@@ -28,7 +28,10 @@ 

  

      return (

        <div className="CobWeb media mb-3">

-         <img className="d-flex align-self-center mr-3 square-32" src={icon} />

+         <img

+           className="d-flex align-self-center mr-3 square-32"

+           src={icon} alt=""

+           />

          <div className="media-body">

            {msg}

          </div>

@@ -74,7 +74,7 @@ 

  

    loadFromServer(value) {

      this.setState({isLoading: true});

-     this.serverRequest = $.ajax({

+     this.serverRequest = jQuery.ajax({

        url: this.props.url,

        method: 'GET',

        data: {q: value},

@@ -89,7 +89,7 @@ 

          <div className="row no-gutters">

          { owners.slice(0, ellipsis_limit).map((owner) => (

              <div className="col-sm-6 mb-2" key={owner.username}>

-               <img className="img-circle mr-2" src={owner.avatar} />

+               <img className="img-circle mr-2" src={owner.avatar} alt="" />

                <a href={owner.hub_url}>{owner.username}</a>

              </div>

            ))
@@ -118,7 +118,7 @@ 

              >

              { owners.map((owner) => (

                  <div className="col-sm-6 mb-2" key={owner.username}>

-                   <img className="img-circle img-circle-lg mr-2" src={owner.avatar} />

+                   <img className="img-circle img-circle-lg mr-2" src={owner.avatar} alt="" />

                    <a href={owner.hub_url}>{owner.username}</a>

                  </div>

                ))

@@ -13,6 +13,8 @@ 

  }

  .HubConfigDialog .nav-tabs .nav-link {

    border: 0;

+   width: 100%;

+   text-align: right;

  }

  

  .HubConfigDialog .modal-body {

@@ -3,7 +3,6 @@ 

    defineMessages,

    FormattedMessage,

    } from 'react-intl';

- import PropTypes from 'prop-types';

  import GeneralPanel from './HubConfigPanelGeneral';

  import VCSPanel from './HubConfigPanelVCS';

  import UserPanel from './HubConfigPanelUser';
@@ -12,7 +11,6 @@ 

  import ChatPanel from './HubConfigPanelChat';

  import MeetingsPanel from './HubConfigPanelMeetings';

  import DevPlatformPanel from './HubConfigPanelDevPlatform';

- import NotImplementedPanel from './HubConfigPanelNotImpl';

  import Modal from '../../components/Modal';

  import TabSet from '../../components/TabSet';

  import Spinner from "../Spinner";
@@ -125,7 +123,7 @@ 

            key="owners"

            users={this.props.users}

            globalConfig={this.props.globalConfig}

-           role="owner"

+           hubRole="owner"

            handleChange={this.props.usingFas ? null : this.props.onUserChange}

            tabTitle={<FormattedMessage {...messages.owners} />}

            urls={this.props.urls}
@@ -137,7 +135,7 @@ 

            key="members"

            users={this.props.users}

            globalConfig={this.props.globalConfig}

-           role="member"

+           hubRole="member"

            handleChange={this.props.usingFas ? null : this.props.onUserChange}

            tabTitle={<FormattedMessage {...messages.members} />}

            urls={this.props.urls}

@@ -2,7 +2,7 @@ 

  import {

    defineMessages,

    FormattedMessage,

-   FormattedHTMLMessage,

+   //FormattedHTMLMessage,

    } from 'react-intl';

  

  
@@ -79,7 +79,7 @@ 

  

    render() {

      const stillLoading = (typeof this.props.hubConfig.summary === "undefined");

-     const visibilities = this.props.globalConfig.hub_visibility || [];

+     //const visibilities = this.props.globalConfig.hub_visibility || [];

      const right_width = this.props.hubConfig ? 12 - this.props.hubConfig.left_width : 4;

  

      let invalid = {};

@@ -1,6 +1,5 @@ 

  import React from 'react';

  import {

-   injectIntl,

    defineMessages,

    FormattedMessage,

    FormattedHTMLMessage,
@@ -76,7 +75,7 @@ 

  

    handleAdd(e) {

      e.preventDefault();

-     this.props.handleChange(this.state.addUser, null, this.props.role);

+     this.props.handleChange(this.state.addUser, null, this.props.hubRole);

      this.setState({addUser: null, addUserInputContents: ""});

    }

  
@@ -91,16 +90,16 @@ 

    filterSuggestedUsers(user) {

      // Only suggest non-members.

      return (

-       this.props.users[this.props.role].indexOf(user) === -1

+       this.props.users[this.props.hubRole].indexOf(user) === -1

        &&

-       this.props.users[`pending-${this.props.role}`].indexOf(user) === -1

+       this.props.users[`pending-${this.props.hubRole}`].indexOf(user) === -1

      );

    }

  

    render() {

-     const users = this.props.users[this.props.role].map(user => {

+     const users = this.props.users[this.props.hubRole].map(user => {

        const locked = (

-         this.props.role === "owner" &&

+         this.props.hubRole === "owner" &&

          this.props.currentUser.logged_in &&

          user.username === this.props.currentUser.nickname

        );
@@ -108,18 +107,18 @@ 

          <UserRow

            key={user.username}

            user={user}

-           role={this.props.role}

+           hubRole={this.props.hubRole}

            globalConfig={this.props.globalConfig}

            onChange={this.props.handleChange}

            locked={locked}

            />

        );

      });

-     const pendingUsers = this.props.users[`pending-${this.props.role}`].map(user => (

+     const pendingUsers = this.props.users[`pending-${this.props.hubRole}`].map(user => (

        <UserRow

          key={user.username}

          user={user}

-         role={`pending-${this.props.role}`}

+         hubRole={`pending-${this.props.hubRole}`}

          globalConfig={this.props.globalConfig}

          onChange={this.props.handleChange}

          />
@@ -188,7 +187,7 @@ 

                      }}

                      url={(

                        this.props.urls.hubConfigSuggestUsers

-                       + "?exclude-role=" + this.props.role

+                       + "?exclude-role=" + this.props.hubRole

                      )}

                      getSuggestionValue={getSuggestionValue}

                      renderSuggestion={renderSuggestion}
@@ -240,7 +239,7 @@ 

  

    handleChange(e) {

      e.preventDefault();

-     this.props.onChange(this.props.user, this.props.role, e.target.value);

+     this.props.onChange(this.props.user, this.props.hubRole, e.target.value);

    }

  

    render() {
@@ -255,7 +254,7 @@ 

              :

                <select

                  name={this.props.user.username}

-                 value={this.props.role}

+                 value={this.props.hubRole}

                  className="form-control"

                  onChange={this.handleChange}

                  >

@@ -1,10 +1,9 @@ 

  import React from 'react';

- import PropTypes from 'prop-types';

  import { connect } from 'react-redux';

- import {

-   defineMessages,

-   FormattedMessage,

-   } from 'react-intl';

+ //import {

+ //  defineMessages,

+ //  FormattedMessage,

+ //  } from 'react-intl';

  import {

    saveHub,

    openConfigDialog,
@@ -14,12 +13,12 @@ 

  import "./HubConfig.css";

  

  

- const messages = defineMessages({

-   button: {

-     id: "hubs.core.config.button",

-     defaultMessage: "Hub settings",

-   },

- });

+ //const messages = defineMessages({

+ //  button: {

+ //    id: "hubs.core.config.button",

+ //    defaultMessage: "Hub settings",

+ //  },

+ //});

  

  

  class HubConfig extends React.Component {

@@ -1,5 +1,4 @@ 

  import React from 'react';

- import PropTypes from 'prop-types';

  import { monogramColour } from '../../core/utils';

  

  
@@ -10,6 +9,7 @@ 

          <img

            className="avatar"

            src={this.props.avatar}

+           alt=""

            />

        );

      } else {

@@ -1,13 +1,5 @@ 

  import React from 'react';

  import PropTypes from 'prop-types';

- import { connect } from 'react-redux';

- import {

-   subscribe,

-   unsubscribe,

-   join,

-   leave,

-   giveUpAdmin,

- } from "../../core/actions/hub";

  import "./HubStats.css";

  

  

@@ -1,5 +1,4 @@ 

  import React from 'react';

- import PropTypes from 'prop-types';

  

  

  export default class StreamHeaderLeft extends React.Component {

@@ -1,5 +1,4 @@ 

  import React from 'react';

- import PropTypes from 'prop-types';

  import EditModeButton from './EditModeButton';

  

  

@@ -1,5 +1,4 @@ 

  import React from 'react';

- import PropTypes from 'prop-types';

  import { connect } from 'react-redux';

  import Spinner from "../Spinner";

  import HubHeaderLeft from "./HubHeaderLeft";
@@ -22,11 +21,11 @@ 

        hubTypeCss = `hub-${this.props.hub.type}`;

        if (this.props.hub.type === "stream") {

          left_width = 8;

-         HeaderLeft = StreamHeaderLeft,

+         HeaderLeft = StreamHeaderLeft;

          HeaderRight = StreamHeaderRight;

        } else {

          left_width = this.props.hub.config.left_width;

-         HeaderLeft = HubHeaderLeft,

+         HeaderLeft = HubHeaderLeft;

          HeaderRight = HubHeaderRight;

        }

      }

@@ -1,10 +1,5 @@ 

  import React from 'react';

- import PropTypes from 'prop-types';

  import { connect } from 'react-redux';

- import {

-   defineMessages,

-   FormattedMessage,

-   } from 'react-intl';

  import PageStructure from './PageStructure';

  import WidgetsArea from './WidgetsArea';

  import HubHeader from './HubHeader';

@@ -24,9 +24,9 @@ 

  

    changeNotifyIcon(color) {

      // Set the notify icon for 5s

-     if (color == "green") {

+     if (color === "green") {

        color = "#33ff00";

-     } else if (color == "red") {

+     } else if (color === "red") {

        color = "#eb361e";

      }

      window.Notificon(color);

@@ -1,5 +1,4 @@ 

  import React from 'react';

- import PropTypes from 'prop-types';

  import FlashMessages from './FlashMessages';

  import Heartbeat from './Heartbeat';

  import LeftMenu from './LeftMenu';

@@ -38,7 +38,7 @@ 

    }

  

    setupSource() {

-     this.source = new ReconnectingEventSource(this.props.url),

+     this.source = new ReconnectingEventSource(this.props.url);

      MESSAGE_TYPES.forEach((msgType) => {

        this.source.addEventListener(msgType, (e) => {

          this.props.dispatch(sseEvent(msgType, JSON.parse(e.data)));

@@ -4,7 +4,6 @@ 

    widgetWillUpdate

    } from "../core/actions/widget";

  import { backendCall } from "../core/utils";

- import SimpleWidgetConfig from './SimpleWidgetConfig';

  import WidgetChrome from './WidgetChrome';

  

  
@@ -62,8 +61,8 @@ 

      if (this.props.widget.hiddenIfEmpty) {

        if (

          this.state.isLoading ||

-         !this.props.editMode && (

-           !this.state.contents || !this.state.contents.trim()

+         (!this.props.editMode &&

+          (!this.state.contents || !this.state.contents.trim())

          )

        ) {

          // Hide when loading and when the contents is empty in view mode.
@@ -75,9 +74,9 @@ 

          widget={this.props.widget}

          editMode={this.props.editMode}

          >

-         { this.state.isLoading &&

+         { this.state.isLoading ?

            <div className="p-2 text-muted">Loading...</div>

-           ||

+           :

            <div className="p-2" dangerouslySetInnerHTML={{__html: this.state.contents}} />

          }

        </WidgetChrome>

@@ -18,7 +18,7 @@ 

      }

      return (

        <div className={className}>

-         <img src={img} />

+         <img src={img} alt="loading..." />

        </div>

      );

    }

@@ -1,10 +1,5 @@ 

  import React from 'react';

- import PropTypes from 'prop-types';

  import { connect } from 'react-redux';

- import {

-   defineMessages,

-   FormattedMessage,

-   } from 'react-intl';

  import PageStructure from './PageStructure';

  import HubHeader from './HubHeader';

  import WidgetsArea from './WidgetsArea';

@@ -4,16 +4,16 @@ 

  

  export default class Tab extends React.Component {

    render() {

-     var linkClass = `nav-link ${this.props.tabLinkClass}`;

+     let linkClass = `btn btn-link nav-link ${this.props.tabLinkClass}`;

      if (this.props.active) { linkClass += " active"; }

      return (

        <li className="nav-item">

-         <a href="#" role="tab"

+         <button role="tab"

             className={linkClass}

             onClick={this.props.linkClicked}

             >

            {this.props.children}

-         </a>

+         </button>

        </li>

      );

    }

@@ -51,19 +51,19 @@ 

          <div className="card-header">

            <DragHandle />

            {title}

-           <a href="#"

-             className="float-right text-danger pl-2"

+           <button

+             className="btn btn-link float-right text-danger pl-2"

              onClick={this.handleWidgetDeleted}

              >

              <i className="fa fa-trash" aria-hidden="true" title="Delete this widget"></i>

-           </a> 

+           </button>

            { this.props.widget.params.length > 0 &&

-           <a href="#"

-             className="float-right text-dark"

+           <button

+             className="btn btn-link float-right text-dark"

              onClick={this.handleEditButtonClicked}

              >

              <i className="fa fa-cog" aria-hidden="true"></i>

-           </a>

+           </button>

            }

          </div>

        );

@@ -27,7 +27,7 @@ 

      });

      return (

        <div className="Feed">

-         { (items.length == 0 && this.props.loaded) ?

+         { (items.length === 0 && this.props.loaded) ?

            <p className="m-2">

              <FormattedMessage {...messages.no_items} tagName="i" />

            </p>

@@ -50,7 +50,7 @@ 

      }

      const promise = new Promise((resolve, reject) => {

        this.setState({isLoading: true});

-       this.serverRequest = $.ajax({

+       this.serverRequest = jQuery.ajax({

          url: this.props.url,

          method: 'GET',

          dataType: 'json',
@@ -83,10 +83,14 @@ 

            "Cannot auto-update the feed, you will have to refresh " +

            "the page manually to see new elements."

          );

+         break;

        case 0:

          msg = (

            "Reconnecting to the auto-update source..."

          );

+         break;

+       default:

+         msg = null;

      }

      this.setState({errorMessage: msg});

    }

@@ -37,7 +37,7 @@ 

               Object.keys(this.props.item.msg_ids).length > 1) &&

              <div className="mt-auto">

                <small>

-                 <a href="#" onClick={this.toggleDetails}>details</a>

+                 <button className="btn btn-link" onClick={this.toggleDetails}>details</button>

                </small>

              </div>

            }

@@ -1,12 +1,9 @@ 

  /* eslint-env jasmine, jest */

  

  import React from 'react';

- import ReactDOM from 'react-dom';

  import {mount} from 'enzyme';

  

  import Feed from '../Feed';

- 

- jest.mock("../Panel");

  import Panel from '../Panel';

  

  describe('Feed', () => {
@@ -22,7 +19,7 @@ 

    });

  

    it('should create the children', () => {

-     const component = mount(

+     mount(

        <Feed items={items} />

      );

      expect(Panel.mock.calls.length).toEqual(3);

@@ -18,25 +18,18 @@ 

    };

  

    it('should render the actions block', () => {

-     let node;

      const component = shallow(

-       <Panel item={item} ref={(el) => {node = el; }} />

+       <Panel item={item} />

      );

      expect(component).toBeTruthy();

- 

-     //const block = node.querySelector('div.ml-3.text-right');

      expect(component.find("div.ml-3.text-right")).toBeTruthy();

    });

  

    it('should show the details link', () => {

-     let node;

      const component = shallow(

-       <Panel item={item} ref={(el) => {node = el; }} />

+       <Panel item={item} />

      );

      expect(component).toBeTruthy();

- 

-     //const details = node.querySelector('.text-right small a');

- 

      expect(component.find(".text-right small a")).toBeTruthy();

    });

  });

@@ -1,4 +1,3 @@ 

- import React from 'react';

  import {

    makeLoadable,

  } from '../core/utils';

@@ -141,6 +141,7 @@ 

  export function associateUser(role) {

    return (dispatch, getState) => {

      const url = getState().urls.hub + role + "s";

+     dispatch(requestHubAssoc(role));

      return apiCall(url, {method: "POST"}).then(

        result => associateResponse(dispatch, role, result),

        error => associateError(dispatch, role, error)
@@ -151,6 +152,7 @@ 

  export function dissociateUser(role) {

    return (dispatch, getState) => {

      const url = getState().urls.hub + role + "s";

+     dispatch(requestHubAssoc(role));

      return apiCall(url, {method: "DELETE"}).then(

        result => associateResponse(dispatch, role, result),

        error => associateError(dispatch, role, error)

@@ -75,6 +75,8 @@ 

            type: NEW_NOTIFICATION,

            username,

          });

+       default:

+         return;

      }

    }

  }

@@ -4,7 +4,6 @@ 

  import sseReducer from "./sse";

  import {

    hubReducer,

-   hubEditMode,

    hubConfigDialogOpen,

    hubConfigDialogLoading,

    } from "./hub";

@@ -1,7 +1,4 @@ 

  import {

-   HUB_ASSOC_SUCCESS,

-   } from '../actions/hub';

- import {

    USER_FETCH_SUCCESS,

    } from '../actions/user';

  

@@ -1,7 +1,6 @@ 

  import {

    WIDGET_PUT_REQUEST, WIDGET_PUT_SUCCESS, WIDGET_PUT_FAILURE,

    } from '../actions/widget';

- import { WIDGET_NEEDS_UPDATE } from '../actions/sse';

  

  

  export default function singleWidgetReducer(state, action) {

@@ -7,7 +7,7 @@ 

    } from '../actions/widgets';

  import {

    WIDGET_PUT_SUCCESS, WIDGET_DELETE_SUCCESS,

-   WIDGET_WILL_UPDATE, WIDGET_DID_UPDATE,

+   WIDGET_WILL_UPDATE,

    HUB_WIDGETS_ADD_REQUEST, HUB_WIDGETS_ADD_FAILURE,

    WIDGET_MOVE_REQUEST, WIDGET_MOVE_FAILURE,

    WIDGET_OPEN_CONFIG, WIDGET_CLOSE_CONFIG,
@@ -47,7 +47,7 @@ 

            widget => (widget.position === position)

          ).map(widget => widget.idx);

        case WIDGET_DELETE_SUCCESS:

-         return state.filter((idx) => (idx != action.widgetId));

+         return state.filter((idx) => (idx !== action.widgetId));

        case WIDGET_MOVE_REQUEST:

          // Optimistic update

          if (action.position !== position) {
@@ -75,7 +75,7 @@ 

        if (state.indexOf(action.widgetId) === -1) {

          return state;

        } else {

-         return state.filter((idx) => (idx != action.widgetId));

+         return state.filter((idx) => (idx !== action.widgetId));

        }

      case WIDGET_PUT_SUCCESS:

      case WIDGET_NEEDS_UPDATE:

@@ -70,6 +70,7 @@ 

    return AsyncComponent;

  }

  

+ /*

  function makeSyncLoadable(loader) {

    class SyncLoadable extends React.Component {

      constructor(props) {
@@ -92,6 +93,7 @@ 

    }

    return SyncLoadable;

  }

+ */

  

  export function monogramColour(hubname) {

    var colours = ["blue", "green", "magenta", "orange", "purple"]

@@ -1,15 +1,16 @@ 

- // Read the public path from the backend

- // https://webpack.js.org/guides/public-path/

- if(window.resourceBaseUrl) {

-   __webpack_public_path__ = window.resourceBaseUrl;

- }

- 

  import React from 'react';

  import ReactDOM from 'react-dom';

  import getStore from "./core/store";

  import App from "./core/App";

  

  

+ // Read the public path from the backend

+ // https://webpack.js.org/guides/public-path/

+ if (window.resourceBaseUrl) {

+    __webpack_public_path__ = window.resourceBaseUrl;

+ }

+ 

+ 

  export function setupPage(elementId, initialState) {

    const store = getStore(initialState);

    ReactDOM.render(

@@ -1,9 +1,4 @@ 

  import React from 'react';

- import PropTypes from 'prop-types';

- import {

-   defineMessages,

-   FormattedMessage,

-   } from 'react-intl';

  import { apiCall } from '../../core/utils';

  import TabSet from '../../components/TabSet';

  import ItemsGetter from '../../components/feed/ItemsGetter';
@@ -37,7 +32,7 @@ 

    makeServerRequestCompletePromise() {

      // Only call this.props.onServerRequestStop when both server requests

      // are done, otherwise the first to reload will cancel the other's reload.

-     const promise = Promise.all([

+     Promise.all([

        ...this.serverRequestCompletePromises

      ]).finally(

        () => {
@@ -228,7 +223,7 @@ 

  class FeedPanel extends React.Component {

  

    render() {

-     const filters_url = `https://apps.fedoraproject.org/notifications/${this.props.username}.id.fedoraproject.org/`;

+     //const filters_url = `https://apps.fedoraproject.org/notifications/${this.props.username}.id.fedoraproject.org/`;

  

      return (

        <div>

@@ -90,7 +90,7 @@ 

      const formData = this.state.formData;

      formData.page = requestedPage || 1;

      this.setState({isLoading: true});

-     this.serverRequest = $.ajax({

+     this.serverRequest = jQuery.ajax({

        url: this.props.urls.search,

        method: 'GET',

        data: formData,

@@ -72,7 +72,7 @@ 

                    <div className="media-left media-middle">

                      <a href={this.props.data.author.url} target="_blank">

                        <img className="square-32 img-circle"

-                            src={this.props.data.author.avatar} />

+                            src={this.props.data.author.avatar} alt="" />

                      </a>

                    </div>

                    <div className="media-body">

@@ -11,7 +11,7 @@ 

    }

  

    onClick(e) {

-     e.preventDefault;

+     e.preventDefault();

      this.props.onZoomRequest(this.props.request);

    }

  

@@ -1,5 +1,4 @@ 

  import React from 'react';

- import PropTypes from 'prop-types';

  import {

    defineMessages,

    FormattedMessage,

@@ -70,10 +70,10 @@ 

    loadFromServer() {

      let hubs = this.props.widget.config.hubs || [];

      hubs = hubs.filter((hub) => (this.state.inactiveHubs.indexOf(hub) === -1));

-     const params = hubs.length > 0 ? $.param({hubs}, true) : "hubs=";

+     const params = hubs.length > 0 ? jQuery.param({hubs}, true) : "hubs=";

      this.props.dispatch(widgetWillUpdate(this.props.widget.idx));

      this.setState({isLoading: true});

-     this.serverRequest = $.ajax({

+     this.serverRequest = jQuery.ajax({

        url: this.props.widget.urls.data,

        method: 'GET',

        data: params,

@@ -2,7 +2,6 @@ 

  

  

  import React from 'react';

- import ReactDOM from 'react-dom';

  import { IntlProvider } from 'react-intl';

  import { mount } from 'enzyme';

  

@@ -50,7 +50,7 @@ 

              className="d-flex mr-3"

              >

              <img className="square-32 img-circle"

-                  src={request.author.avatar} />

+                  src={request.author.avatar} alt="" />

            </a>

            <div className="media-body align-self-center">

              <a href={request.author.url}>

@@ -1,5 +1,4 @@ 

  import React from 'react';

- import PropTypes from 'prop-types';

  

  

  export default class ChatClient extends React.Component {
@@ -11,6 +10,7 @@ 

          src={url}

          className="webchat"

          style={{height: `${this.props.height}px`}}

+         title="chat"

          ></iframe>

      );

    }

@@ -34,7 +34,12 @@ 

                <div className="dropdown-item">

                  <a target="blank"

                     href={this.props.counts.bugzilla.link}>

-                   <img src="https://bugzilla.redhat.com/favicon.ico" style={{height: '16px'}} className={"mr-2"}/>

+                   <img

+                     src="https://bugzilla.redhat.com/favicon.ico"

+                     style={{height: '16px'}}

+                     className="mr-2"

+                     alt=""

+                     />

                    Bugzilla ({this.props.counts.bugzilla.count})

                  </a>

                </div>
@@ -43,7 +48,12 @@ 

                <div className="dropdown-item">

                  <a target="blank"

                     href={this.props.counts.github.link}>

-                   <img src="https://github.com/favicon.ico" style={{height: '16px'}} className={"mr-2"}/>

+                   <img

+                     src="https://github.com/favicon.ico"

+                     style={{height: '16px'}}

+                     className="mr-2"

+                     alt=""

+                     />

                    Github ({this.props.counts.github.count})

                  </a>

                </div>
@@ -52,7 +62,12 @@ 

                <div className="dropdown-item">

                  <a target="blank"

                     href={this.props.counts.pagure.link}>

-                   <img src="https://pagure.io/static/favicon.ico" style={{height: '16px'}} className={"mr-2"}/>

+                   <img

+                     src="https://pagure.io/static/favicon.ico"

+                     style={{height: '16px'}}

+                     className="mr-2"

+                     alt=""

+                     />

                    Pagure ({this.props.counts.pagure.count})

                  </a>

                </div>

@@ -17,7 +17,12 @@ 

            <div className="col-md-6">

              <div className="float-right">

                <span>{this.props.issue.project}</span>

-               <img src={this.props.issue.icon} style={{height: '16px'}} className={"ml-2"}/>

+               <img

+                 src={this.props.issue.icon}

+                 style={{height: '16px'}}

+                 className="ml-2"

+                 alt=""

+                 />

              </div>

            </div>

          </div>

@@ -1,5 +1,4 @@ 

  import React from 'react';

- import PropTypes from 'prop-types';

  import { apiCall } from '../../core/utils';

  import Modal from '../../components/Modal';

  import SelectLinkForm from "./SelectLinkForm";

@@ -1,5 +1,4 @@ 

  import React from 'react';

- import PropTypes from 'prop-types';

  import Modal from '../../components/Modal';

  import EditLinkForm from "./EditLinkForm";

  

@@ -1,5 +1,4 @@ 

  import React from 'react';

- import PropTypes from 'prop-types';

  import Spinner from "../../components/Spinner";

  import MissingThumb from "./library-missing-thumb-large.png";

  

@@ -12,6 +12,7 @@ 

            <img

              className="link-preview mt-2"

              src={this.props.image || MissingThumb}

+             alt=""

              />

          </div>

          <div className={`media-body ${this.props.showDropdown ? "pr-3" : ""}`}>
@@ -19,33 +20,29 @@ 

              <div

                className="dropdown"

                >

-               <a

-                 className="text-secondary dropdown-toggle"

-                 href="#"

-                 role="button"

+               <button

+                 className="btn btn-link text-secondary dropdown-toggle"

                  data-toggle="dropdown"

                  aria-haspopup="true"

                  aria-expanded="false"

                  >

-               </a>

+               </button>

                <div

                  className="dropdown-menu dropdown-menu-right"

                  aria-labelledby="dropdownMenuLink"

                  >

-                 <a

-                   className="dropdown-item"

-                   href="#"

+                 <button

+                   className="btn btn-link dropdown-item"

                    onClick={this.props.onEdit}

                    >

                    Edit item

-                 </a>

-                 <a

-                   className="dropdown-item"

-                   href="#"

+                 </button>

+                 <button

+                   className="btn btn-link dropdown-item"

                    onClick={this.props.onDelete}

                    >

                    Delete

-                 </a>

+                 </button>

                </div>

              </div>

            }

@@ -1,5 +1,4 @@ 

  import React from 'react';

- import PropTypes from 'prop-types';

  import Spinner from "../../components/Spinner";

  

  

@@ -41,6 +41,7 @@ 

      "enzyme": "^3.0.0",

      "enzyme-adapter-react-15": "^1.0.0",

      "eslint": "^4.4.1",

+     "eslint-config-react-app": "^2.1.0",

      "eslint-loader": "^1.9.0",

      "eslint-plugin-react": "^7.2.1",

      "extract-text-webpack-plugin": "^3.0.0",

@@ -195,6 +195,7 @@ 

  <script src="https://unpkg.com/react-dom@15/dist/react-dom{% if not config.DEBUG %}.min{% endif %}.js"></script>

  <script>

  {# Inform the JS UI of the public build path. It *must* end with a slash. #}

+ {# https://webpack.js.org/guides/public-path/ #}

  window.resourceBaseUrl = {{ url_for('static', filename='js/build/') | tojson }};

  </script>

  <script src="{{ url_for('static', filename='js/build/common.js') }}"></script>

Our Javascript linter was not configured properly before, so I've set it up as in create-react-app's configuration. It detected a lot of stuff, so I fixed them. There were even actual bugs in there, not just unused imports :-)

rebased onto 0fc58ce

6 years ago

Pull-Request has been merged by abompard

6 years ago
Metadata
Changes Summary 58
+3 -13
file changed
hubs/static/client/.eslintrc.json
+0 -1
file changed
hubs/static/client/app/components/AddWidget/WidgetSelectDialog.js
+0 -1
file changed
hubs/static/client/app/components/AddWidget/index.js
+1 -5
file changed
hubs/static/client/app/components/AllGroupsPage.js
+4 -1
file changed
hubs/static/client/app/components/CobWeb/index.js
+1 -1
file changed
hubs/static/client/app/components/CompletionInput.js
+2 -2
file changed
hubs/static/client/app/components/HubCommunity.js
+2 -0
file changed
hubs/static/client/app/components/HubConfig/HubConfig.css
+2 -4
file changed
hubs/static/client/app/components/HubConfig/HubConfigDialog.js
+2 -2
file changed
hubs/static/client/app/components/HubConfig/HubConfigPanelGeneral.js
+11 -12
file changed
hubs/static/client/app/components/HubConfig/HubConfigPanelUser.js
+10 -11
file changed
hubs/static/client/app/components/HubConfig/index.js
+1 -1
file changed
hubs/static/client/app/components/HubHeader/HubAvatar.js
+0 -8
file changed
hubs/static/client/app/components/HubHeader/HubStats.js
+0 -1
file changed
hubs/static/client/app/components/HubHeader/StreamHeaderLeft.js
+0 -1
file changed
hubs/static/client/app/components/HubHeader/StreamHeaderRight.js
+2 -3
file changed
hubs/static/client/app/components/HubHeader/index.js
+0 -5
file changed
hubs/static/client/app/components/HubPage.js
+2 -2
file changed
hubs/static/client/app/components/NotifIcon.js
+0 -1
file changed
hubs/static/client/app/components/PageStructure.js
+1 -1
file changed
hubs/static/client/app/components/SSESource.js
+4 -5
file changed
hubs/static/client/app/components/SimpleWidget.js
+1 -1
file changed
hubs/static/client/app/components/Spinner/index.js
+0 -5
file changed
hubs/static/client/app/components/StreamPage.js
+3 -3
file changed
hubs/static/client/app/components/Tab.js
+6 -6
file changed
hubs/static/client/app/components/WidgetChrome.js
+1 -1
file changed
hubs/static/client/app/components/feed/Feed.js
+5 -1
file changed
hubs/static/client/app/components/feed/ItemsGetter.js
+1 -1
file changed
hubs/static/client/app/components/feed/Panel.js
+1 -4
file changed
hubs/static/client/app/components/feed/__tests__/Feed.test.js
+2 -9
file changed
hubs/static/client/app/components/feed/__tests__/Panel.test.js
+0 -1
file changed
hubs/static/client/app/core/Pages.js
+2 -0
file changed
hubs/static/client/app/core/actions/hub.js
+2 -0
file changed
hubs/static/client/app/core/actions/sse.js
+0 -1
file changed
hubs/static/client/app/core/reducers/index.js
+0 -3
file changed
hubs/static/client/app/core/reducers/user.js
+0 -1
file changed
hubs/static/client/app/core/reducers/widget.js
+3 -3
file changed
hubs/static/client/app/core/reducers/widgets.js
+2 -0
file changed
hubs/static/client/app/core/utils.js
+7 -6
file changed
hubs/static/client/app/index.js
+2 -7
file changed
hubs/static/client/app/widgets/feed/StreamFeed.js
+1 -1
file changed
hubs/static/client/app/widgets/halp/ModalAllRequests.js
+1 -1
file changed
hubs/static/client/app/widgets/halp/ModalRequest.js
+1 -1
file changed
hubs/static/client/app/widgets/halp/Request.js
+0 -1
file changed
hubs/static/client/app/widgets/halp/RequestList.js
+2 -2
file changed
hubs/static/client/app/widgets/halp/Widget.js
+0 -1
file changed
hubs/static/client/app/widgets/halp/__tests__/RequestList.test.js
+1 -1
file changed
hubs/static/client/app/widgets/halp/getRequestView.js
+1 -1
file changed
hubs/static/client/app/widgets/irc/ChatClient.js
+18 -3
file changed
hubs/static/client/app/widgets/issues/Footer.js
+6 -1
file changed
hubs/static/client/app/widgets/issues/Issue.js
+0 -1
file changed
hubs/static/client/app/widgets/library/AddLinkDialog.js
+0 -1
file changed
hubs/static/client/app/widgets/library/EditLinkDialog.js
+0 -1
file changed
hubs/static/client/app/widgets/library/EditLinkForm.js
+10 -13
file changed
hubs/static/client/app/widgets/library/Link.js
+0 -1
file changed
hubs/static/client/app/widgets/library/SelectLinkForm.js
+1 -0
file changed
hubs/static/client/package.json
+1 -0
file changed
hubs/templates/master.html