Bug 1770257 - Fix DevTools eslint react/prop-types errors batch 1 r=nchevobbe

Differential Revision: https://phabricator.services.mozilla.com/D147017
This commit is contained in:
Michael Ratcliffe 2022-05-25 11:53:29 +00:00
Родитель 556d4cfd0a
Коммит 301e954586
15 изменённых файлов: 137 добавлений и 3 удалений

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

@ -3,9 +3,16 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React from "react";
import PropTypes from "prop-types";
import "./A11yIntention.css";
export default class A11yIntention extends React.Component {
static get propTypes() {
return {
children: PropTypes.array.isRequired,
};
}
state = { keyboard: false };
handleKeyDown = () => {

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

@ -60,6 +60,25 @@ class App extends Component {
};
}
static get propTypes() {
return {
activeSearch: PropTypes.oneOf(["file", "project"]),
closeActiveSearch: PropTypes.func.isRequired,
closeProjectSearch: PropTypes.func.isRequired,
closeQuickOpen: PropTypes.func.isRequired,
endPanelCollapsed: PropTypes.bool.isRequired,
fluentBundles: PropTypes.array.isRequired,
openQuickOpen: PropTypes.func.isRequired,
orientation: PropTypes.oneOf(["horizontal", "vertical"]).isRequired,
quickOpenEnabled: PropTypes.bool.isRequired,
selectedSource: PropTypes.object,
setActiveSearch: PropTypes.func.isRequired,
setOrientation: PropTypes.func.isRequired,
startPanelCollapsed: PropTypes.bool.isRequired,
toolboxDoc: PropTypes.object.isRequired,
};
}
getChildContext() {
return {
fluentBundles: this.props.fluentBundles,

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import { PureComponent } from "react";
import PropTypes from "prop-types";
import classnames from "classnames";
import { getDocument, toEditorLine } from "../../utils/editor";
@ -16,6 +17,17 @@ breakpointSvg.innerHTML =
'<svg viewBox="0 0 60 15" width="60" height="15"><path d="M53.07.5H1.5c-.54 0-1 .46-1 1v12c0 .54.46 1 1 1h51.57c.58 0 1.15-.26 1.53-.7l4.7-6.3-4.7-6.3c-.38-.44-.95-.7-1.53-.7z"/></svg>';
class Breakpoint extends PureComponent {
static get propTypes() {
return {
cx: PropTypes.object.isRequired,
breakpoint: PropTypes.object.isRequired,
breakpointActions: PropTypes.object.isRequired,
editor: PropTypes.object.isRequired,
editorActions: PropTypes.object.isRequired,
selectedSource: PropTypes.object,
};
}
componentDidMount() {
this.addBreakpoint(this.props);
}

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import { PureComponent } from "react";
import PropTypes from "prop-types";
import classnames from "classnames";
import { showMenu } from "../../context-menu/menu";
@ -41,6 +42,15 @@ function makeBookmark({ breakpoint }, { onClick, onContextMenu }) {
export default class ColumnBreakpoint extends PureComponent {
bookmark;
static get propTypes() {
return {
breakpointActions: PropTypes.object.isRequired,
columnBreakpoint: PropTypes.object.isRequired,
cx: PropTypes.object.isRequired,
source: PropTypes.object.isRequired,
};
}
addColumnBreakpoint = nextProps => {
const { columnBreakpoint, source } = nextProps || this.props;

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

@ -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 ColumnBreakpoint from "./ColumnBreakpoint";
@ -18,6 +19,16 @@ import { breakpointItemActions } from "./menus/breakpoints";
// eslint-disable-next-line max-len
class ColumnBreakpoints extends Component {
static get propTypes() {
return {
breakpointActions: PropTypes.object.isRequired,
columnBreakpoints: PropTypes.array.isRequired,
cx: PropTypes.object.isRequired,
editor: PropTypes.object.isRequired,
selectedSource: PropTypes.object,
};
}
render() {
const {
cx,

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

@ -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 classNames from "classnames";
import "./ConditionalPanel.css";
@ -36,6 +37,19 @@ export class ConditionalPanel extends PureComponent {
this.cbPanel = null;
}
static get propTypes() {
return {
breakpoint: PropTypes.object,
closeConditionalPanel: PropTypes.func.isRequired,
cx: PropTypes.object.isRequired,
editor: PropTypes.object.isRequired,
location: PropTypes.any.isRequired,
log: PropTypes.bool.isRequired,
openConditionalPanel: PropTypes.func.isRequired,
setBreakpointOptions: PropTypes.func.isRequired,
};
}
keepFocusOnInput() {
if (this.input) {
this.input.focus();

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import { PureComponent } from "react";
import PropTypes from "prop-types";
import {
toEditorPosition,
getDocument,
@ -29,6 +30,14 @@ function isDocumentReady(location, sourceTextContent) {
export class DebugLine extends PureComponent {
debugExpression;
static get propTypes() {
return {
location: PropTypes.object,
sourceTextContent: PropTypes.object,
why: PropTypes.object,
};
}
componentDidMount() {
const { why, location, sourceTextContent } = this.props;
this.setDebugLine(why, location, sourceTextContent);

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

@ -3,6 +3,8 @@
* 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 { showMenu } from "../../context-menu/menu";
@ -19,6 +21,13 @@ import {
import { editorMenuItems, editorItemActions } from "./menus/editor";
class EditorMenu extends Component {
static get propTypes() {
return {
clearContextMenu: PropTypes.func.isRequired,
contextMenu: PropTypes.object,
};
}
componentWillUpdate(nextProps) {
this.props.clearContextMenu();
if (nextProps.contextMenu) {

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

@ -4,10 +4,19 @@
import { connect } from "../../utils/connect";
import { Component } from "react";
import PropTypes from "prop-types";
import { getSelectedSource, getSelectedBreakableLines } from "../../selectors";
import { fromEditorLine } from "../../utils/editor";
class EmptyLines extends Component {
static get propTypes() {
return {
breakableLines: PropTypes.object.isRequired,
editor: PropTypes.object.isRequired,
selectedSource: PropTypes.object.isRequired,
};
}
componentDidMount() {
this.disableEmptyLines();
}

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import { PureComponent } from "react";
import PropTypes from "prop-types";
import { toEditorPosition, getTokenEnd } from "../../utils/editor";
@ -12,6 +13,14 @@ export default class Exception extends PureComponent {
exceptionLine;
markText;
static get propTypes() {
return {
exception: PropTypes.object.isRequired,
doc: PropTypes.object.isRequired,
selectedSourceId: PropTypes.string.isRequired,
};
}
componentDidMount() {
this.addEditorExceptionLine();
}

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

@ -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 Exception from "./Exception";
@ -14,6 +15,13 @@ import {
import { getDocument } from "../../utils/editor";
class Exceptions extends Component {
static get propTypes() {
return {
exceptions: PropTypes.array.isRequired,
selectedSource: PropTypes.object.isRequired,
};
}
render() {
const { exceptions, selectedSource } = this.props;

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

@ -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 classnames from "classnames";
import actions from "../../actions";
@ -30,6 +31,22 @@ class SourceFooter extends PureComponent {
this.state = { cursorPosition: { line: 0, column: 0 } };
}
static get propTypes() {
return {
canPrettyPrint: PropTypes.bool.isRequired,
cx: PropTypes.object.isRequired,
endPanelCollapsed: PropTypes.bool.isRequired,
horizontal: PropTypes.bool.isRequired,
jumpToMappedLocation: PropTypes.func.isRequired,
mappedSource: PropTypes.object,
selectedSource: PropTypes.object,
sourceLoaded: PropTypes.bool.isRequired,
toggleBlackBox: PropTypes.func.isRequired,
togglePaneCollapse: PropTypes.func.isRequired,
togglePrettyPrint: PropTypes.func.isRequired,
};
}
componentDidUpdate() {
const eventDoc = document.querySelector(".editor-mount .CodeMirror");
// querySelector can return null

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

@ -61,7 +61,7 @@ class LayoutApp extends PureComponent {
onSetFlexboxOverlayColor: PropTypes.func.isRequired,
onSetGridOverlayColor: PropTypes.func.isRequired,
onShowBoxModelEditor: PropTypes.func.isRequired,
onShowGridOutlineHighlight: PropTypes.func.isRequired,
onShowGridOutlineHighlight: PropTypes.func,
onToggleGeometryEditor: PropTypes.func.isRequired,
onToggleGridHighlighter: PropTypes.func.isRequired,
onToggleShowGridAreas: PropTypes.func.isRequired,

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

@ -483,7 +483,7 @@ class Tree extends Component {
style: PropTypes.object,
// Prevents blur when Tree loses focus
preventBlur: PropTypes.bool,
initiallyExpanded: PropTypes.bool,
initiallyExpanded: PropTypes.func,
};
}

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

@ -25,7 +25,7 @@ class SplitBox extends Component {
// Custom class name. You can use more names separated by a space.
className: PropTypes.string,
// Initial size of controlled panel.
initialSize: PropTypes.string,
initialSize: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
// Initial width of controlled panel.
initialWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
// Initial height of controlled panel.