Bug 1770941 - Fix DevTools eslint react/prop-types errors batch 2 r=devtools-reviewers,nchevobbe

Differential Revision: https://phabricator.services.mozilla.com/D147184
This commit is contained in:
Michael Ratcliffe 2022-05-25 09:35:03 +00:00
Родитель cef4be176d
Коммит e32688c098
18 изменённых файлов: 288 добавлений и 25 удалений

Просмотреть файл

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "../../utils/connect";
import {
getHighlightedCalls,
@ -16,6 +17,16 @@ import "./HighlightCalls.css";
export class HighlightCalls extends Component {
previousCalls = null;
static get propTypes() {
return {
continueToHere: PropTypes.func.isRequired,
cx: PropTypes.object.isRequired,
editor: PropTypes.object.isRequired,
highlightedCalls: PropTypes.array,
selectedSource: PropTypes.object,
};
}
componentDidUpdate() {
this.unhighlightFunctionCalls();
this.highlightFunctioCalls();

Просмотреть файл

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import { Component } from "react";
import PropTypes from "prop-types";
import { toEditorLine, endOperation, startOperation } from "../../utils/editor";
import { getDocument, hasDocument } from "../../utils/editor/source-documents";
@ -38,6 +39,21 @@ export class HighlightLine extends Component {
isStepping = false;
previousEditorLine = null;
static get propTypes() {
return {
pauseCommand: PropTypes.oneOf([
"expression",
"resume",
"stepOver",
"stepIn",
"stepOut",
]),
selectedFrame: PropTypes.object,
selectedLocation: PropTypes.object.isRequired,
selectedSourceTextContent: PropTypes.object.isRequired,
};
}
shouldComponentUpdate(nextProps) {
const { selectedLocation, selectedSourceTextContent } = nextProps;
return this.shouldSetHighlightLine(

Просмотреть файл

@ -3,10 +3,18 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "../../utils/connect";
import { getHighlightedLineRange } from "../../selectors";
class HighlightLines extends Component {
static get propTypes() {
return {
editor: PropTypes.object.isRequired,
highlightedLineRange: PropTypes.object,
};
}
componentDidMount() {
this.highlightLineRange();
}

Просмотреть файл

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { PureComponent } from "react";
import PropTypes from "prop-types";
import Reps from "devtools/client/shared/components/reps/index";
const {
@ -15,6 +16,16 @@ const {
// Renders single variable preview inside a codemirror line widget
class InlinePreview extends PureComponent {
static get propTypes() {
return {
highlightDomElement: PropTypes.func.isRequired,
openElementInInspector: PropTypes.func.isRequired,
unHighlightDomElement: PropTypes.func.isRequired,
value: PropTypes.any.isRequired,
variable: PropTypes.string.isRequired,
};
}
showInScopes(variable) {
// TODO: focus on variable value in the scopes sidepanel
// we will need more info from parent comp

Просмотреть файл

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import InlinePreviewRow from "./InlinePreviewRow";
import { connect } from "../../utils/connect";
import {
@ -16,6 +17,15 @@ function hasPreviews(previews) {
}
class InlinePreviews extends Component {
static get propTypes() {
return {
editor: PropTypes.object.isRequired,
previews: PropTypes.object,
selectedFrame: PropTypes.object.isRequired,
selectedSource: PropTypes.object.isRequired,
};
}
shouldComponentUpdate({ previews }) {
return hasPreviews(previews);
}

Просмотреть файл

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "../../../utils/connect";
import classnames from "classnames";
@ -35,6 +36,16 @@ class ExceptionPopup extends Component {
};
}
static get propTypes() {
return {
clearPreview: PropTypes.func.isRequired,
cx: PropTypes.object.isRequired,
mouseout: PropTypes.func.isRequired,
selectSourceURL: PropTypes.func.isRequired,
exception: PropTypes.object.isRequired,
};
}
updateTopWindow() {
// The ChromeWindow is used when the stacktrace is expanded to capture all clicks
// outside the popup so the popup can be closed only by clicking outside of it.

Просмотреть файл

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "../../../utils/connect";
import Reps from "devtools/client/shared/components/reps/index";
@ -32,6 +33,20 @@ export class Popup extends Component {
super(props);
}
static get propTypes() {
return {
clearPreview: PropTypes.func.isRequired,
cx: PropTypes.object.isRequired,
editorRef: PropTypes.object.isRequired,
highlightDomElement: PropTypes.func.isRequired,
openElementInInspector: PropTypes.func.isRequired,
openLink: PropTypes.func.isRequired,
preview: PropTypes.object.isRequired,
selectSourceURL: PropTypes.func.isRequired,
unHighlightDomElement: PropTypes.func.isRequired,
};
}
componentDidMount() {
this.addHighlightToToken();
}

Просмотреть файл

@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import PropTypes from "prop-types";
import React, { PureComponent } from "react";
import { connect } from "../../../utils/connect";
@ -25,6 +26,20 @@ class Preview extends PureComponent {
this.state = { selecting: false };
}
static get propTypes() {
return {
clearPreview: PropTypes.func.isRequired,
cx: PropTypes.object.isRequired,
editor: PropTypes.object.isRequired,
editorRef: PropTypes.object.isRequired,
highlightedCalls: PropTypes.array,
isPaused: PropTypes.bool.isRequired,
preview: PropTypes.object,
setExceptionPreview: PropTypes.func.isRequired,
updatePreview: PropTypes.func.isRequired,
};
}
componentDidMount() {
this.updateListeners();
}

Просмотреть файл

@ -45,6 +45,26 @@ class SearchBar extends Component {
};
}
static get propTypes() {
return {
closeFileSearch: PropTypes.func.isRequired,
cx: PropTypes.object.isRequired,
doSearch: PropTypes.func.isRequired,
editor: PropTypes.object,
modifiers: PropTypes.object.isRequired,
query: PropTypes.string.isRequired,
searchOn: PropTypes.bool.isRequired,
searchResults: PropTypes.object.isRequired,
selectedContentLoaded: PropTypes.bool.isRequired,
selectedSource: PropTypes.object.isRequired,
setActiveSearch: PropTypes.func.isRequired,
showClose: PropTypes.bool,
size: PropTypes.string,
toggleFileSearchModifier: PropTypes.func.isRequired,
traverseResults: PropTypes.func.isRequired,
};
}
componentWillUnmount() {
const { shortcuts } = this.context;

Просмотреть файл

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { PureComponent } from "react";
import PropTypes from "prop-types";
import { connect } from "../../utils/connect";
import { showMenu, buildMenu } from "../../context-menu/menu";
@ -35,6 +36,27 @@ import {
import classnames from "classnames";
class Tab extends PureComponent {
static get propTypes() {
return {
activeSearch: PropTypes.string,
closeTab: PropTypes.func.isRequired,
closeTabs: PropTypes.func.isRequired,
copyToClipboard: PropTypes.func.isRequired,
cx: PropTypes.object.isRequired,
hasSiblingOfSameName: PropTypes.bool.isRequired,
onDragEnd: PropTypes.func.isRequired,
onDragOver: PropTypes.func.isRequired,
onDragStart: PropTypes.func.isRequired,
selectSource: PropTypes.func.isRequired,
selectedSource: PropTypes.object,
showSource: PropTypes.func.isRequired,
source: PropTypes.object.isRequired,
tabSources: PropTypes.array.isRequired,
toggleBlackBox: PropTypes.func.isRequired,
togglePrettyPrint: PropTypes.func.isRequired,
};
}
onTabContextMenu = (event, tab) => {
event.preventDefault();
this.showContextMenu(event, tab);

Просмотреть файл

@ -4,6 +4,7 @@
import React, { PureComponent } from "react";
import ReactDOM from "react-dom";
import PropTypes from "prop-types";
import { connect } from "../../utils/connect";
import {
@ -56,6 +57,22 @@ class Tabs extends PureComponent {
});
}
static get propTypes() {
return {
cx: PropTypes.object.isRequired,
endPanelCollapsed: PropTypes.bool.isRequired,
horizontal: PropTypes.bool.isRequired,
isPaused: PropTypes.bool.isRequired,
moveTab: PropTypes.func.isRequired,
moveTabBySourceId: PropTypes.func.isRequired,
selectSource: PropTypes.func.isRequired,
selectedSource: PropTypes.object,
startPanelCollapsed: PropTypes.bool.isRequired,
tabSources: PropTypes.array.isRequired,
togglePaneCollapse: PropTypes.func.isRequired,
};
}
get draggedSource() {
return this._draggedSource == null
? { url: null, id: null }

Просмотреть файл

@ -109,33 +109,34 @@ class Editor extends PureComponent {
static get propTypes() {
return {
selectedSource: PropTypes.object,
cx: PropTypes.object,
closeTab: PropTypes.func,
toggleBreakpointAtLine: PropTypes.func,
selectedSourceTextContent: PropTypes.object,
cx: PropTypes.object.isRequired,
closeTab: PropTypes.func.isRequired,
toggleBreakpointAtLine: PropTypes.func.isRequired,
conditionalPanelLocation: PropTypes.object,
closeConditionalPanel: PropTypes.func,
openConditionalPanel: PropTypes.func,
updateViewport: PropTypes.func,
isPaused: PropTypes.bool,
highlightCalls: PropTypes.func,
unhighlightCalls: PropTypes.func,
breakpointActions: PropTypes.object,
editorActions: PropTypes.object,
addBreakpointAtLine: PropTypes.func,
continueToHere: PropTypes.func,
toggleBlackBox: PropTypes.func,
updateCursorPosition: PropTypes.func,
jumpToMappedLocation: PropTypes.func,
closeConditionalPanel: PropTypes.func.isRequired,
openConditionalPanel: PropTypes.func.isRequired,
updateViewport: PropTypes.func.isRequired,
isPaused: PropTypes.bool.isRequired,
highlightCalls: PropTypes.func.isRequired,
unhighlightCalls: PropTypes.func.isRequired,
breakpointActions: PropTypes.object.isRequired,
editorActions: PropTypes.object.isRequired,
addBreakpointAtLine: PropTypes.func.isRequired,
continueToHere: PropTypes.func.isRequired,
toggleBlackBox: PropTypes.func.isRequired,
updateCursorPosition: PropTypes.func.isRequired,
jumpToMappedLocation: PropTypes.func.isRequired,
selectedLocation: PropTypes.object,
symbols: PropTypes.object,
startPanelSize: PropTypes.number,
endPanelSize: PropTypes.number,
searchOn: PropTypes.bool,
inlinePreviewEnabled: PropTypes.bool,
editorWrappingEnabled: PropTypes.bool,
skipPausing: PropTypes.bool,
blackboxedRanges: PropTypes.object,
breakableLines: PropTypes.object,
startPanelSize: PropTypes.number.isRequired,
endPanelSize: PropTypes.number.isRequired,
searchOn: PropTypes.bool.isRequired,
inlinePreviewEnabled: PropTypes.bool.isRequired,
editorWrappingEnabled: PropTypes.bool.isRequired,
skipPausing: PropTypes.bool.isRequired,
blackboxedRanges: PropTypes.object.isRequired,
breakableLines: PropTypes.object.isRequired,
};
}

Просмотреть файл

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import { showMenu } from "../../context-menu/menu";
import { connect } from "../../utils/connect";
import { score as fuzzaldrinScore } from "fuzzaldrin-plus";
@ -63,6 +64,20 @@ export class Outline extends Component {
this.state = { filter: "", focusedItem: null };
}
static get propTypes() {
return {
alphabetizeOutline: PropTypes.bool.isRequired,
cursorPosition: PropTypes.object,
cx: PropTypes.object.isRequired,
flashLineRange: PropTypes.func.isRequired,
getFunctionText: PropTypes.func.isRequired,
onAlphabetizeClick: PropTypes.func.isRequired,
selectLocation: PropTypes.func.isRequired,
selectedSource: PropTypes.object.isRequired,
symbols: PropTypes.object.isRequired,
};
}
componentDidUpdate(prevProps) {
const { cursorPosition, symbols } = this.props;
if (

Просмотреть файл

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import classnames from "classnames";
import "./OutlineFilter.css";
@ -10,6 +11,13 @@ import "./OutlineFilter.css";
export default class OutlineFilter extends Component {
state = { focused: false };
static get propTypes() {
return {
filter: PropTypes.string.isRequired,
updateFilter: PropTypes.func.isRequired,
};
}
setFocus = shouldFocus => {
this.setState({ focused: shouldFocus });
};

Просмотреть файл

@ -4,6 +4,7 @@
// Dependencies
import React, { Component } from "react";
import PropTypes from "prop-types";
import classnames from "classnames";
import { connect } from "../../utils/connect";
@ -63,6 +64,24 @@ class SourcesTree extends Component {
});
}
static get propTypes() {
return {
cx: PropTypes.object.isRequired,
debuggeeUrl: PropTypes.string.isRequired,
expanded: PropTypes.object.isRequired,
focusItem: PropTypes.func.isRequired,
focused: PropTypes.object,
projectRoot: PropTypes.string.isRequired,
selectSource: PropTypes.func.isRequired,
selectedSource: PropTypes.object,
setExpandedState: PropTypes.func.isRequired,
shownSource: PropTypes.object,
sourceCount: PropTypes.number,
sources: PropTypes.object.isRequired,
threads: PropTypes.array.isRequired,
};
}
componentWillReceiveProps(nextProps) {
const {
projectRoot,

Просмотреть файл

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "../../utils/connect";
import classnames from "classnames";
import { showMenu } from "../../context-menu/menu";
@ -37,6 +38,34 @@ import { downloadFile } from "../../utils/utils";
import { isFulfilled } from "../../utils/async-value";
class SourceTreeItem extends Component {
static get propTypes() {
return {
autoExpand: PropTypes.bool.isRequired,
blackBoxSources: PropTypes.func.isRequired,
clearProjectDirectoryRoot: PropTypes.func.isRequired,
cx: PropTypes.object.isRequired,
debuggeeUrl: PropTypes.string.isRequired,
depth: PropTypes.number.isRequired,
expanded: PropTypes.bool.isRequired,
extensionName: PropTypes.string,
focusItem: PropTypes.func.isRequired,
focused: PropTypes.bool.isRequired,
getSourcesGroups: PropTypes.func.isRequired,
hasMatchingGeneratedSource: PropTypes.bool.isRequired,
hasPrettyTab: PropTypes.bool.isRequired,
item: PropTypes.object.isRequired,
loadSourceText: PropTypes.func.isRequired,
projectRoot: PropTypes.string.isRequired,
selectItem: PropTypes.func.isRequired,
setExpanded: PropTypes.func.isRequired,
setProjectDirectoryRoot: PropTypes.func.isRequired,
source: PropTypes.object,
sourceContent: PropTypes.object,
threads: PropTypes.array.isRequired,
toggleBlackBox: PropTypes.func.isRequired,
};
}
componentDidMount() {
const { autoExpand, item } = this.props;
if (autoExpand) {

Просмотреть файл

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import classnames from "classnames";
import { Tab, Tabs, TabList, TabPanels } from "react-aria-components/src/tabs";
@ -33,6 +34,17 @@ class PrimaryPanes extends Component {
};
}
static get propTypes() {
return {
clearProjectDirectoryRoot: PropTypes.func.isRequired,
cx: PropTypes.object.isRequired,
projectRootName: PropTypes.string.isRequired,
selectedTab: PropTypes.oneOf(["sources", "outline"]).isRequired,
setPrimaryPaneTab: PropTypes.func.isRequired,
threads: PropTypes.array.isRequired,
};
}
showPane = selectedPane => {
this.props.setPrimaryPaneTab(selectedPane);
};

Просмотреть файл

@ -2,8 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import PropTypes from "prop-types";
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "../utils/connect";
import classnames from "classnames";
import actions from "../actions";
@ -50,6 +50,28 @@ export class ProjectSearch extends Component {
};
}
static get propTypes() {
return {
activeSearch: PropTypes.string,
clearSearch: PropTypes.func.isRequired,
closeProjectSearch: PropTypes.func.isRequired,
cx: PropTypes.object.isRequired,
doSearchForHighlight: PropTypes.func.isRequired,
query: PropTypes.string.isRequired,
results: PropTypes.array.isRequired,
searchSources: PropTypes.func.isRequired,
selectSpecificLocation: PropTypes.func.isRequired,
setActiveSearch: PropTypes.func.isRequired,
status: PropTypes.oneOf([
"INITIAL",
"FETCHING",
"CANCELED",
"DONE",
"ERROR",
]).isRequired,
};
}
componentDidMount() {
const { shortcuts } = this.context;
@ -278,6 +300,7 @@ export class ProjectSearch extends Component {
);
}
}
ProjectSearch.contextTypes = {
shortcuts: PropTypes.object,
};