From 0fc58ce6f60102a695a3ce47194c28434c3ef9a7 Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Feb 05 2018 17:49:12 +0000 Subject: Lint the Javascript --- diff --git a/hubs/static/client/.eslintrc.json b/hubs/static/client/.eslintrc.json index 2fe5df5..4c81f2d 100644 --- a/hubs/static/client/.eslintrc.json +++ b/hubs/static/client/.eslintrc.json @@ -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" } diff --git a/hubs/static/client/app/components/AddWidget/WidgetSelectDialog.js b/hubs/static/client/app/components/AddWidget/WidgetSelectDialog.js index dae41ec..2b48a6f 100644 --- a/hubs/static/client/app/components/AddWidget/WidgetSelectDialog.js +++ b/hubs/static/client/app/components/AddWidget/WidgetSelectDialog.js @@ -1,6 +1,5 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { connect } from 'react-redux'; import VisibilitySelect from '../VisibilitySelect'; diff --git a/hubs/static/client/app/components/AddWidget/index.js b/hubs/static/client/app/components/AddWidget/index.js index 18c3455..b83c07f 100644 --- a/hubs/static/client/app/components/AddWidget/index.js +++ b/hubs/static/client/app/components/AddWidget/index.js @@ -3,7 +3,6 @@ import { defineMessages, FormattedMessage, } from 'react-intl'; -import PropTypes from 'prop-types'; import AddWidgetDialog from './AddWidgetDialog'; diff --git a/hubs/static/client/app/components/AllGroupsPage.js b/hubs/static/client/app/components/AllGroupsPage.js index 9ccdd32..ac55060 100644 --- a/hubs/static/client/app/components/AllGroupsPage.js +++ b/hubs/static/client/app/components/AllGroupsPage.js @@ -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 @@ class AllGroupsPage extends React.Component { className="avatar" src={hub.config.avatar} width='60px' + alt="" /> }
diff --git a/hubs/static/client/app/components/CobWeb/index.js b/hubs/static/client/app/components/CobWeb/index.js index 4333f20..9544174 100644 --- a/hubs/static/client/app/components/CobWeb/index.js +++ b/hubs/static/client/app/components/CobWeb/index.js @@ -28,7 +28,10 @@ export default class CobWeb extends React.Component { return (
- +
{msg}
diff --git a/hubs/static/client/app/components/CompletionInput.js b/hubs/static/client/app/components/CompletionInput.js index e5b13c9..1817bb2 100644 --- a/hubs/static/client/app/components/CompletionInput.js +++ b/hubs/static/client/app/components/CompletionInput.js @@ -74,7 +74,7 @@ export default class CompletionInput extends React.Component { loadFromServer(value) { this.setState({isLoading: true}); - this.serverRequest = $.ajax({ + this.serverRequest = jQuery.ajax({ url: this.props.url, method: 'GET', data: {q: value}, diff --git a/hubs/static/client/app/components/HubCommunity.js b/hubs/static/client/app/components/HubCommunity.js index b9850d9..023b9d9 100644 --- a/hubs/static/client/app/components/HubCommunity.js +++ b/hubs/static/client/app/components/HubCommunity.js @@ -89,7 +89,7 @@ class HubCommunityOwners extends React.Component {
{ owners.slice(0, ellipsis_limit).map((owner) => (
- + {owner.username}
)) @@ -118,7 +118,7 @@ class HubCommunityOwners extends React.Component { > { owners.map((owner) => (
- + {owner.username}
)) diff --git a/hubs/static/client/app/components/HubConfig/HubConfig.css b/hubs/static/client/app/components/HubConfig/HubConfig.css index 17cc35f..422a873 100644 --- a/hubs/static/client/app/components/HubConfig/HubConfig.css +++ b/hubs/static/client/app/components/HubConfig/HubConfig.css @@ -13,6 +13,8 @@ } .HubConfigDialog .nav-tabs .nav-link { border: 0; + width: 100%; + text-align: right; } .HubConfigDialog .modal-body { diff --git a/hubs/static/client/app/components/HubConfig/HubConfigDialog.js b/hubs/static/client/app/components/HubConfig/HubConfigDialog.js index 88fe2d9..5e9d02c 100644 --- a/hubs/static/client/app/components/HubConfig/HubConfigDialog.js +++ b/hubs/static/client/app/components/HubConfig/HubConfigDialog.js @@ -3,7 +3,6 @@ import { 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 MailingListPanel from './HubConfigPanelMailingList'; 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 @@ export default class HubConfigDialog extends React.Component { key="owners" users={this.props.users} globalConfig={this.props.globalConfig} - role="owner" + hubRole="owner" handleChange={this.props.usingFas ? null : this.props.onUserChange} tabTitle={} urls={this.props.urls} @@ -137,7 +135,7 @@ export default class HubConfigDialog extends React.Component { key="members" users={this.props.users} globalConfig={this.props.globalConfig} - role="member" + hubRole="member" handleChange={this.props.usingFas ? null : this.props.onUserChange} tabTitle={} urls={this.props.urls} diff --git a/hubs/static/client/app/components/HubConfig/HubConfigPanelGeneral.js b/hubs/static/client/app/components/HubConfig/HubConfigPanelGeneral.js index f97af47..678ffb7 100644 --- a/hubs/static/client/app/components/HubConfig/HubConfigPanelGeneral.js +++ b/hubs/static/client/app/components/HubConfig/HubConfigPanelGeneral.js @@ -2,7 +2,7 @@ import React from 'react'; import { defineMessages, FormattedMessage, - FormattedHTMLMessage, + //FormattedHTMLMessage, } from 'react-intl'; @@ -79,7 +79,7 @@ export default class GeneralPanel extends React.Component { 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 = {}; diff --git a/hubs/static/client/app/components/HubConfig/HubConfigPanelUser.js b/hubs/static/client/app/components/HubConfig/HubConfigPanelUser.js index 6fc4107..bc78da1 100644 --- a/hubs/static/client/app/components/HubConfig/HubConfigPanelUser.js +++ b/hubs/static/client/app/components/HubConfig/HubConfigPanelUser.js @@ -1,6 +1,5 @@ import React from 'react'; import { - injectIntl, defineMessages, FormattedMessage, FormattedHTMLMessage, @@ -76,7 +75,7 @@ export default class UserPanel extends React.Component { 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 @@ export default class UserPanel extends React.Component { 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 @@ export default class UserPanel extends React.Component { ); }); - const pendingUsers = this.props.users[`pending-${this.props.role}`].map(user => ( + const pendingUsers = this.props.users[`pending-${this.props.hubRole}`].map(user => ( @@ -188,7 +187,7 @@ export default class UserPanel extends React.Component { }} url={( this.props.urls.hubConfigSuggestUsers - + "?exclude-role=" + this.props.role + + "?exclude-role=" + this.props.hubRole )} getSuggestionValue={getSuggestionValue} renderSuggestion={renderSuggestion} @@ -240,7 +239,7 @@ class UserRow extends React.Component { 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 @@ class UserRow extends React.Component { :