Skip to content

Commit 2d1ea6d

Browse files
committed
Fix warnings
1 parent 3e5e0f1 commit 2d1ea6d

15 files changed

Lines changed: 21 additions & 36 deletions

File tree

webapp/src/components/ErrorPage.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Error Message:
1616
// Consider logging componentStack and error
1717
export const ErrorPage = ({ componentStack, error }) => {
1818
if (errorHandler){
19-
var errorMessage= new Object();
19+
var errorMessage= {};
2020
errorMessage.componentStack = componentStack;
2121
errorMessage.error = error;
2222
var jsonString= JSON.stringify(errorMessage);

webapp/src/components/answerValue/AnswerValue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function AnswerValue({answer, question, t}) {
3636
}
3737
case FILE:
3838
return <div>
39-
<a target="_blank" href={getDownloadURL(answer.value)}>{t("Uploaded File")}</a>
39+
<a target="_blank" rel="noopener noreferrer" href={getDownloadURL(answer.value)}>{t("Uploaded File")}</a>
4040
<br/>
4141
<span className="small-text">
4242
*{t("Note: You may need to change the file name to open the file on certain operating systems")}

webapp/src/components/answerValue/MultiFileValue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function MultiFileValue({value}) {
77
return <ul>
88
{files.map(v =>
99
<li key={"file_" + v.id}>
10-
<a target="_blank" href={getDownloadURL(JSON.stringify(v))}>
10+
<a target="_blank" rel="noopener noreferrer" href={getDownloadURL(JSON.stringify(v))}>
1111
{v.name}
1212
</a>
1313
</li>)}

webapp/src/components/form/FormDate.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ import * as moment from 'moment';
77
import MarkdownRenderer from "../MarkdownRenderer";
88

99
class FormDate extends React.Component {
10-
constructor(props) {
11-
super(props);
12-
}
13-
1410
shouldDisplayError = () => {
1511
return this.props.showError && this.props.errorText !== "";
1612

webapp/src/components/form/MultiFileComponent.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { getDownloadURL } from '../../utils/files';
3333
let name = this.state.name;
3434
const rename = value.name;
3535

36-
if (!this.state.name || this.state.name == "") {
36+
if (!this.state.name || this.state.name === "") {
3737
name = value.name;
3838
}
3939

@@ -94,7 +94,7 @@ import { getDownloadURL } from '../../utils/files';
9494
</input>)
9595
}
9696
else {
97-
return (<div className="file-uploaded"><img src={tick} ></img><h6 style={{ marginLeft: "3px" }}>{this.props.value.file.name}</h6></div>)
97+
return (<div className="file-uploaded"><img src={tick} alt="" ></img><h6 style={{ marginLeft: "3px" }}>{this.props.value.file.name}</h6></div>)
9898
}
9999
}
100100

@@ -128,11 +128,11 @@ import { getDownloadURL } from '../../utils/files';
128128
></input>
129129

130130
<button onClick={this.submit} className={btnSubmit ? "btn-submit show" : "btn-submit"}>{t("Submit")}</button>
131-
<a onClick={this.nameChange} className={isSubmitted || this.props.value.name ? "edit show" : "edit"} data-tip={t("Edit Name")}><i className="fas fa-edit"></i></a>
131+
<button type="button" onClick={this.nameChange} className={isSubmitted || this.props.value.name ? "edit show" : "edit"} data-tip={t("Edit Name")}><i className="fas fa-edit"></i></button>
132132
<ReactToolTip type="info" place="top" effect="solid" />
133-
<a onClick={this.del} className={file ? "bin show" : "bin"} data-tip={t("Delete")}><i className="fas fa-trash"></i></a>
133+
<button type="button" onClick={this.del} className={file ? "bin show" : "bin"} data-tip={t("Delete")}><i className="fas fa-trash"></i></button>
134134
<ReactToolTip type="info" place="top" effect="solid" />
135-
<a className="view" style={file ? { display: "block" } : { display: "none" }} href={getDownloadURL(JSON.stringify(this.props.value))} target="_blank" data-tip={t("View File")}><i className="far fa-eye"></i></a>
135+
<a className="view" style={file ? { display: "block" } : { display: "none" }} href={getDownloadURL(JSON.stringify(this.props.value))} target="_blank" rel="noopener noreferrer" data-tip={t("View File")}><i className="far fa-eye"></i></a>
136136
<ReactToolTip type="info" place="top" effect="solid" />
137137
</div>
138138
{this.state.error && <p style={{color: "red"}}>{t("Please enter a name")}</p>}

webapp/src/i18n.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ function i18nInit(organisation) {
2626
}
2727
}
2828

29-
if (found.length == 0) {
29+
if (found.length === 0) {
3030
return undefined;
3131
}
3232

3333
found = found.map(lang => lang.slice(0, 2));
3434
const orgLanguageCodes = organisation.languages.map(l => l.code);
3535
let selectedLanguage = null;
3636
found.forEach(f => {
37-
if (selectedLanguage == null && orgLanguageCodes.includes(f)) {
37+
if (selectedLanguage === null && orgLanguageCodes.includes(f)) {
3838
selectedLanguage = f;
3939
}
4040
})

webapp/src/pages/ResponsePage/ResponsePage.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,8 @@ class ResponsePage extends Component {
437437
return <div key={choices}>{choices}</div>
438438
}
439439
// other
440-
else {
441-
return <div key={headline}><p className="answer">{a.value}</p></div>
442-
};
443-
};
440+
return <div key={headline}><p className="answer">{a.value}</p></div>
441+
}
444442
};
445443

446444
// render Delete Modal

webapp/src/pages/eventConfig/components/EventConfigComponent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class EventConfigComponent extends Component {
138138

139139
onClickUpdate = () => {
140140
const errors = this.validateEventDetails();
141-
if (errors.length == 0) { //PUT
141+
if (errors.length === 0) { //PUT
142142
const event_with_times = this.addTimeToDates(this.state.updatedEvent);
143143
eventService.update(event_with_times).then(result => {
144144
if (result.error) {
@@ -221,7 +221,7 @@ class EventConfigComponent extends Component {
221221
if (this.state.updatedEvent.email_from.trim().length === 0) {
222222
errors.push(this.props.t("Organisation email is required"));
223223
}
224-
if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(this.state.updatedEvent.email_from)) {
224+
if (!/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(this.state.updatedEvent.email_from)) {
225225
errors.push(this.props.t("Organisation email is invalid"));
226226
}
227227
if (this.state.updatedEvent.url.trim().length === 0) {

webapp/src/pages/formEditor/components/DependencyEditor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const DependencyEditor = ({
4343
const [isInitialized, setIsInitialized] = useState(false);
4444
const [showJsonPreview, setShowJsonPreview] = useState(false);
4545
const [linkedFormQuestions, setLinkedFormQuestions] = useState([]);
46-
const [loadingLinkedQuestions, setLoadingLinkedQuestions] = useState(false);
46+
const [, setLoadingLinkedQuestions] = useState(false);
4747

4848
useEffect(() => {
4949
if (!isInitialized) {

webapp/src/pages/invoices/components/InvoiceAdminListComponent.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React, { Component } from "react";
22
import { withRouter } from "react-router";
3-
import { NavLink } from "react-router-dom";
43
import Loading from "../../../components/Loading";
54
import { invoiceService } from "../../../services/invoices/invoices.service";
65
import { Trans, withTranslation } from 'react-i18next'

0 commit comments

Comments
 (0)