Fix eslint errors. Fixed bug in .eslintrc.json

This commit is contained in:
SleepWalker 2016-06-04 12:17:06 +03:00
parent a9b0c6804b
commit d0bfa9fdb8
6 changed files with 25 additions and 26 deletions

View File

@ -25,6 +25,7 @@
"env": {
"browser": true,
"commonjs": true,
"es6": true
},
@ -59,7 +60,6 @@
"no-labels": "error",
"no-lone-blocks": "warn",
"no-loop-func": "error",
"no-magic-numbers": "warn",
"no-multi-spaces": "error",
"no-multi-str": "error",
"no-native-reassign": "error",
@ -107,11 +107,12 @@
"brace-style": ["error", "1tbs", {"allowSingleLine": true}],
"comma-spacing": "error",
"comma-style": "error",
"comma-dangle": ["warn", "only-multiline"],
"computed-property-spacing": "error",
"consistent-this": ["error", "that"],
"camelcase": "warn",
"eol-last": "warn",
"id-length": ["error", {"min": "error", "exceptions": ["x", "y", "i", "$"]}],
"id-length": ["error", {"min": 2, "exceptions": ["x", "y", "i", "$"]}],
"indent": ["error", 4, {"SwitchCase": 1}],
"jsx-quotes": "error",
"key-spacing": ["error", {"mode": "minimum"}],
@ -136,7 +137,6 @@
"quotes": ["warn", "single"],
"semi": "error",
"semi-spacing": "error",
"space-after-keywords": "error",
"keyword-spacing": "warn",
"space-before-blocks": "error",
"space-before-function-paren": ["error", "never"],

View File

@ -46,7 +46,7 @@ export function changePassword({
newRePassword = ''
}) {
return wrapInLoader((dispatch) =>
dispatch(changeUserPassword({password, newPassword, newRePassword, logoutAll : false}))
dispatch(changeUserPassword({password, newPassword, newRePassword, logoutAll: false}))
.catch(validationErrorsHandler(dispatch))
);
}
@ -237,23 +237,22 @@ function getOAuthRequest(oauth) {
}
function handleOauthParamsValidation(resp = {}) {
const error = new Error('Error completing request');
let userMessage;
if (resp.statusCode === 400 && resp.error === 'invalid_request') {
alert(`Invalid request (${resp.parameter} required).`);
throw error;
}
if (resp.statusCode === 400 && resp.error === 'unsupported_response_type') {
alert(`Invalid response type '${resp.parameter}'.`);
throw error;
}
if (resp.statusCode === 400 && resp.error === 'invalid_scope') {
alert(`Invalid scope '${resp.parameter}'.`);
throw error;
}
if (resp.statusCode === 401 && resp.error === 'invalid_client') {
alert('Can not find application you are trying to authorize.');
throw error;
userMessage = `Invalid request (${resp.parameter} required).`;
} else if (resp.statusCode === 400 && resp.error === 'unsupported_response_type') {
userMessage = `Invalid response type '${resp.parameter}'.`;
} else if (resp.statusCode === 400 && resp.error === 'invalid_scope') {
userMessage = `Invalid scope '${resp.parameter}'.`;
} else if (resp.statusCode === 401 && resp.error === 'invalid_client') {
userMessage = 'Can not find application you are trying to authorize.';
} else {
return;
}
/* eslint no-alert: "off" */
alert(userMessage);
throw new Error('Error completing request');
}
export const SET_CLIENT = 'set_client';

View File

@ -60,9 +60,9 @@ export function fetchUserData() {
dispatch(updateUser(resp));
return dispatch(changeLang(resp.lang));
})
});
/*
.catch((resp) => {
/*
{
"name": "Unauthorized",
"message": "You are requesting with an invalid credential.",
@ -70,9 +70,8 @@ export function fetchUserData() {
"status": 401,
"type": "yii\\web\\UnauthorizedHttpException"
}
*/
console.log(resp);
});
*/
}
export function changePassword({

View File

@ -87,6 +87,7 @@ function stopLoading() {
document.getElementById('loader').classList.remove('is-active');
}
/* global process: false */
if (process.env.NODE_ENV !== 'production') {
// some shortcuts for testing on localhost
window.testOAuth = () => location.href = '/oauth?client_id=ely&redirect_uri=http%3A%2F%2Fely.by&response_type=code&scope=minecraft_server_session';

View File

@ -1,5 +1,5 @@
import React from 'react';
import { Route, IndexRoute, browserHistory } from 'react-router';
import { Route, IndexRoute } from 'react-router';
import RootPage from 'pages/root/RootPage';
import IndexPage from 'pages/index/IndexPage';

View File

@ -86,9 +86,9 @@ export default class AuthFlow {
const callback = this.onReady;
this.onReady = () => {};
return resp.then(callback);
} else {
return resp;
}
return resp;
}
}