Skip to content

Commit c043761

Browse files
author
Saket Hatwar
committed
lint
1 parent d5657b4 commit c043761

File tree

5 files changed

+54
-32
lines changed

5 files changed

+54
-32
lines changed

modules/conflict_resolver/jsx/CandidateConflictsWidget.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@ import '../../../node_modules/c3/c3.css';
22
import c3 from 'c3';
33
import React, {useEffect} from 'react';
44
import PropTypes from 'prop-types';
5-
import i18n from 'I18nSetup';
65
import {withTranslation} from 'react-i18next';
76

8-
import hiStrings from '../locale/hi/LC_MESSAGES/conflict_resolver.json';
9-
107
/**
118
* Renders a representation of the candidate conflicts as a React
129
* component
@@ -15,7 +12,7 @@ import hiStrings from '../locale/hi/LC_MESSAGES/conflict_resolver.json';
1512
* @return {object}
1613
*/
1714
function CandidateConflictsWidget(props) {
18-
const { t } = props;
15+
const {t} = props;
1916
const visits = getVisits(props.Conflicts);
2017
const instruments = getInstruments(props.Conflicts);
2118

@@ -69,10 +66,14 @@ function CandidateConflictsWidget(props) {
6966
<div id='conflictschart' />
7067
<ul>
7168
<li>
72-
{t('Click on instrument in legend to visit conflict resolver for that instrument across all visits.', {ns: 'conflict_resolver'})}
69+
{t('Click on instrument in legend to visit conflict resolver' +
70+
' for that instrument across all visits.',
71+
{ns: 'conflict_resolver'})}
7372
</li>
7473
<li>
75-
{t('Click on bar in graph to visit conflict resolver for that visit and instrument combination.', {ns: 'conflict_resolver'})}
74+
{t('Click on bar in graph to visit conflict resolver' +
75+
' for that visit and instrument combination.',
76+
{ns: 'conflict_resolver'})}
7677
</li>
7778
</ul>
7879
</div>;
@@ -154,4 +155,5 @@ function getDataBreakdown(visits, instruments, conflicts) {
154155
return data;
155156
}
156157

157-
export default withTranslation(['conflict_resolver', 'loris'])(CandidateConflictsWidget);
158+
export default withTranslation(
159+
['conflict_resolver', 'loris'])(CandidateConflictsWidget);

modules/conflict_resolver/jsx/conflict_resolver.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React, {Component} from 'react';
33
import {Tabs, TabPane} from 'Tabs';
44
import i18n from 'I18nSetup';
55
import {withTranslation} from 'react-i18next';
6+
import PropTypes from 'prop-types';
67

78
import UnresolvedFilterableDataTable from './unresolved_filterabledatatable';
89
import ResolvedFilterableDataTable from './resolved_filterabledatatable';
@@ -42,7 +43,7 @@ class ConflictResolver extends Component {
4243
* @return {JSX}
4344
*/
4445
render() {
45-
const { t } = this.props;
46+
const {t} = this.props;
4647
const tabs = [
4748
{id: 'unresolved', label: t('Unresolved', {ns: 'conflict_resolver'})},
4849
{id: 'resolved', label: t('Resolved', {ns: 'conflict_resolver'})},
@@ -87,5 +88,10 @@ window.addEventListener('load', () => {
8788
).render(<Index />);
8889
});
8990

90-
export default withTranslation(['conflict_resolver', 'loris'])(ConflictResolver);
91+
ConflictResolver.propTypes = {
92+
t: PropTypes.func,
93+
};
94+
95+
export default withTranslation(
96+
['conflict_resolver', 'loris'])(ConflictResolver);
9197

modules/conflict_resolver/jsx/fix_conflict_form.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
import {Component} from 'react';
66
import PropTypes from 'prop-types';
77
import {SelectElement} from 'jsx/Form';
8-
import i18n from 'I18nSetup';
98
import {withTranslation} from 'react-i18next';
10-
import hiStrings from '../locale/hi/LC_MESSAGES/conflict_resolver.json';
119

1210
/**
1311
* The fix FixConflictForm renders a <form> within a <td>. The form as a select
@@ -56,7 +54,7 @@ class FixConflictForm extends Component {
5654
* @param {string} value
5755
*/
5856
resolveConflict(name, value) {
59-
const { t } = this.props;
57+
const {t} = this.props;
6058
fetch(loris.BaseURL.concat('/conflict_resolver/unresolved'), {
6159
method: 'POST',
6260
credentials: 'same-origin',

modules/conflict_resolver/jsx/resolved_filterabledatatable.js

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import React, {Component} from 'react';
22
import {withTranslation} from 'react-i18next';
33
import Loader from 'Loader';
4-
import i18n from 'I18nSetup';
54
import FilterableDataTable from 'FilterableDataTable';
6-
7-
import hiStrings from '../locale/hi/LC_MESSAGES/conflict_resolver.json';
5+
import PropTypes from 'prop-types';
86

97
/**
108
* Filterable Datatable for resolved conflicts.
@@ -112,12 +110,13 @@ class ResolvedFilterableDataTable extends Component {
112110
* @return {JSX}
113111
*/
114112
render() {
115-
const { t } = this.props;
113+
const {t} = this.props;
116114
// If error occurs, return a message.
117115
if (this.state.error) {
118116
return (
119117
<div className="alert alert-danger" role="alert">
120-
<h4>{t('An error occured while loading the page.', {ns: 'conflict_resolver'})}</h4>
118+
<h4>{t('An error occured while loading the page.',
119+
{ns: 'conflict_resolver'})}</h4>
121120
{this.state.error.message}
122121
</div>
123122
);
@@ -131,13 +130,15 @@ class ResolvedFilterableDataTable extends Component {
131130
const options = this.state.data.fieldOptions;
132131

133132
const fields = [
134-
{label: t('Resolved ID', {ns: 'conflict_resolver'}), show: false},
133+
{label: t('Resolved ID',
134+
{ns: 'conflict_resolver'}), show: false},
135135
{label: t('Project', {ns: 'loris'}), show: true, filter: {
136136
name: 'Project',
137137
type: 'select',
138138
options: options.project,
139139
}},
140-
{label: t('Cohort', {ns: 'conflict_resolver'}), show: true, filter: {
140+
{label: t('Cohort',
141+
{ns: 'conflict_resolver'}), show: true, filter: {
141142
name: 'Cohort',
142143
type: 'select',
143144
options: options.cohort,
@@ -166,35 +167,43 @@ class ResolvedFilterableDataTable extends Component {
166167
type: 'select',
167168
options: options.instrument,
168169
}},
169-
{label: t('Question', {ns: 'conflict_resolver'}), show: true, filter: {
170+
{label: t('Question',
171+
{ns: 'conflict_resolver'}), show: true, filter: {
170172
name: 'Question',
171173
type: 'text',
172174
}},
173-
{label: t('Description', {ns: 'conflict_resolver'}), show: true, filter: {
175+
{label: t('Description',
176+
{ns: 'conflict_resolver'}), show: true, filter: {
174177
name: 'Description',
175178
type: 'text',
176179
}},
177-
{label: t('Incorrect Answer', {ns: 'conflict_resolver'}), show: true, filter: {
180+
{label: t('Incorrect Answer',
181+
{ns: 'conflict_resolver'}), show: true, filter: {
178182
name: 'OldValue',
179183
type: 'text',
180184
}},
181-
{label: t('Correct Answer', {ns: 'conflict_resolver'}), show: true, filter: {
185+
{label: t('Correct Answer',
186+
{ns: 'conflict_resolver'}), show: true, filter: {
182187
name: 'CorrectAnswer',
183188
type: 'text',
184189
}},
185-
{label: t('User 1', {ns: 'conflict_resolver'}), show: true, filter: {
190+
{label: t('User 1',
191+
{ns: 'conflict_resolver'}), show: true, filter: {
186192
name: 'User1',
187193
type: 'text',
188194
}},
189-
{label: t('User 2', {ns: 'conflict_resolver'}), show: true, filter: {
195+
{label: t('User 2',
196+
{ns: 'conflict_resolver'}), show: true, filter: {
190197
name: 'User2',
191198
type: 'text',
192199
}},
193-
{label: t('Resolver', {ns: 'conflict_resolver'}), show: true, filter: {
200+
{label: t('Resolver',
201+
{ns: 'conflict_resolver'}), show: true, filter: {
194202
name: 'Resolver',
195203
type: 'text',
196204
}},
197-
{label: t('Resolution Timestamp', {ns: 'conflict_resolver'}), show: true, filter: {
205+
{label: t('Resolution Timestamp',
206+
{ns: 'conflict_resolver'}), show: true, filter: {
198207
name: 'ResolutionTimestamp',
199208
type: 'text',
200209
}},
@@ -211,6 +220,10 @@ class ResolvedFilterableDataTable extends Component {
211220
}
212221
}
213222

223+
ResolvedFilterableDataTable.propTypes = {
224+
t: PropTypes.func.isRequired,
225+
};
226+
214227
export default withTranslation(
215228
['conflict_resolver', 'loris']
216229
)(ResolvedFilterableDataTable);

modules/conflict_resolver/jsx/unresolved_filterabledatatable.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import React, {Component} from 'react';
22
import Loader from 'Loader';
3-
import i18n from 'I18nSetup';
43
import {withTranslation} from 'react-i18next';
54
import FilterableDataTable from 'FilterableDataTable';
65
import FixConflictForm from './fix_conflict_form';
7-
8-
import hiStrings from '../locale/hi/LC_MESSAGES/conflict_resolver.json';
6+
import PropTypes from 'prop-types';
97

108
/**
119
* Filterable database for unresolved conflicts.
@@ -125,11 +123,12 @@ class UnresolvedFilterableDataTable extends Component {
125123
*/
126124
render() {
127125
// If error occurs, return a message.
128-
const { t } = this.props;
126+
const {t} = this.props;
129127
if (this.state.error) {
130128
return (
131129
<div className="alert alert-danger" role="alert">
132-
<h4>{t('An error occured while loading the page.', {ns: 'conflict_resolver'})}</h4>
130+
<h4>{t('An error occured while loading the page.',
131+
{ns: 'conflict_resolver'})}</h4>
133132
{this.state.error.toString()}
134133
</div>
135134
);
@@ -202,6 +201,10 @@ class UnresolvedFilterableDataTable extends Component {
202201
}
203202
}
204203

204+
UnresolvedFilterableDataTable.propTypes = {
205+
t: PropTypes.func.isRequired,
206+
};
207+
205208
export default withTranslation(
206209
['conflict_resolver', 'loris']
207210
)(UnresolvedFilterableDataTable);

0 commit comments

Comments
 (0)