Improvment in tslint standard (#16)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// - Import react components
|
||||
import React, { Component } from 'react'
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { withRouter } from 'react-router-dom'
|
||||
import { connect } from 'react-redux'
|
||||
import PropTypes from 'prop-types'
|
||||
import { Card, CardActions, CardHeader, CardMedia, CardTitle, CardText } from 'material-ui/Card'
|
||||
@@ -120,8 +120,8 @@ export class Blog extends Component {
|
||||
}
|
||||
else {
|
||||
|
||||
var postBack = { oddPostList: [], evenPostList: [] }
|
||||
var parsedPosts = []
|
||||
let postBack = { oddPostList: [], evenPostList: [] }
|
||||
let parsedPosts = []
|
||||
Object.keys(posts).forEach((postId) => {
|
||||
if(tag){
|
||||
let regex = new RegExp("#" + tag,'g')
|
||||
@@ -142,7 +142,7 @@ export class Blog extends Component {
|
||||
}
|
||||
sortedPosts.forEach((post, index) => {
|
||||
|
||||
var newPost = (
|
||||
let newPost = (
|
||||
<div key={post.id}>
|
||||
|
||||
{index > 1 || (!postBack.divided && index > 0) ? <div style={{ height: "16px" }}></div> : ''}
|
||||
|
||||
@@ -120,17 +120,17 @@ static propTypes = {
|
||||
* @return {DOM} list of comments' DOM
|
||||
*/
|
||||
commentList = () => {
|
||||
var comments = this.props.comments
|
||||
let comments = this.props.comments
|
||||
if (comments) {
|
||||
|
||||
|
||||
var parsedComments = [];
|
||||
let parsedComments = []
|
||||
Object.keys(comments).slice(0, 3).forEach((commentId) => {
|
||||
parsedComments.push({
|
||||
id: commentId,
|
||||
...comments[commentId]
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
if (parsedComments.length === 2) {
|
||||
parsedComments.push(parsedComments[0])
|
||||
}
|
||||
@@ -230,7 +230,7 @@ static propTypes = {
|
||||
</Paper>
|
||||
</div>): ''}
|
||||
</div>
|
||||
);
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// - Import react components
|
||||
import React, { Component } from 'react'
|
||||
import { connect } from 'react-redux';
|
||||
import { connect } from 'react-redux'
|
||||
import PropTypes from 'prop-types'
|
||||
import { List, ListItem } from 'material-ui/List'
|
||||
|
||||
@@ -57,17 +57,17 @@ export class CommentList extends Component {
|
||||
* @return {DOM} list of comments' DOM
|
||||
*/
|
||||
commentList = () => {
|
||||
var comments = this.props.comments
|
||||
let comments = this.props.comments
|
||||
if (comments) {
|
||||
|
||||
|
||||
var parsedComments = [];
|
||||
let parsedComments = []
|
||||
Object.keys(comments).forEach((commentId) => {
|
||||
parsedComments.push({
|
||||
id: commentId,
|
||||
...comments[commentId]
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
let sortedComments = PostAPI.sortObjectsDate(parsedComments)
|
||||
|
||||
return sortedComments.map((comment, index, array) => {
|
||||
|
||||
@@ -11,21 +11,21 @@ import * as commentActions from 'commentActions'
|
||||
// - Define variable
|
||||
const buttonStyle = {
|
||||
marginTop: '5px'
|
||||
};
|
||||
}
|
||||
|
||||
// - Create CommentWrite component class
|
||||
export class CommentWrite extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
super(props)
|
||||
|
||||
this.state = {
|
||||
inputValue:''
|
||||
}
|
||||
|
||||
// Binding functions to `this`
|
||||
this.handleRef = this.handleRef.bind(this);
|
||||
this.focus = this.focus.bind(this);
|
||||
this.handleAddComment = this.handleAddComment.bind(this);
|
||||
this.handleRef = this.handleRef.bind(this)
|
||||
this.focus = this.focus.bind(this)
|
||||
this.handleAddComment = this.handleAddComment.bind(this)
|
||||
this.handleOnChange = this.handleOnChange.bind(this)
|
||||
|
||||
}
|
||||
@@ -56,7 +56,7 @@ export class CommentWrite extends Component {
|
||||
<Button basic style={buttonStyle} onClick={this.handleAddComment} color='teal'>Add Comment</Button>
|
||||
|
||||
</div>
|
||||
);
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -153,9 +153,9 @@ export class EditProfile extends Component {
|
||||
* Set banner image url
|
||||
*/
|
||||
handleRequestSetBanner = (url) => {
|
||||
console.log('==========Banner==================');
|
||||
console.log(url);
|
||||
console.log('====================================');
|
||||
console.log('==========Banner==================')
|
||||
console.log(url)
|
||||
console.log('====================================')
|
||||
this.setState({
|
||||
banner: url
|
||||
})
|
||||
@@ -226,7 +226,7 @@ export class EditProfile extends Component {
|
||||
handleResize = (evt) => {
|
||||
|
||||
// Set initial state
|
||||
var width = window.innerWidth
|
||||
let width = window.innerWidth
|
||||
|
||||
if (width > 900) {
|
||||
this.setState({
|
||||
|
||||
@@ -90,12 +90,12 @@ export class HomeHeader extends Component {
|
||||
*/
|
||||
handleNotifyTouchTap = (event) => {
|
||||
// This prevents ghost click.
|
||||
event.preventDefault();
|
||||
event.preventDefault()
|
||||
|
||||
this.setState({
|
||||
openNotifyMenu: true,
|
||||
anchorEl: event.currentTarget,
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,12 +106,12 @@ export class HomeHeader extends Component {
|
||||
*/
|
||||
handleAvatarTouchTap = (event) => {
|
||||
// This prevents ghost click.
|
||||
event.preventDefault();
|
||||
event.preventDefault()
|
||||
|
||||
this.setState({
|
||||
openAvatarMenu: true,
|
||||
anchorEl: event.currentTarget,
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,8 +133,8 @@ export class HomeHeader extends Component {
|
||||
handleRequestClose = () => {
|
||||
this.setState({
|
||||
openAvatarMenu: false,
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -144,7 +144,7 @@ export class HomeHeader extends Component {
|
||||
handleResize = (evt) => {
|
||||
|
||||
// Set initial state
|
||||
var width = window.innerWidth
|
||||
let width = window.innerWidth
|
||||
|
||||
if (width >= 600 && !this.state.showTitle) {
|
||||
this.setState({
|
||||
@@ -171,7 +171,7 @@ export class HomeHeader extends Component {
|
||||
/**
|
||||
* Styles
|
||||
*/
|
||||
var styles = {
|
||||
let styles = {
|
||||
toolbarStyle: {
|
||||
backgroundColor: "",
|
||||
transition: "all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms",
|
||||
|
||||
@@ -6,7 +6,7 @@ import { GridList, GridTile } from 'material-ui/GridList'
|
||||
import IconButton from 'material-ui/IconButton'
|
||||
import Subheader from 'material-ui/Subheader'
|
||||
import StarBorder from 'material-ui/svg-icons/toggle/star-border'
|
||||
import FloatingActionButton from 'material-ui/FloatingActionButton';
|
||||
import FloatingActionButton from 'material-ui/FloatingActionButton'
|
||||
import SvgUpload from 'material-ui/svg-icons/file/cloud-upload'
|
||||
import SvgAddImage from 'material-ui/svg-icons/image/add-a-photo'
|
||||
import SvgDelete from 'material-ui/svg-icons/action/delete'
|
||||
@@ -43,7 +43,7 @@ export class ImageGallery extends Component {
|
||||
* @param {object} props is an object properties of component
|
||||
*/
|
||||
constructor(props) {
|
||||
super(props);
|
||||
super(props)
|
||||
|
||||
// Binding function to `this`
|
||||
this.close = this.close.bind(this)
|
||||
@@ -106,7 +106,7 @@ export class ImageGallery extends Component {
|
||||
onFileChange = (evt) => {
|
||||
|
||||
const extension = FileAPI.getExtension(evt.target.files[0].name)
|
||||
var fileName = (`${uuid()}.${extension}`)
|
||||
let fileName = (`${uuid()}.${extension}`)
|
||||
let image = FileAPI.constraintImage(evt.target.files[0], fileName)
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export class Login extends Component {
|
||||
* @param {object} props is an object properties of component
|
||||
*/
|
||||
constructor(props) {
|
||||
super(props);
|
||||
super(props)
|
||||
|
||||
this.state = {
|
||||
emailInput: '',
|
||||
@@ -40,12 +40,12 @@ export class Login extends Component {
|
||||
* @param {event} evt is an event of inputs of element on change
|
||||
*/
|
||||
handleInputChange = (evt) => {
|
||||
const target = evt.target;
|
||||
const value = target.type === 'checkbox' ? target.checked : target.value;
|
||||
const name = target.name;
|
||||
const target = evt.target
|
||||
const value = target.type === 'checkbox' ? target.checked : target.value
|
||||
const name = target.name
|
||||
this.setState({
|
||||
[name]: value
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
switch (name) {
|
||||
@@ -60,7 +60,7 @@ export class Login extends Component {
|
||||
passwordInputError: ''
|
||||
})
|
||||
|
||||
break;
|
||||
break
|
||||
default:
|
||||
|
||||
}
|
||||
@@ -71,7 +71,7 @@ export class Login extends Component {
|
||||
*/
|
||||
handleForm = () => {
|
||||
|
||||
var error = false
|
||||
let error = false
|
||||
if (this.state.emailInput === '') {
|
||||
this.setState({
|
||||
emailInputError: 'This field is required'
|
||||
@@ -110,7 +110,7 @@ export class Login extends Component {
|
||||
textAlign: 'center',
|
||||
display: 'block',
|
||||
margin: "auto"
|
||||
};
|
||||
}
|
||||
return (
|
||||
<form>
|
||||
|
||||
|
||||
@@ -13,12 +13,12 @@ export interface IMasterState {
|
||||
* @type {Boolean}
|
||||
* @memberof IMasterState
|
||||
*/
|
||||
authed:Boolean;
|
||||
authed:Boolean
|
||||
/**
|
||||
* It's true if all default data loaded from database
|
||||
*
|
||||
* @type {Boolean}
|
||||
* @memberof IMasterState
|
||||
*/
|
||||
dataLoaded:Boolean;
|
||||
dataLoaded:Boolean
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import { connect } from 'react-redux'
|
||||
import { Route, Switch, NavLink, withRouter, Redirect } from 'react-router-dom'
|
||||
import { firebaseAuth, firebaseRef } from 'app/firebase'
|
||||
import { push } from 'react-router-redux'
|
||||
import Snackbar from 'material-ui/Snackbar';
|
||||
import Snackbar from 'material-ui/Snackbar'
|
||||
import LinearProgress from 'material-ui/LinearProgress'
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ import Signup from 'components/Signup'
|
||||
import Login from 'components/Login'
|
||||
import Settings from 'components/Settings'
|
||||
import MasterLoading from 'components/MasterLoading'
|
||||
import { IMasterProps } from "./IMasterProps";
|
||||
import { IMasterState } from "./IMasterState";
|
||||
import { IMasterProps } from "./IMasterProps"
|
||||
import { IMasterState } from "./IMasterState"
|
||||
|
||||
|
||||
// - Import API
|
||||
@@ -45,12 +45,12 @@ export class Master extends Component<IMasterProps,IMasterState>{
|
||||
static isPrivate = true
|
||||
// Constructor
|
||||
constructor(props : IMasterProps) {
|
||||
super(props);
|
||||
super(props)
|
||||
this.state = {
|
||||
loading: true,
|
||||
authed: false,
|
||||
dataLoaded: false
|
||||
};
|
||||
}
|
||||
|
||||
// Binding functions to `this`
|
||||
this.handleLoading = this.handleLoading.bind(this)
|
||||
@@ -207,7 +207,7 @@ const mapDispatchToProps = (dispatch : any, ownProps : any) => {
|
||||
* @param {object} state
|
||||
*/
|
||||
const mapStateToProps = (state : any) => {
|
||||
const {authorize, global, user, post, comment, imageGallery , vote, notify,circle } = state;
|
||||
const {authorize, global, user, post, comment, imageGallery , vote, notify,circle } = state
|
||||
return {
|
||||
guest: authorize.guest,
|
||||
uid: authorize.uid,
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
import Master from './Master';
|
||||
export default Master;
|
||||
import Master from './Master'
|
||||
export default Master
|
||||
|
||||
@@ -12,7 +12,7 @@ export default class MasterLoading extends Component {
|
||||
|
||||
// Constructor
|
||||
constructor(props) {
|
||||
super(props);
|
||||
super(props)
|
||||
|
||||
|
||||
// Binding functions to `this`
|
||||
@@ -49,7 +49,7 @@ export default class MasterLoading extends Component {
|
||||
|
||||
|
||||
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,15 +53,15 @@ export class People extends Component {
|
||||
case undefined:
|
||||
case '':
|
||||
this.props.setHeaderTitle('People')
|
||||
break;
|
||||
break
|
||||
case 'circles':
|
||||
this.props.setHeaderTitle('Circles')
|
||||
break;
|
||||
break
|
||||
case 'followers':
|
||||
this.props.setHeaderTitle('Followers')
|
||||
break;
|
||||
break
|
||||
default:
|
||||
break;
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
@@ -98,15 +98,15 @@ export class People extends Component {
|
||||
case undefined:
|
||||
case '':
|
||||
tabIndex = 0
|
||||
break;
|
||||
break
|
||||
case 'circles':
|
||||
tabIndex = 1
|
||||
break;
|
||||
break
|
||||
case 'followers':
|
||||
tabIndex = 2
|
||||
break;
|
||||
break
|
||||
default:
|
||||
break;
|
||||
break
|
||||
}
|
||||
return (
|
||||
<div style={styles.people}>
|
||||
|
||||
@@ -297,7 +297,7 @@ static propTypes = {
|
||||
this.setState({
|
||||
readMoreState: !this.state.readMoreState
|
||||
|
||||
});
|
||||
})
|
||||
}
|
||||
componentDidMount() {
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ import { connect } from 'react-redux'
|
||||
import PropTypes from 'prop-types'
|
||||
import { List, ListItem } from 'material-ui/List'
|
||||
import Paper from 'material-ui/Paper'
|
||||
import Dialog from 'material-ui/Dialog';
|
||||
import FlatButton from 'material-ui/FlatButton';
|
||||
import RaisedButton from 'material-ui/RaisedButton';
|
||||
import Dialog from 'material-ui/Dialog'
|
||||
import FlatButton from 'material-ui/FlatButton'
|
||||
import RaisedButton from 'material-ui/RaisedButton'
|
||||
import { grey400, grey800, darkBlack, lightBlack } from 'material-ui/styles/colors'
|
||||
import IconButton from 'material-ui/IconButton'
|
||||
import TextField from 'material-ui/TextField'
|
||||
@@ -182,7 +182,7 @@ export class PostWrite extends Component {
|
||||
post,
|
||||
update } = this.props
|
||||
|
||||
var tags = PostAPI.getContentTags(postText)
|
||||
let tags = PostAPI.getContentTags(postText)
|
||||
|
||||
// In edit status we should fire update if not we should fire post function
|
||||
if (!edit) {
|
||||
@@ -329,9 +329,9 @@ export class PostWrite extends Component {
|
||||
<MenuItem onClick={this.handleToggleSharing} style={{ fontSize: "14px" }}>{!this.state.disableSharing ? 'Disable sharing' : 'Enable sharing'}</MenuItem>
|
||||
</IconMenu>
|
||||
)
|
||||
var postAvatar = <UserAvatar fullName={this.props.name} fileName={this.props.avatar} style={{ top: "8px" }} size={40} />
|
||||
let postAvatar = <UserAvatar fullName={this.props.name} fileName={this.props.avatar} style={{ top: "8px" }} size={40} />
|
||||
|
||||
var author = (
|
||||
let author = (
|
||||
<div>
|
||||
<span style={{
|
||||
fontSize: "14px",
|
||||
|
||||
@@ -91,7 +91,7 @@ export class ProfileHead extends Component {
|
||||
handleResize = (evt) => {
|
||||
|
||||
// Set initial state
|
||||
var width = window.innerWidth
|
||||
let width = window.innerWidth
|
||||
|
||||
if (width > 900) {
|
||||
this.setState({
|
||||
|
||||
@@ -26,7 +26,7 @@ export class Settings extends Component {
|
||||
* @param {object} props is an object properties of component
|
||||
*/
|
||||
constructor(props) {
|
||||
super(props);
|
||||
super(props)
|
||||
|
||||
this.state = {
|
||||
passwordInput: '',
|
||||
@@ -46,12 +46,12 @@ export class Settings extends Component {
|
||||
* @param {event} evt is an event of inputs of element on change
|
||||
*/
|
||||
handleInputChange = (evt) => {
|
||||
const target = evt.target;
|
||||
const value = target.type === 'checkbox' ? target.checked : target.value;
|
||||
const name = target.name;
|
||||
const target = evt.target
|
||||
const value = target.type === 'checkbox' ? target.checked : target.value
|
||||
const name = target.name
|
||||
this.setState({
|
||||
[name]: value
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
switch (name) {
|
||||
@@ -66,7 +66,7 @@ export class Settings extends Component {
|
||||
passwordInputError: ''
|
||||
})
|
||||
|
||||
break;
|
||||
break
|
||||
default:
|
||||
|
||||
}
|
||||
@@ -77,7 +77,7 @@ export class Settings extends Component {
|
||||
*/
|
||||
handleForm = () => {
|
||||
|
||||
var error = false
|
||||
let error = false
|
||||
if (this.state.passwordInput === '') {
|
||||
this.setState({
|
||||
passwordInputError: 'This field is required'
|
||||
@@ -122,7 +122,7 @@ export class Settings extends Component {
|
||||
textAlign: 'center',
|
||||
display: 'block',
|
||||
margin: "auto"
|
||||
};
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ import * as authorizeActions from 'authorizeActions'
|
||||
import * as globalActions from 'globalActions'
|
||||
|
||||
// - Feilds
|
||||
const color = 'teal';
|
||||
const colorKey = 'blue';
|
||||
const color = 'teal'
|
||||
const colorKey = 'blue'
|
||||
const sizeCondition = (width) => (width >= 750)
|
||||
|
||||
|
||||
@@ -124,12 +124,12 @@ export class Sidebar extends Component {
|
||||
this.setState({
|
||||
auto: true
|
||||
})
|
||||
break;
|
||||
break
|
||||
case 'overlay':
|
||||
this.setState({
|
||||
shouldBeClosed: true
|
||||
})
|
||||
break;
|
||||
break
|
||||
default:
|
||||
|
||||
}
|
||||
@@ -159,7 +159,7 @@ export class Sidebar extends Component {
|
||||
handleResize = (evt) => {
|
||||
|
||||
// Set initial state
|
||||
var width = window.innerWidth
|
||||
let width = window.innerWidth
|
||||
|
||||
if (sizeCondition(width)) {
|
||||
|
||||
@@ -202,7 +202,7 @@ export class Sidebar extends Component {
|
||||
* Handle logout user
|
||||
*/
|
||||
handleLogout = () => {
|
||||
var { dispatch } = this.props
|
||||
let { dispatch } = this.props
|
||||
dispatch(authorizeActions.dbLogout())
|
||||
|
||||
}
|
||||
@@ -215,7 +215,7 @@ export class Sidebar extends Component {
|
||||
handleKeyUp = (evt) => {
|
||||
if (this.state.overlayOpen) {
|
||||
if (this.state.open && keycode(event) === 'esc') {
|
||||
this.open(false);
|
||||
this.open(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ export class Signup extends Component {
|
||||
* @param {object} props is an object properties of component
|
||||
*/
|
||||
constructor(props){
|
||||
super(props);
|
||||
super(props)
|
||||
|
||||
this.state = {
|
||||
fullNameInput: '',
|
||||
@@ -82,7 +82,7 @@ export class Signup extends Component {
|
||||
this.setState({
|
||||
checkInputError: ''
|
||||
})
|
||||
break;
|
||||
break
|
||||
default:
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ export class Signup extends Component {
|
||||
const {fullNameInput, emailInput, passwordInput, confirmInput} = this.state
|
||||
const {register} = this.props
|
||||
|
||||
var error = false
|
||||
let error = false
|
||||
|
||||
// Validate full name
|
||||
let fullNameCheck = fullNameInput.trim().toLowerCase()
|
||||
@@ -165,7 +165,7 @@ export class Signup extends Component {
|
||||
textAlign: 'center',
|
||||
display: 'block',
|
||||
margin: "auto"
|
||||
};
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ import PropTypes from 'prop-types'
|
||||
import {push} from 'react-router-redux'
|
||||
import Paper from 'material-ui/Paper'
|
||||
import FlatButton from 'material-ui/FlatButton'
|
||||
import RaisedButton from 'material-ui/RaisedButton';
|
||||
import Popover, { PopoverAnimationVertical } from 'material-ui/Popover';
|
||||
import Menu from 'material-ui/Menu';
|
||||
import RaisedButton from 'material-ui/RaisedButton'
|
||||
import Popover, { PopoverAnimationVertical } from 'material-ui/Popover'
|
||||
import Menu from 'material-ui/Menu'
|
||||
import MenuItem from 'material-ui/MenuItem'
|
||||
import Checkbox from 'material-ui/Checkbox'
|
||||
import TextField from 'material-ui/TextField'
|
||||
@@ -118,7 +118,7 @@ export class UserBox extends Component {
|
||||
*/
|
||||
handleTouchTap = (evt) => {
|
||||
// This prevents ghost click.
|
||||
event.preventDefault();
|
||||
event.preventDefault()
|
||||
|
||||
this.setState({
|
||||
open: true,
|
||||
|
||||
Reference in New Issue
Block a user