#337: fix some linting errors

This commit is contained in:
SleepWalker 2017-06-12 22:32:59 +03:00
parent 30d286a1f5
commit 622f02ebee
10 changed files with 30 additions and 13 deletions

View File

@ -63,6 +63,7 @@
"dot-notation": "error",
"eqeqeq": ["error", "smart"],
"no-alert": "error",
"no-console": "off",
"no-caller": "error",
"no-case-declarations": "error",
"no-div-regex": "error",
@ -134,7 +135,7 @@
"consistent-this": ["error", "that"],
"camelcase": "warn",
"eol-last": "warn",
"id-length": ["error", {"min": 2, "exceptions": ["x", "y", "i", "$"]}],
"id-length": ["error", {"min": 2, "exceptions": ["x", "y", "i", "k", "l", "m", "n", "$", "_"]}],
"indent": ["error", 4, {"SwitchCase": 1}],
"jsx-quotes": "error",
"key-spacing": ["error", {"mode": "minimum"}],
@ -168,7 +169,7 @@
"spaced-comment": "warn",
// es6
"arrow-body-style": "warn",
"arrow-body-style": "off",
"arrow-parens": "error",
"arrow-spacing": "error",
"constructor-super": "error",

View File

@ -123,12 +123,12 @@ export class AccountSwitcher extends Component {
className={styles.addAccount}
label={
<Message {...messages.addAccount}>
{(message) =>
{(message) => (
<span>
<div className={styles.addIcon} />
{message}
</span>
}
)}
</Message>
}
/>

View File

@ -1,9 +1,10 @@
// @flow
import React from 'react';
import Helmet from 'react-helmet';
import { FormattedMessage as Message } from 'react-intl';
export default function AuthTitle({title}) {
export default function AuthTitle({title}: {title: {id: string}}) {
return (
<Message {...title}>
{(msg) => <span>{msg}<Helmet title={msg} /></span>}

View File

@ -36,6 +36,7 @@ const contexts = [
['chooseAccount', 'permissions']
];
// eslint-disable-next-line
if (process.env.NODE_ENV !== 'production') {
// test panel uniquenes between contexts
// TODO: it may be moved to tests in future

View File

@ -104,7 +104,9 @@ class Finish extends Component {
// TODO: было бы ещё неплохо сделать какую-то анимацию, вроде "Скопировано",
// ибо сейчас после клика как-то неубедительно, скопировалось оно или нет
console.log('Copying text command was ' + (successful ? 'successful' : 'unsuccessful'));
} catch (err) {}
} catch (err) {
// not critical
}
};
setCode = (el) => {

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { FormattedMessage as Message, FormattedRelative as Relative, FormattedHTMLMessage as HTMLMessage } from 'react-intl';
import { FormattedMessage as Message, FormattedRelative as Relative } from 'react-intl';
import { Link } from 'react-router-dom';
import Helmet from 'react-helmet';

View File

@ -2,8 +2,9 @@ import React, { Component, PropTypes } from 'react';
import classNames from 'classnames';
import FormModel from './FormModel';
import logger from 'services/logger';
import FormModel from './FormModel';
import styles from './form.scss';
export default class Form extends Component {
@ -106,7 +107,8 @@ export default class Form extends Component {
Array.from(invalidEls).reduce((errors, el) => {
if (!el.name) {
console.warn('Found an element without name', el);
logger.warn('Found an element without name', {el});
return errors;
}

View File

@ -1,3 +1,4 @@
import sinon from 'sinon';
import expect from 'unexpected';
import React from 'react';

View File

@ -1,9 +1,16 @@
import authFlow from 'services/authFlow';
// @flow
import React from 'react';
import { Route, Redirect } from 'react-router-dom';
import { connect } from 'react-redux';
const PrivateRoute = ({user, component: Component, ...rest}) => (
<Route {...rest} render={(props) => (
import type {User} from 'components/user';
const PrivateRoute = ({user, component: Component, ...rest}: {
component: any,
user: User
}) => (
<Route {...rest} render={(props: {location: string}) => (
user.isGuest ? (
<Redirect to={{
pathname: '/login',

View File

@ -108,7 +108,9 @@ export default connect(null, {
function requestPassword(form) {
return new Promise((resolve) => {
dispatch(createPopup({
Popup(props) {
Popup(props: {
onClose: Function
}) {
const onSubmit = () => {
form.beginLoading();
sendData()