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

View File

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

View File

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

View File

@ -87,6 +87,7 @@ function stopLoading() {
document.getElementById('loader').classList.remove('is-active'); document.getElementById('loader').classList.remove('is-active');
} }
/* global process: false */
if (process.env.NODE_ENV !== 'production') { if (process.env.NODE_ENV !== 'production') {
// some shortcuts for testing on localhost // 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'; 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 React from 'react';
import { Route, IndexRoute, browserHistory } from 'react-router'; import { Route, IndexRoute } from 'react-router';
import RootPage from 'pages/root/RootPage'; import RootPage from 'pages/root/RootPage';
import IndexPage from 'pages/index/IndexPage'; import IndexPage from 'pages/index/IndexPage';

View File

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