1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-19 18:29:23 +00:00

run npm lint when open PR (#6375)

* 01 fix code warnings

* 02 change test.yml
This commit is contained in:
Michael An
2024-07-19 11:14:28 +08:00
committed by GitHub
parent c3b9b96ed9
commit 88dc8d0cac
10 changed files with 72 additions and 30 deletions

View File

@@ -28,7 +28,7 @@ class AboutDialog extends React.Component {
<Modal isOpen={true} toggle={toggleDialog}>
<ModalBody>
<button type="button" className="close" onClick={toggleDialog}><span aria-hidden="true">×</span></button>
<div className="about-content" dangerouslySetInnerHTML={{__html: aboutDialogCustomHtml}}></div>
<div className="about-content" dangerouslySetInnerHTML={{ __html: aboutDialogCustomHtml }}></div>
</ModalBody>
</Modal>
);

View File

@@ -20,9 +20,9 @@ class CreateDepartmentRepoDialog extends React.Component {
handleChange = (e) => {
if (!e.target.value.trim()) {
this.setState({isSubmitBtnActive: false});
this.setState({ isSubmitBtnActive: false });
} else {
this.setState({isSubmitBtnActive: true});
this.setState({ isSubmitBtnActive: true });
}
this.setState({
@@ -54,12 +54,12 @@ class CreateDepartmentRepoDialog extends React.Component {
let repoName = this.state.repoName.trim();
if (!repoName.length) {
errMessage = gettext('Name is required');
this.setState({errMessage: errMessage});
this.setState({ errMessage: errMessage });
return false;
}
if (repoName.indexOf('/') > -1) {
errMessage = gettext('Name should not include \'/\'.');
this.setState({errMessage: errMessage});
this.setState({ errMessage: errMessage });
return false;
}

View File

@@ -37,12 +37,12 @@ class InsertRepoImageDialog extends React.Component {
});
}
else {
this.setState({repo: null, selectedPath: ''});
this.setState({ repo: null, selectedPath: '' });
}
};
onRepoItemClick = () => {
this.setState({repo: null, selectedPath: ''});
this.setState({ repo: null, selectedPath: '' });
};
render() {

View File

@@ -20,7 +20,7 @@ class SysAdminRepoTransferDialog extends React.Component {
}
handleSelectChange = (option) => {
this.setState({selectedOption: option});
this.setState({ selectedOption: option });
};
submit = () => {
@@ -30,13 +30,13 @@ class SysAdminRepoTransferDialog extends React.Component {
render() {
const repoName = this.props.repoName;
const innerSpan = '<span class="op-target" title=' + repoName + '>' + repoName +'</span>';
const innerSpan = '<span class="op-target" title=' + repoName + '>' + repoName + '</span>';
let msg = gettext('Transfer Library {library_name}');
let message = msg.replace('{library_name}', innerSpan);
return (
<Modal isOpen={true} toggle={this.props.toggle}>
<ModalHeader toggle={this.props.toggle}>
<div dangerouslySetInnerHTML={{__html:message}} />
<div dangerouslySetInnerHTML={{ __html: message }} />
</ModalHeader>
<ModalBody>
<UserSelect

View File

@@ -3,7 +3,7 @@ const getValueLength = (str) => {
let len = 0;
for (let i = 0; i < str.length; i++) {
code = str.charCodeAt(i);
if (code == 10) { //solve enter problem
if (code == 10) { // solve enter problem
len += 2;
} else if (code < 0x007f) {
len += 1;

View File

@@ -55,7 +55,7 @@ class Search extends Component {
onChangeHandler = (event) => {
let _this = this;
this.setState({value: event.target.value});
this.setState({ value: event.target.value });
let newValue = event.target.value;
if (this.inputValue === newValue.trim()) {
return false;
@@ -124,7 +124,7 @@ class Search extends Component {
sendRequest(queryData) {
// 'page=1' for this first request
this.setState({page: 1}, () => {
this.setState({ page: 1 }, () => {
const { search_repo, q } = queryData;
const { page, perPage } = this.state;
this.searchWiki(search_repo, q, page, perPage);
@@ -220,7 +220,7 @@ class Search extends Component {
render() {
let width = this.state.width !== 'default' ? this.state.width : '';
let style = {'width': width};
let style = { 'width': width };
return (
<Fragment>
<MediaQuery query="(min-width: 768px)">