Skip to content

Commit

Permalink
🚨 Auto fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Sep 11, 2023
1 parent 9f41adf commit 71730bd
Show file tree
Hide file tree
Showing 57 changed files with 186 additions and 220 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"initializations"
],
"react/forbid-prop-types": 0,
"react/jsx-no-bind": 0,
"react/jsx-sort-props": [
1,
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"forever": "NODE_ENV=production forever start ./index.js",
"stop": "forever stop ./index.js",
"deploy": "npm run build && npm run server",
"lint": "eslint src index.js src/server.jsx src/IndexHTML.jsx"
"lint": "eslint src index.js src/server.jsx src/IndexHTML.jsx --ext .jsx,.js"
},
"authors": [
"Andrew Chung",
Expand Down
2 changes: 1 addition & 1 deletion src/IndexHTML.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export default class IndexHTML extends React.Component {
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${GA_TRACKING_ID}');`
gtag('config', '${GA_TRACKING_ID}');`,
}}
/>
<script src={`/static/vendor/branch-deepview.js?v=${VERSION}`} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ export default class EditCharacterNamesPanel extends React.Component {
{t('characterModal.label.descriptionTitle')}
</div>
<TextField
fullWidth
multiLine
maxLength={1024}
placeholder={t('characterModal.label.pleaseEnterCharacterDescription')}
value={character.description}
fullWidth
multiLine
onChange={value => this.handleChange('description', value)}
/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/asset-library/views/CharacterModal/FGImagesList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ export default class FGImagesList extends React.Component {

<div className="character-modal-add-image-selection">
<input
ref={(e) => { this.imageUpload = e; }}
accept="image/png"
ref={e => { this.imageUpload = e; }}
style={{ display: 'none' }}
type="file"
multiple
Expand All @@ -205,7 +205,7 @@ export default class FGImagesList extends React.Component {
/>
}
</div>
<div className="character-modal-add-row" ref={(e) => { this.imageSelectionRows = e; }}>
<div ref={(e) => { this.imageSelectionRows = e; }} className="character-modal-add-row">
{this.renderFgImageRows()}
</div>
</div>
Expand Down
2 changes: 0 additions & 2 deletions src/common/components/ButtonGroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ export default class ButtonGroup extends React.Component {
const { displayName } = child.type;
if (displayName === 'RaisedButton' || displayName === 'FlatButton') {
buttons.push(this.createButton(child, index));
} else {
return;
}
});

Expand Down
2 changes: 1 addition & 1 deletion src/common/components/ColorPicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default class ColorsPicker extends React.Component {
{this.state.displayColorPicker ?
<div className="color-picker-popover">
<div className="color-picker-cover" onClick={this.handleClose} />
<ChromePicker color={color} onChange={this.handleChange} disableAlpha />
<ChromePicker color={color} disableAlpha onChange={this.handleChange} />
</div>
: null }
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/common/components/GridList/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default class GridList extends React.Component {
key: index,
index,
style,
ref: e => { this.elements.push(e); },
ref: (e) => { this.elements.push(e); },
});
}

Expand All @@ -76,13 +76,13 @@ export default class GridList extends React.Component {

return (
<div
ref={(e) => { this.component = e; }}
className="grid-list"
ref={e => { this.component = e; }}
{... { id }}
>
<div
className="grid-cells-container"
ref={ref => this.gridCellsContainer = ref}
className="grid-cells-container"
style={{
margin: `-${interSpace / 2}px`,
marginLeft: containerMargin,
Expand Down
2 changes: 1 addition & 1 deletion src/common/components/Modal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ export default class Modal extends React.Component {
onClick={this.handleClose}
/>
<div
className="modal-container"
ref={ref => this.modalContainer = ref}
className="modal-container"
style={{ width }}
>
{this.props.children}
Expand Down
2 changes: 1 addition & 1 deletion src/common/components/ModalTwo/Modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ export default class Modal extends React.Component {
onClick={this.handleClose}
/>
<div
className="modal-two-container"
ref={ref => this.modalContainer = ref}
className="modal-two-container"
style={{ width }}
>
{this.props.children}
Expand Down
2 changes: 1 addition & 1 deletion src/common/components/OiceThumbnail/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';

import './styles.scss';

const OiceThumbnail = (props) => (
const OiceThumbnail = props => (
<div
className="oice-thumbnail"
style={{ backgroundSize: `${props.size}px` }}
Expand Down
2 changes: 1 addition & 1 deletion src/common/components/RadioButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export default class RadioButton extends React.Component {
name={groupName}
type="radio"
checked={this.state.selectedValue === value}
onChange={() => this.handleChange(index, value)}
value={value}
onChange={() => this.handleChange(index, value)}
/>
<label htmlFor={`radio-input-${index}`}>{value}</label> {/* eslint-disable-line */}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/common/components/Tabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class Tabs extends React.Component {
if (value) this.setState({ selectedIndex: value });
}

handleOnTabItemClick = selectedIndex => {
handleOnTabItemClick = (selectedIndex) => {
this.setState({ selectedIndex });
if (this.props.onChange) this.props.onChange(selectedIndex);
}
Expand Down
5 changes: 3 additions & 2 deletions src/common/components/TextField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,12 @@ export default class TextField extends React.Component {
if (multiLine) {
return (
<textarea
cols="50"
ref={ref => this.input = ref}
cols="50"
rows="4"
{...props}
/>);
/>
);
}
return (
<input
Expand Down
4 changes: 2 additions & 2 deletions src/common/components/UsersDropdown/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default class UsersDropdown extends React.Component {
handleChange = (selectedIndexes) => {
const selectedUsers = [];
const users = this.getUsers();
selectedIndexes.forEach(index => {
selectedIndexes.forEach((index) => {
selectedUsers.push(users[index]);
});
this.setState({
Expand Down Expand Up @@ -109,7 +109,7 @@ export default class UsersDropdown extends React.Component {
selectedUsers,
} = this.state;

const values = this.getUsers().map((user) => ({
const values = this.getUsers().map(user => ({
icon: user.avatar,
text: user.displayName,
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default class LibraryCard extends React.Component {
{onSelect &&
<TriangleLabel
icon={<CheckCircleIcon />}
reference={(ref) => this.selectLabel = ref}
reference={ref => this.selectLabel = ref}
selected={this.state.selected}
onClick={this.handleSelect}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,14 @@ import {
removeLibraryFromStory,
} from 'editor/actions/library';

import {
toggleLibraryModal,
} from '../LibraryModal/redux.js';
import { toggleLibraryModal } from '../LibraryModal/redux.js';

import {
selectLibrary,
} from '../LibraryPanel/actions.js';
import { selectLibrary } from '../LibraryPanel/actions.js';

import './styles.scss';

@translate('library')
@connect((store) => ({
@connect(store => ({
...store.librariesCollection,
userId: store.user.id,
}))
Expand All @@ -54,14 +50,14 @@ export default class LibrariesCollection extends React.Component {
}

componentDidMount() {
const storyId = this.props.params.storyId;
const { storyId } = this.props.params;
console.log('componentDidMount %s', storyId);
this.props.dispatch(
storyId ? fetchLibrariesByStory(storyId) : fetchLibraries()
);
}

onClickUseAsset = obj => {
onClickUseAsset = (obj) => {
const { selectedAssets } = this.state;
if (!selectedAssets.contains(obj)) {
selectedAssets.push(obj);
Expand All @@ -86,8 +82,8 @@ export default class LibrariesCollection extends React.Component {
if (storyId) {
this.props.dispatch(
!selected ?
addLibraryToStory(storyId, libraryId) :
removeLibraryFromStory(storyId, libraryId)
addLibraryToStory(storyId, libraryId) :
removeLibraryFromStory(storyId, libraryId)
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { Component } from 'react';
import AddIcon from 'common/icons/add';

export default class LibraryAssetThumbnail extends React.Component {

// constructor(props) {
// super(props);
// this.state = {
Expand Down
27 changes: 10 additions & 17 deletions src/editor/components/AssetsManagementPanel/LibraryModal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,25 @@ import TextField from 'ui-elements/TextField';

import InteractiveTutorial from 'editor/components/InteractiveTutorial';

const defaultLibraryState = {
name: '',
description: '',
license: 0,
coverStorage: '',
isPublic: false,
};

import {
addLibrary,
deleteLibrary,
updateLibrary,
toggleLibraryModal,
} from './redux';

import {
updateUserTutorialState,
} from 'editor/components/InteractiveTutorial/actions';
import { updateUserTutorialState } from 'editor/components/InteractiveTutorial/actions';

import './styles.scss';

const defaultLibraryState = {
name: '',
description: '',
license: 0,
coverStorage: '',
isPublic: false,
};

@translate(['assetsManagement', 'general'])
@connect((store) => {
const { open, library } = store.libraryModal;
Expand All @@ -48,7 +46,6 @@ import './styles.scss';
};
})
export default class LibraryModal extends React.Component {

static propTypes = {
dispatch: PropTypes.func.isRequired,
open: PropTypes.bool.isRequired,
Expand All @@ -57,10 +54,6 @@ export default class LibraryModal extends React.Component {
tutorialState: PropTypes.array,
}

static defaultProps = {
open: false,
}

constructor(props) {
super(props);
const { library } = props;
Expand Down Expand Up @@ -146,7 +139,7 @@ export default class LibraryModal extends React.Component {

const fileReader = new FileReader();
fileReader.readAsDataURL(coverImage);
fileReader.onload = event => {
fileReader.onload = (event) => {
const imageFileSrc = event.target.result;
// for call api
library.coverImage = coverImage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,13 @@ const getAssetThumbnailURL = (asset, type) => {
let sync = true;
switch (ownProps.type) {
case ASSET_TYPE.CHARACTER:
assets = libraryPanel.charactersList.characters;
sync = libraryPanel.charactersList.sync;
({ characters: assets, sync } = libraryPanel.charactersList);
break;
case ASSET_TYPE.ITEM:
assets = libraryPanel.itemsList.items;
sync = libraryPanel.itemsList.sync;
({ items: assets, sync } = libraryPanel.itemsList);
break;
case ASSET_TYPE.BACKGROUND:
assets = libraryPanel.backgroundsList.backgrounds;
sync = libraryPanel.backgroundsList.sync;
({ backgrounds: assets, sync } = libraryPanel.backgroundsList);
break;
default:
break;
Expand All @@ -61,7 +58,6 @@ const getAssetThumbnailURL = (asset, type) => {
};
})
export default class AssetsGridList extends React.Component {

static propTypes = {
assets: PropTypes.array.isRequired,
dispatch: PropTypes.func.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@ import AddIcon from 'common/icons/add';
import UploadAudioAssetModal from './UploadAudioAssetModal';
import EditAudioAssetModal from './EditAudioAssetModal';

import {
toggleUploadAudioAssetModal,
} from './UploadAudioAssetModal/actions';
import {
toggleEditAudioAssetModal,
} from './EditAudioAssetModal/redux';
import { toggleUploadAudioAssetModal } from './UploadAudioAssetModal/actions';
import { toggleEditAudioAssetModal } from './EditAudioAssetModal/redux';

import * as ASSET_TYPE from 'common/constants/assetTypes';
import { getAudioMp4Url } from 'editor/utils/app';
Expand All @@ -35,14 +31,14 @@ import {
let sync = true;
switch (ownProps.type) {
case ASSET_TYPE.MUSIC:
loading = libraryPanel.BGMsList.loading;
sounds = libraryPanel.BGMsList.BGMs;
sync = libraryPanel.BGMsList.sync;
({ loading, sync, BGMs: sounds } = libraryPanel.BGMsList);
break;
case ASSET_TYPE.SOUND:
loading = libraryPanel.SEsList.loading;
sounds = libraryPanel.SEsList.SEs;
sync = libraryPanel.SEsList.sync;
({
loading,
SEs: sounds,
sync,
} = libraryPanel.SEsList);
break;
default:
break;
Expand Down
Loading

0 comments on commit 71730bd

Please sign in to comment.