Skip to content

Commit ad6b55a

Browse files
authored
WV-2814: Turn on required PropType validation for ESLint. Fixed files to pass ESLint (#6291)
* Set 'error' to react/prop-types and react/no-unused-prop-types * ESLint props validation fixes Part 1 * Fixes to files with missing prop-type validation * Removed old comments from web/.eslintrc
1 parent a0f1d1d commit ad6b55a

File tree

39 files changed

+97
-25
lines changed

39 files changed

+97
-25
lines changed

web/.eslintrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@
160160
"react/no-unknown-property": "error",
161161
"react/jsx-no-useless-fragment": "error",
162162
"react/no-unstable-nested-components": "error",
163-
"react/prop-types": "warn", // 58 errors across 22 files
164-
"react/no-unused-prop-types": "warn", // 9 errors across 9 files
163+
"react/prop-types": "error",
164+
"react/no-unused-prop-types": "error",
165165
"default-param-last": "warn", // 42 errors across 34 files
166166
"prefer-regex-literals": "error",
167167
"no-promise-executor-return": "error"

web/js/components/animation-widget/gif-post-creation.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ export default class GifResults extends Component {
141141

142142
GifResults.propTypes = {
143143
boundaries: PropTypes.object,
144+
closeBtn: PropTypes.object,
144145
endDate: PropTypes.string,
145146
gifObject: PropTypes.object,
146147
increment: PropTypes.string,

web/js/components/date-selector/date-input-column.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ DateInputColumn.propTypes = {
345345
date: PropTypes.object,
346346
fontSize: PropTypes.number,
347347
idSuffix: PropTypes.string,
348+
isKioskModeActive: PropTypes.bool,
348349
isValid: PropTypes.bool,
349350
isStartDate: PropTypes.bool,
350351
isEndDate: PropTypes.bool,

web/js/components/layer/info/date-ranges.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useState } from 'react';
22
import { ListGroup, ListGroupItem, Spinner } from 'reactstrap';
3+
import PropTypes from 'prop-types';
34
import Scrollbar from '../../util/scrollbar';
45
import { coverageDateFormatter } from '../../../modules/date/util';
56

@@ -100,3 +101,7 @@ export default function DateRanges ({ layer }) {
100101
</>
101102
);
102103
}
104+
105+
DateRanges.propTypes = {
106+
layer: PropTypes.object,
107+
};

web/js/components/layer/product-picker/browse/category-grid.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ CategoryGrid.propTypes = {
8989
showMeasurements: PropTypes.func,
9090
hasMeasurementSource: PropTypes.func,
9191
measurementConfig: PropTypes.object,
92-
width: PropTypes.number,
9392
};
9493

9594
export default connect(

web/js/components/layer/settings/band-selection/band-selection-parent-info-menu.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import { useDispatch } from 'react-redux';
33
import { Button } from 'reactstrap';
4+
import PropTypes from 'prop-types';
45
import BandSelectionMenu from './band-selection-menu';
56
import { toggleCustomContent } from '../../../../modules/modal/actions';
67

@@ -96,3 +97,7 @@ export default function BandSelectionParentInfoMenu({ layer }) {
9697
</div>
9798
);
9899
}
100+
101+
BandSelectionParentInfoMenu.propTypes = {
102+
layer: PropTypes.object,
103+
};

web/js/components/layer/settings/band-selection/menu-components/band-dropdown.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import PropTypes from 'prop-types';
12
import React, { useState } from 'react';
23
import {
34
Dropdown,
@@ -42,3 +43,11 @@ export default function BandsDropdown(props) {
4243
</Dropdown>
4344
);
4445
}
46+
47+
BandsDropdown.propTypes = {
48+
channel: PropTypes.string,
49+
bandSelection: PropTypes.object,
50+
setBandSelection: PropTypes.func,
51+
layer: PropTypes.object,
52+
setSelectedPreset: PropTypes.func,
53+
};

web/js/components/layer/settings/band-selection/menu-components/preset-options.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import PropTypes from 'prop-types';
23
import {
34
Card, CardImg, CardBody, CardTitle, CardText,
45
} from 'reactstrap';
@@ -345,3 +346,10 @@ export default function PresetOptions(props) {
345346
</div>
346347
);
347348
}
349+
350+
PresetOptions.propTypes = {
351+
setBandSelection: PropTypes.func,
352+
selectedPreset: PropTypes.object,
353+
setSelectedPreset: PropTypes.func,
354+
presetOptions: PropTypes.string,
355+
};

web/js/components/layer/settings/imagery-search.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useSelector, useDispatch } from 'react-redux';
33
import {
44
Spinner,
55
} from 'reactstrap';
6+
import PropTypes from 'prop-types';
67
import { selectDate as selectDateAction } from '../../../modules/date/actions';
78

89
const dateOptions = {
@@ -170,3 +171,7 @@ export default function ImagerySearch({ layer }) {
170171
</div>
171172
);
172173
}
174+
175+
ImagerySearch.propTypes = {
176+
layer: PropTypes.object,
177+
};

web/js/components/layer/settings/layer-settings.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,6 @@ LayerSettings.defaultProps = {
441441
};
442442
LayerSettings.propTypes = {
443443
clearCustomPalette: PropTypes.func,
444-
clearStyle: PropTypes.func,
445444
customPalettesIsActive: PropTypes.bool,
446445
getCustomPalette: PropTypes.func,
447446
getDefaultLegend: PropTypes.func,
@@ -452,19 +451,16 @@ LayerSettings.propTypes = {
452451
globalTemperatureUnit: PropTypes.string,
453452
groupName: PropTypes.string,
454453
layer: PropTypes.object,
455-
onCustomizeBandClick: PropTypes.func,
456454
palettedAllowed: PropTypes.bool,
457455
paletteOrder: PropTypes.array,
458456
palettesTranslate: PropTypes.func,
459457
resetGranuleLayerDates: PropTypes.func,
460458
screenHeight: PropTypes.number,
461459
setCustomPalette: PropTypes.func,
462460
setOpacity: PropTypes.func,
463-
setStyle: PropTypes.func,
464461
setThresholdRange: PropTypes.func,
465462
toggleClassification: PropTypes.func,
466463
updateGranuleLayerOptions: PropTypes.func,
467464
toggleAllClassifications: PropTypes.func,
468-
vectorStyles: PropTypes.object,
469465
zot: PropTypes.object,
470466
};

0 commit comments

Comments
 (0)