From c416264c595bd0f0f07acf5124207fc1ff19be30 Mon Sep 17 00:00:00 2001 From: Brandon Nicholls Date: Tue, 15 Dec 2015 14:17:26 -0700 Subject: [PATCH] React eslint fixes --- .eslintrc | 19 +++- client/scripts/HttpUtils.js | 2 +- .../DetailView/AdminDeclarationsSummary.jsx | 3 +- .../Admin/DetailView/DetailView.jsx | 3 +- .../Admin/DetailView/DisclosureDetail.jsx | 8 +- .../Admin/DetailView/EntitySummary.jsx | 3 +- .../Config/Declarations/DeclarationType.jsx | 10 ++- .../Config/General/NewNotification.jsx | 3 +- .../Config/General/Notification.jsx | 3 +- .../Config/General/NotificationDetails.jsx | 16 ++-- .../scripts/components/Config/NewQuestion.jsx | 9 +- .../components/Config/QuestionnaireConfig.jsx | 6 +- client/scripts/components/DatePicker.jsx | 6 +- .../components/DynamicIcons/CheckmarkIcon.jsx | 2 + .../DynamicIcons/CompletedStepIcon.jsx | 2 + .../DynamicIcons/CurrentStepIcon.jsx | 2 + .../components/DynamicIcons/FEPlaceHolder.jsx | 2 + .../components/DynamicIcons/Gripper.jsx | 2 + .../DynamicIcons/ManualPlaceholder.jsx | 2 + .../components/DynamicIcons/PlusIcon.jsx | 2 + client/scripts/components/GreyButton.jsx | 2 + .../components/User/Archive/ArchiveDetail.jsx | 3 +- .../User/Archive/DeclarationsSummary.jsx | 6 +- .../scripts/components/User/CurrencyField.jsx | 15 +++- .../components/User/DateRangeField.jsx | 16 +++- .../Entities/EntityFormRelationshipStep.jsx | 32 +++++-- .../User/Entities/RelationshipTextField.jsx | 8 +- .../components/User/Entities/Toggle.jsx | 3 +- .../components/User/Entities/ToggleSet.jsx | 2 +- .../components/User/Projects/Entity.jsx | 3 +- .../User/Projects/EntityRelationDialog.jsx | 9 +- .../components/User/Projects/Project.jsx | 3 +- .../User/Projects/ProjectRelationDialog.jsx | 9 +- client/scripts/components/User/TextField.jsx | 10 ++- .../scripts/components/User/ToggleButton.jsx | 3 +- client/scripts/components/VerticalSlider.jsx | 2 +- client/scripts/stores/DisclosureStore.js | 9 +- db/migration/seeds/A.js | 90 +++++++++++++++++-- loadtest/tests/api/coi/config/POST.js | 2 +- .../_id/financial-entities/POST.js | 2 +- package.json | 2 +- server/db/DisclosureDB.js | 55 +++++++++++- server/db/PIReviewDB.js | 10 ++- server/db/ProjectDB.js | 17 +++- server/db/TravelLogDB.js | 14 ++- 45 files changed, 356 insertions(+), 76 deletions(-) diff --git a/.eslintrc b/.eslintrc index 5174c8e9..8d45834b 100644 --- a/.eslintrc +++ b/.eslintrc @@ -22,6 +22,7 @@ 2, { "skipBlankLines": true } ], + "max-len": [1, 180, 2], "no-unexpected-multiline": 2, "block-scoped-var": 2, "consistent-return": 2, @@ -50,7 +51,23 @@ "no-var": 2, "object-shorthand": 2, "prefer-const": 2, - "prefer-template": 2 + "prefer-template": 2, + "react/jsx-closing-bracket-location": 2, + "react/jsx-curly-spacing": 2, + "react/jsx-indent-props": [2, 2], + "react/jsx-key": 2, + "react/jsx-no-duplicate-props": 2, + "react/jsx-no-undef": 2, + "react/jsx-pascal-case": 2, + "react/jsx-uses-react": 2, + "react/jsx-uses-vars": 2, + "react/no-did-mount-set-state": 2, + "react/no-did-update-set-state": 2, + "react/no-direct-mutation-state": 2, + "react/no-unknown-property": 2, + "react/prefer-es6-class": 2, + "react/require-extension": [2, { "extensions": [".js", ".jsx"] }], + "react/self-closing-comp": 2 }, "env": { "es6": true, diff --git a/client/scripts/HttpUtils.js b/client/scripts/HttpUtils.js index a6b85290..0c131e7b 100644 --- a/client/scripts/HttpUtils.js +++ b/client/scripts/HttpUtils.js @@ -18,7 +18,7 @@ import defaults from 'superagent-defaults'; import cookies from 'cookies-js'; -import {UNAUTHORIZED} from './HTTPStatusCodes'; +import {UNAUTHORIZED} from '../../HTTPStatusCodes'; export function processResponse(callback) { return (err, res) => { diff --git a/client/scripts/components/Admin/DetailView/AdminDeclarationsSummary.jsx b/client/scripts/components/Admin/DetailView/AdminDeclarationsSummary.jsx index bcd29b1a..d5eefcdc 100644 --- a/client/scripts/components/Admin/DetailView/AdminDeclarationsSummary.jsx +++ b/client/scripts/components/Admin/DetailView/AdminDeclarationsSummary.jsx @@ -149,7 +149,8 @@ export class AdminDeclarationsSummary extends React.Component { return (
+ style={index === uniqueProjects.length - 1 ? styles.lastrelationship : styles.relationship} + >
{project.name}
diff --git a/client/scripts/components/Admin/DetailView/DetailView.jsx b/client/scripts/components/Admin/DetailView/DetailView.jsx index 948fb50e..0ef5cb8a 100644 --- a/client/scripts/components/Admin/DetailView/DetailView.jsx +++ b/client/scripts/components/Admin/DetailView/DetailView.jsx @@ -132,7 +132,8 @@ export class DetailView extends React.Component { sidePanel = ( + readonly={readOnly} + /> ); } else if (this.state.applicationState.commentSummaryShowing) { diff --git a/client/scripts/components/Admin/DetailView/DisclosureDetail.jsx b/client/scripts/components/Admin/DetailView/DisclosureDetail.jsx index 7d1e90d7..9cf4a2e2 100644 --- a/client/scripts/components/Admin/DetailView/DisclosureDetail.jsx +++ b/client/scripts/components/Admin/DetailView/DisclosureDetail.jsx @@ -207,11 +207,15 @@ export class DisclosureDetail extends React.Component { - 0 } style={styles.rejection} /> + 0} style={styles.rejection} /> 0} - readonly={this.props.disclosure.statusCd === COIConstants.DISCLOSURE_STATUS.UP_TO_DATE || this.props.disclosure.statusCd === COIConstants.DISCLOSURE_STATUS.UPDATES_REQUIRED}/> + readonly={ + this.props.disclosure.statusCd === COIConstants.DISCLOSURE_STATUS.UP_TO_DATE || + this.props.disclosure.statusCd === COIConstants.DISCLOSURE_STATUS.UPDATES_REQUIRED + } + />
diff --git a/client/scripts/components/Admin/DetailView/EntitySummary.jsx b/client/scripts/components/Admin/DetailView/EntitySummary.jsx index dc5920f2..5c5baad6 100644 --- a/client/scripts/components/Admin/DetailView/EntitySummary.jsx +++ b/client/scripts/components/Admin/DetailView/EntitySummary.jsx @@ -183,7 +183,8 @@ export default class EntitySummary extends React.Component { color: window.colorBlindModeOn ? 'black' : '#0095A0', borderBottom: `1px dotted ${window.colorBlindModeOn ? 'black' : '#0095A0'}` }} - href={`/api/coi/files/${encodeURIComponent(file.id)}`}> + href={`/api/coi/files/${encodeURIComponent(file.id)}`} + > {file.name} diff --git a/client/scripts/components/Config/Declarations/DeclarationType.jsx b/client/scripts/components/Config/Declarations/DeclarationType.jsx index 61976d8c..76746bb3 100644 --- a/client/scripts/components/Config/Declarations/DeclarationType.jsx +++ b/client/scripts/components/Config/Declarations/DeclarationType.jsx @@ -113,7 +113,15 @@ export default class DeclarationType extends React.Component { if (this.typeIsBeingEdited(type)) { jsx = ( - + ); diff --git a/client/scripts/components/Config/General/NewNotification.jsx b/client/scripts/components/Config/General/NewNotification.jsx index d457347b..e9cebde1 100644 --- a/client/scripts/components/Config/General/NewNotification.jsx +++ b/client/scripts/components/Config/General/NewNotification.jsx @@ -68,7 +68,8 @@ export default class NewNotifications extends React.Component { onChange={this.setReminderText} style={styles.expirationMessage} placeholder="Enter the reminder text here" - value={this.props.reminderText}> + value={this.props.reminderText} + > ); diff --git a/client/scripts/components/Config/General/Notification.jsx b/client/scripts/components/Config/General/Notification.jsx index 73b3a668..b528b73f 100644 --- a/client/scripts/components/Config/General/Notification.jsx +++ b/client/scripts/components/Config/General/Notification.jsx @@ -102,7 +102,8 @@ export default class Notification extends React.Component { ref="reminderText" style={styles.reminderTextbox} placeholder="Enter the reminder text here" - defaultValue={this.props.reminderText}> + defaultValue={this.props.reminderText} + > ); diff --git a/client/scripts/components/Config/General/NotificationDetails.jsx b/client/scripts/components/Config/General/NotificationDetails.jsx index fa98de3e..0243fb4a 100644 --- a/client/scripts/components/Config/General/NotificationDetails.jsx +++ b/client/scripts/components/Config/General/NotificationDetails.jsx @@ -125,13 +125,15 @@ export default class NotificationDetails extends React.Component { let notifications; if (this.props.notifications && this.props.notifications.length > 0) { notifications = this.props.notifications.map((notification, index) => { - return ; + return ( + + ); }); } diff --git a/client/scripts/components/Config/NewQuestion.jsx b/client/scripts/components/Config/NewQuestion.jsx index a77796c4..c9739bf7 100644 --- a/client/scripts/components/Config/NewQuestion.jsx +++ b/client/scripts/components/Config/NewQuestion.jsx @@ -198,7 +198,14 @@ export default class NewQuestion extends React.Component {
- +
); diff --git a/client/scripts/components/Config/QuestionnaireConfig.jsx b/client/scripts/components/Config/QuestionnaireConfig.jsx index 018e9152..51b5c9fd 100644 --- a/client/scripts/components/Config/QuestionnaireConfig.jsx +++ b/client/scripts/components/Config/QuestionnaireConfig.jsx @@ -342,7 +342,8 @@ class QuestionnaireConfig extends React.Component { text={question.question.text} isSubQuestion={false} top={question.question.top} - style={questionStyle} /> + style={questionStyle} + /> ); this.findSubQuestions(question.id).forEach(subQuestion => { @@ -362,7 +363,8 @@ class QuestionnaireConfig extends React.Component { isSubQuestion={true} top={subQuestion.question.top} style={{cursor: 'move'}} - displayCriteria={subQuestion.question.displayCriteria} /> + displayCriteria={subQuestion.question.displayCriteria} + /> ); }); }); diff --git a/client/scripts/components/DatePicker.jsx b/client/scripts/components/DatePicker.jsx index c4abd23b..b3808884 100644 --- a/client/scripts/components/DatePicker.jsx +++ b/client/scripts/components/DatePicker.jsx @@ -87,7 +87,8 @@ export class DatePicker extends ResponsiveComponent { value={this.props.value ? formatDate(this.props.value) : ''} placeholder="Select a date" onFocus={this.showCalendar} - style={merge(styles.textField, this.props.textFieldStyle)} /> + style={merge(styles.textField, this.props.textFieldStyle)} + /> + onDayClick={this.dayClicked} + /> ); } diff --git a/client/scripts/components/DynamicIcons/CheckmarkIcon.jsx b/client/scripts/components/DynamicIcons/CheckmarkIcon.jsx index 7a22a917..f66a42d3 100644 --- a/client/scripts/components/DynamicIcons/CheckmarkIcon.jsx +++ b/client/scripts/components/DynamicIcons/CheckmarkIcon.jsx @@ -17,6 +17,8 @@ along with this program. If not, see */ +/* eslint-disable max-len */ + import React from 'react'; export default function CheckmarkIcon(props: Object): React.Element { diff --git a/client/scripts/components/DynamicIcons/CompletedStepIcon.jsx b/client/scripts/components/DynamicIcons/CompletedStepIcon.jsx index cfe537c2..45dbaf7c 100644 --- a/client/scripts/components/DynamicIcons/CompletedStepIcon.jsx +++ b/client/scripts/components/DynamicIcons/CompletedStepIcon.jsx @@ -17,6 +17,8 @@ along with this program. If not, see */ +/* eslint-disable react/jsx-closing-bracket-location */ + import React from 'react'; export function CompletedStepIcon(props: Object): React.Element { diff --git a/client/scripts/components/DynamicIcons/CurrentStepIcon.jsx b/client/scripts/components/DynamicIcons/CurrentStepIcon.jsx index 199603fa..8187cf02 100644 --- a/client/scripts/components/DynamicIcons/CurrentStepIcon.jsx +++ b/client/scripts/components/DynamicIcons/CurrentStepIcon.jsx @@ -17,6 +17,8 @@ along with this program. If not, see */ +/* eslint-disable */ + import React from 'react'; export function CurrentStepIcon(props: Object): React.Element { diff --git a/client/scripts/components/DynamicIcons/FEPlaceHolder.jsx b/client/scripts/components/DynamicIcons/FEPlaceHolder.jsx index 890377ef..f89332c7 100644 --- a/client/scripts/components/DynamicIcons/FEPlaceHolder.jsx +++ b/client/scripts/components/DynamicIcons/FEPlaceHolder.jsx @@ -17,6 +17,8 @@ along with this program. If not, see */ +/* eslint-disable react/jsx-closing-bracket-location, react/jsx-pascal-case */ + import React from 'react'; export function FEPlaceHolder(props: Object): React.Element { diff --git a/client/scripts/components/DynamicIcons/Gripper.jsx b/client/scripts/components/DynamicIcons/Gripper.jsx index 4ecf6856..fbdd4b05 100644 --- a/client/scripts/components/DynamicIcons/Gripper.jsx +++ b/client/scripts/components/DynamicIcons/Gripper.jsx @@ -17,6 +17,8 @@ along with this program. If not, see */ +/* eslint-disable max-len */ + import React from 'react'; export default function Gripper(props: Object): React.Element { diff --git a/client/scripts/components/DynamicIcons/ManualPlaceholder.jsx b/client/scripts/components/DynamicIcons/ManualPlaceholder.jsx index 72fc1986..c512ef17 100644 --- a/client/scripts/components/DynamicIcons/ManualPlaceholder.jsx +++ b/client/scripts/components/DynamicIcons/ManualPlaceholder.jsx @@ -17,6 +17,8 @@ along with this program. If not, see */ +/* eslint-disable react/jsx-closing-bracket-location, react/jsx-pascal-case */ + import React from 'react'; export function ManualPlaceholder(props: Object): React.Element { diff --git a/client/scripts/components/DynamicIcons/PlusIcon.jsx b/client/scripts/components/DynamicIcons/PlusIcon.jsx index 1d1dae0b..e0e35f78 100644 --- a/client/scripts/components/DynamicIcons/PlusIcon.jsx +++ b/client/scripts/components/DynamicIcons/PlusIcon.jsx @@ -17,6 +17,8 @@ along with this program. If not, see */ +/* eslint-disable max-len, react/jsx-closing-bracket-location */ + import React from 'react'; export function PlusIcon(props: Object): React.Element { diff --git a/client/scripts/components/GreyButton.jsx b/client/scripts/components/GreyButton.jsx index 2fcd5efa..dfc0616a 100644 --- a/client/scripts/components/GreyButton.jsx +++ b/client/scripts/components/GreyButton.jsx @@ -16,6 +16,8 @@ along with this program. If not, see */ +/* eslint-disable react/jsx-key */ + import React from 'react'; // eslint-disable-line no-unused-vars import {merge} from '../merge'; diff --git a/client/scripts/components/User/Archive/ArchiveDetail.jsx b/client/scripts/components/User/Archive/ArchiveDetail.jsx index 3332998f..66935b69 100644 --- a/client/scripts/components/User/Archive/ArchiveDetail.jsx +++ b/client/scripts/components/User/Archive/ArchiveDetail.jsx @@ -66,7 +66,8 @@ export default class extends React.Component { declarations={disclosure.declarations} projectTypes={this.props.config.projectTypes} declarationTypes={this.props.config.declarationTypes} - id={disclosure.id} /> + id={disclosure.id} + /> ); } diff --git a/client/scripts/components/User/Archive/DeclarationsSummary.jsx b/client/scripts/components/User/Archive/DeclarationsSummary.jsx index dbdd3b5f..36cedb41 100644 --- a/client/scripts/components/User/Archive/DeclarationsSummary.jsx +++ b/client/scripts/components/User/Archive/DeclarationsSummary.jsx @@ -149,8 +149,10 @@ export default class extends React.Component { }); return ( -
+
{project.name}
diff --git a/client/scripts/components/User/CurrencyField.jsx b/client/scripts/components/User/CurrencyField.jsx index e797fd6f..daeba3ac 100644 --- a/client/scripts/components/User/CurrencyField.jsx +++ b/client/scripts/components/User/CurrencyField.jsx @@ -56,11 +56,20 @@ export default class NumericField extends TextField { return (
- +
$ - +
); diff --git a/client/scripts/components/User/DateRangeField.jsx b/client/scripts/components/User/DateRangeField.jsx index 93f7554f..27254eca 100644 --- a/client/scripts/components/User/DateRangeField.jsx +++ b/client/scripts/components/User/DateRangeField.jsx @@ -63,9 +63,21 @@ export default class TextField extends React.Component {
- + TO - +
); diff --git a/client/scripts/components/User/Entities/EntityFormRelationshipStep.jsx b/client/scripts/components/User/Entities/EntityFormRelationshipStep.jsx index 1211375e..b4c44508 100644 --- a/client/scripts/components/User/Entities/EntityFormRelationshipStep.jsx +++ b/client/scripts/components/User/Entities/EntityFormRelationshipStep.jsx @@ -271,8 +271,12 @@ export class EntityFormRelationshipStep extends React.Component { amountSection = (
AMOUNT
- {amountTypeOptions} @@ -320,10 +324,10 @@ export class EntityFormRelationshipStep extends React.Component { if (this.state.relation !== '' && this.state.matrixType.reasonEnabled === 1) { reason = ( ); } @@ -389,8 +393,12 @@ export class EntityFormRelationshipStep extends React.Component { commentTextboxStyle = merge(commentTextboxStyle, styles.invalidField); } - const relationshipPersonTypeOptions = window.config.relationshipPersonTypes.map(option => { - return ; + const relationshipPersonTypeOptions = window.config.relationshipPersonTypes.map(personType => { + return ( + + ); }); const htmlId = Math.floor(Math.random() * 1000000000); @@ -445,7 +453,13 @@ export class EntityFormRelationshipStep extends React.Component {
-