eslint --fix on src/

Signed-off-by: Aaron Raimist <aaron@raim.ist>
This commit is contained in:
Aaron Raimist 2018-10-12 18:50:17 -05:00
parent ca1dec8e13
commit 6abd1de8b8
No known key found for this signature in database
GPG Key ID: 37419210002890EF
9 changed files with 31 additions and 42 deletions

View File

@ -11,22 +11,11 @@ sudo: required
language: node_js language: node_js
node_js: node_js:
# make sure we work with a range of node versions. # make sure we work with a range of node versions.
# As of the time of writing:
# - 4.x is still in LTS (until April 2018), but some of our deps (notably
# extract-zip) don't work with it
# - 5.x has been EOLed for nearly a year.
# - 6.x is the active 'LTS' version
# - 7.x is no longer supported
# - 8.x is the current 'current' version (until October 2017)
# #
# see: https://github.com/nodejs/LTS/ # Current status of node versions: https://github.com/nodejs/LTS/
#
# anything before 6.3 ships with npm 3.9 or earlier, which had problems
# with symlinks in node_modules (see
# https://github.com/npm/npm/releases/tag/v3.10.0 'FIXES AND REFACTORING').
- 6.3
- 6 - 6
- 7 - 8
- 10
addons: addons:
chrome: stable chrome: stable
install: install:

View File

@ -15,8 +15,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
var React = require("react"); const React = require("react");
var sanitizeHtml = require("sanitize-html"); const sanitizeHtml = require("sanitize-html");
import { _t } from 'matrix-react-sdk/lib/languageHandler'; import { _t } from 'matrix-react-sdk/lib/languageHandler';
module.exports = React.createClass({ module.exports = React.createClass({
@ -47,5 +47,5 @@ module.exports = React.createClass({
</div> </div>
</div> </div>
); );
} },
}); });

View File

@ -16,7 +16,7 @@ limitations under the License.
'use strict'; 'use strict';
var React = require('react'); const React = require('react');
import { _t } from 'matrix-react-sdk/lib/languageHandler'; import { _t } from 'matrix-react-sdk/lib/languageHandler';
import SettingsStore from 'matrix-react-sdk/lib/settings/SettingsStore'; import SettingsStore from 'matrix-react-sdk/lib/settings/SettingsStore';
@ -29,8 +29,8 @@ module.exports = React.createClass({
render: function() { render: function() {
// FIXME: replace this with a proper Status skin // FIXME: replace this with a proper Status skin
// ...except then we wouldn't be able to switch to the Status theme at runtime. // ...except then we wouldn't be able to switch to the Status theme at runtime.
if (SettingsStore.getValue("theme") === 'status') return <div/>; if (SettingsStore.getValue("theme") === 'status') return <div />;
return ( return (
<div className="mx_Login_links"> <div className="mx_Login_links">
<a href="https://medium.com/@RiotChat">blog</a>&nbsp;&nbsp;&middot;&nbsp;&nbsp; <a href="https://medium.com/@RiotChat">blog</a>&nbsp;&nbsp;&middot;&nbsp;&nbsp;
@ -39,5 +39,5 @@ module.exports = React.createClass({
<a href="https://matrix.org">{ _t('powered by Matrix') }</a> <a href="https://matrix.org">{ _t('powered by Matrix') }</a>
</div> </div>
); );
} },
}); });

View File

@ -35,9 +35,9 @@ module.exports = React.createClass({
return ( return (
<div className="mx_Login_header"> <div className="mx_Login_header">
<div className="mx_Login_logo"> <div className="mx_Login_logo">
<img src={this.props.icon || DEFAULT_LOGO_URI} alt="Riot"/> <img src={this.props.icon || DEFAULT_LOGO_URI} alt="Riot" />
</div> </div>
</div> </div>
); );
} },
}); });

View File

@ -87,12 +87,12 @@ function checkBrowserFeatures(featureList) {
console.error("Cannot check features - Modernizr global is missing."); console.error("Cannot check features - Modernizr global is missing.");
return false; return false;
} }
var featureComplete = true; let featureComplete = true;
for (var i = 0; i < featureList.length; i++) { for (let i = 0; i < featureList.length; i++) {
if (window.Modernizr[featureList[i]] === undefined) { if (window.Modernizr[featureList[i]] === undefined) {
console.error( console.error(
"Looked for feature '%s' but Modernizr has no results for this. " + "Looked for feature '%s' but Modernizr has no results for this. " +
"Has it been configured correctly?", featureList[i] "Has it been configured correctly?", featureList[i],
); );
return false; return false;
} }
@ -113,7 +113,7 @@ function getScreenFromLocation(location) {
return { return {
screen: fragparts.location.substring(1), screen: fragparts.location.substring(1),
params: fragparts.params, params: fragparts.params,
} };
} }
// Here, we do some crude URL analysis to allow // Here, we do some crude URL analysis to allow
@ -138,10 +138,10 @@ function onHashChange(ev) {
// so a web page can update the URL bar appropriately. // so a web page can update the URL bar appropriately.
function onNewScreen(screen) { function onNewScreen(screen) {
console.log("newscreen "+screen); console.log("newscreen "+screen);
var hash = '#/' + screen; const hash = '#/' + screen;
lastLocationHashSet = hash; lastLocationHashSet = hash;
window.location.hash = hash; window.location.hash = hash;
}; }
// We use this to work out what URL the SDK should // We use this to work out what URL the SDK should
// pass through when registering to allow the user to // pass through when registering to allow the user to
@ -214,9 +214,9 @@ function onTokenLoginCompleted() {
// if we did a token login, we're now left with the token, hs and is // if we did a token login, we're now left with the token, hs and is
// url as query params in the url; a little nasty but let's redirect to // url as query params in the url; a little nasty but let's redirect to
// clear them. // clear them.
var parsedUrl = url.parse(window.location.href); const parsedUrl = url.parse(window.location.href);
parsedUrl.search = ""; parsedUrl.search = "";
var formatted = url.format(parsedUrl); const formatted = url.format(parsedUrl);
console.log("Redirecting to " + formatted + " to drop loginToken " + console.log("Redirecting to " + formatted + " to drop loginToken " +
"from queryparams"); "from queryparams");
window.location.href = formatted; window.location.href = formatted;
@ -293,7 +293,7 @@ async function loadApp() {
// in case it is the first time loading Riot. // in case it is the first time loading Riot.
// `InstallTrigger` is a Object which only exists on Firefox // `InstallTrigger` is a Object which only exists on Firefox
// (it is used for their Plugins) and can be used as a // (it is used for their Plugins) and can be used as a
// feature check. // feature check.
// Firefox loads css always before js. This is why we dont use // Firefox loads css always before js. This is why we dont use
// onload or it's EventListener as thoose will never trigger. // onload or it's EventListener as thoose will never trigger.
if (typeof InstallTrigger !== 'undefined') { if (typeof InstallTrigger !== 'undefined') {
@ -345,19 +345,19 @@ async function loadApp() {
initialScreenAfterLogin={getScreenFromLocation(window.location)} initialScreenAfterLogin={getScreenFromLocation(window.location)}
defaultDeviceDisplayName={platform.getDefaultDeviceDisplayName()} defaultDeviceDisplayName={platform.getDefaultDeviceDisplayName()}
/>, />,
document.getElementById('matrixchat') document.getElementById('matrixchat'),
); );
} else { } else {
console.error("Browser is missing required features."); console.error("Browser is missing required features.");
// take to a different landing page to AWOOOOOGA at the user // take to a different landing page to AWOOOOOGA at the user
var CompatibilityPage = sdk.getComponent("structures.CompatibilityPage"); const CompatibilityPage = sdk.getComponent("structures.CompatibilityPage");
window.matrixChat = ReactDOM.render( window.matrixChat = ReactDOM.render(
<CompatibilityPage onAccept={function() { <CompatibilityPage onAccept={function() {
if (window.localStorage) window.localStorage.setItem('mx_accepts_unsupported_browser', true); if (window.localStorage) window.localStorage.setItem('mx_accepts_unsupported_browser', true);
console.log("User accepts the compatibility risks."); console.log("User accepts the compatibility risks.");
loadApp(); loadApp();
}} />, }} />,
document.getElementById('matrixchat') document.getElementById('matrixchat'),
); );
} }
} }

View File

@ -27,7 +27,7 @@ import rageshake from 'matrix-react-sdk/lib/rageshake/rageshake';
remote.autoUpdater.on('update-downloaded', onUpdateDownloaded); remote.autoUpdater.on('update-downloaded', onUpdateDownloaded);
// try to flush the rageshake logs to indexeddb before quit. // try to flush the rageshake logs to indexeddb before quit.
ipcRenderer.on('before-quit', function () { ipcRenderer.on('before-quit', function() {
console.log('riot-desktop closing'); console.log('riot-desktop closing');
rageshake.flush(); rageshake.flush();
}); });

View File

@ -114,7 +114,7 @@ export default class VectorBasePlatform extends BasePlatform {
dis.dispatch({ dis.dispatch({
action: 'check_updates', action: 'check_updates',
value: false, value: false,
}) });
} }
getUpdateCheckStatusEnum() { getUpdateCheckStatusEnum() {

View File

@ -26,7 +26,7 @@ import Promise from 'bluebird';
import url from 'url'; import url from 'url';
import UAParser from 'ua-parser-js'; import UAParser from 'ua-parser-js';
var POKE_RATE_MS = 10 * 60 * 1000; // 10 min const POKE_RATE_MS = 10 * 60 * 1000; // 10 min
export default class WebPlatform extends VectorBasePlatform { export default class WebPlatform extends VectorBasePlatform {
constructor() { constructor() {

View File

@ -23,16 +23,16 @@ import qs from 'querystring';
export function parseQsFromFragment(location) { export function parseQsFromFragment(location) {
// if we have a fragment, it will start with '#', which we need to drop. // if we have a fragment, it will start with '#', which we need to drop.
// (if we don't, this will return ''). // (if we don't, this will return '').
var fragment = location.hash.substring(1); const fragment = location.hash.substring(1);
// our fragment may contain a query-param-like section. we need to fish // our fragment may contain a query-param-like section. we need to fish
// this out *before* URI-decoding because the params may contain ? and & // this out *before* URI-decoding because the params may contain ? and &
// characters which are only URI-encoded once. // characters which are only URI-encoded once.
var hashparts = fragment.split('?'); const hashparts = fragment.split('?');
var result = { const result = {
location: decodeURIComponent(hashparts[0]), location: decodeURIComponent(hashparts[0]),
params: {} params: {},
}; };
if (hashparts.length > 1) { if (hashparts.length > 1) {