1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 14:50:29 +00:00

Fix eslint warnings (#5635)

* 01 fix eslint warnings

* fix code warnings

* fix code warnings

* fix code warnings

* fix code warnings

* fix code warnings
This commit is contained in:
Michael An
2023-09-13 08:40:50 +08:00
committed by GitHub
parent d829ba5b23
commit 14ce391007
520 changed files with 4774 additions and 3438 deletions

View File

@@ -19,6 +19,7 @@ const propTypes = {
onRepoItemClick: PropTypes.func,
mode: PropTypes.oneOf(['current_repo_and_other_repos', 'only_all_repos', 'only_current_library']),
fileSuffixes: PropTypes.array,
currentPath: PropTypes.string,
};
class FileChooser extends React.Component {
@@ -111,11 +112,11 @@ class FileChooser extends React.Component {
else {
this.setState({isOtherRepoShow: !this.state.isOtherRepoShow});
}
}
};
onCurrentRepoToggle = () => {
this.setState({isCurrentRepoShow: !this.state.isCurrentRepoShow});
}
};
onDirentItemClick = (repo, filePath, dirent) => {
this.props.onDirentItemClick(repo, filePath, dirent);
@@ -123,7 +124,7 @@ class FileChooser extends React.Component {
selectedRepo: repo,
selectedPath: filePath
});
}
};
onRepoItemClick = (repo) => {
if (this.props.onRepoItemClick) {
@@ -133,7 +134,7 @@ class FileChooser extends React.Component {
selectedRepo: repo,
selectedPath: '/',
});
}
};
onCloseSearching = () => {
this.setState({
@@ -145,7 +146,7 @@ class FileChooser extends React.Component {
this.inputValue = '';
this.timer = null;
this.source = null;
}
};
onSearchInfoChanged = (event) => {
let searchInfo = event.target.value.trim();
@@ -195,7 +196,7 @@ class FileChooser extends React.Component {
}
this.timer = setTimeout(this.getSearchResult(queryData), 500);
}
};
getSearchResult = (queryData) => {
if (this.source) {
@@ -206,7 +207,7 @@ class FileChooser extends React.Component {
this.source = seafileAPI.getSource();
this.sendRequest(queryData, this.source.token);
}
};
sendRequest = (queryData, cancelToken) => {
seafileAPI.searchFiles(queryData, cancelToken).then(res => {
@@ -226,11 +227,11 @@ class FileChooser extends React.Component {
});
this.source = null;
});
}
};
cancelRequest = () => {
this.source.cancel('prev request is cancelled');
}
};
getValueLength = (str) => {
var i = 0, code, len = 0;
@@ -247,7 +248,7 @@ class FileChooser extends React.Component {
}
}
return len;
}
};
formatResultItems = (data) => {
let items = [];
@@ -264,13 +265,13 @@ class FileChooser extends React.Component {
items[i]['content'] = data[i].content_highlight;
}
return items;
}
};
onSearchedItemClick = (item) => {
item['type'] = item.is_dir ? 'dir' : 'file';
let repo = new RepoInfo(item);
this.props.onDirentItemClick(repo, item.path, item);
}
};
renderSearchedView = () => {
if (this.getValueLength(this.inputValue) < 3) {
@@ -293,7 +294,7 @@ class FileChooser extends React.Component {
onSearchedItemDoubleClick={this.onSearchedItemDoubleClick}
/>);
}
}
};
onSearchedItemDoubleClick = (item) => {
if (item.type !== 'dir') {
@@ -363,11 +364,11 @@ class FileChooser extends React.Component {
}
}
this.onCloseSearching();
}
};
onScroll = (event) => {
event.stopPropagation();
}
};
renderRepoListView = () => {
@@ -464,7 +465,7 @@ class FileChooser extends React.Component {
)}
</div>
);
}
};
render() {
if (!this.state.selectedRepo && this.props.repoID) {

View File

@@ -11,6 +11,7 @@ import toaster from '../toast';
const propTypes = {
isShowFile: PropTypes.bool,
isCurrentRepo: PropTypes.bool,
selectedPath: PropTypes.string,
selectedRepo: PropTypes.object,
repo: PropTypes.object.isRequired,
@@ -19,6 +20,7 @@ const propTypes = {
onRepoItemClick: PropTypes.func.isRequired,
fileSuffixes: PropTypes.array,
selectedItemInfo: PropTypes.object,
currentPath: PropTypes.string,
};
class RepoListItem extends React.Component {
@@ -73,7 +75,7 @@ class RepoListItem extends React.Component {
return new TreeNode({object});
});
node.addChildren(nodeList);
}
};
onNodeExpanded = (node) => {
let repoID = this.props.repo.repo_id;
@@ -97,12 +99,12 @@ class RepoListItem extends React.Component {
tree.expandNode(node);
this.setState({treeData: tree});
}
}
};
onNodeCollapse = (node) => {
let tree = treeHelper.collapseNode(this.state.treeData, node);
this.setState({treeData: tree});
}
};
loadNodeAndParentsByPath = (repoID, path, expandNode) => {
@@ -139,17 +141,17 @@ class RepoListItem extends React.Component {
let errMessage = Utils.getErrorMsg(error);
toaster.danger(errMessage);
});
}
};
onToggleClick = (e) => {
e.stopPropagation();
this.setState({isShowChildren: !this.state.isShowChildren});
}
};
onDirentItemClick = (filePath, dirent) => {
let repo = this.props.repo;
this.props.onDirentItemClick(repo, filePath, dirent);
}
};
onRepoItemClick = (e) => {
if (!this.isCurrentRepo() || this.props.selectedPath !== '') {
@@ -157,12 +159,12 @@ class RepoListItem extends React.Component {
} else {
this.onToggleClick(e);
}
}
};
isCurrentRepo = () => {
let { selectedRepo, repo } = this.props;
return selectedRepo && (repo.repo_id === selectedRepo.repo_id);
}
};
render() {
let repoActive = false;

View File

@@ -14,6 +14,7 @@ const propTypes = {
onRepoItemClick: PropTypes.func.isRequired,
fileSuffixes: PropTypes.array,
selectedItemInfo: PropTypes.object,
currentPath: PropTypes.string,
};
class RepoListView extends React.Component {

View File

@@ -6,6 +6,7 @@ const propTypes = {
currentItem: PropTypes.object,
onItemClick: PropTypes.func.isRequired,
onSearchedItemDoubleClick: PropTypes.func.isRequired,
item: PropTypes.object,
};
class SearchedListItem extends React.Component {
@@ -19,22 +20,22 @@ class SearchedListItem extends React.Component {
onMouseEnter = () => {
this.setState({highlight: true});
}
};
onMouseLeave = () => {
this.setState({highlight: false});
}
};
onClick = () => {
let item = this.props.item;
this.props.onItemClick(item);
}
};
searchItemDoubleClick = (e) => {
let item = this.props.item;
this.props.onSearchedItemDoubleClick(item);
}
};
render() {
let { item, currentItem } = this.props;

View File

@@ -20,7 +20,7 @@ class SearchedListView extends React.Component {
onItemClick = (item) => {
this.setState({currentItem: item});
this.props.onItemClick(item);
}
};
render() {
return (
@@ -40,7 +40,8 @@ class SearchedListView extends React.Component {
currentItem={this.state.currentItem}
onItemClick={this.onItemClick}
onSearchedItemDoubleClick={this.props.onSearchedItemDoubleClick}
/>);
/>
);
})}
</tbody>
</table>

View File

@@ -32,7 +32,7 @@ class TreeViewItem extends React.Component {
} else {
this.props.onNodeExpanded(node);
}
}
};
onItemClick = (e) => {
e.stopPropagation(); // need prevent event popup
@@ -52,7 +52,7 @@ class TreeViewItem extends React.Component {
} else {
this.props.onDirentItemClick(this.state.filePath, this.props.node.object);
}
}
};
renderChildren = () => {
let { node } = this.props;
@@ -77,7 +77,7 @@ class TreeViewItem extends React.Component {
})}
</div>
);
}
};
render() {
let { node } = this.props;