mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 05:10:49 +00:00
Bug 1471540 - Make DevTools code compatible with new eslint-plugin-react;r=standard8
MozReview-Commit-ID: 1flBkghZw9 --HG-- extra : rebase_source : 1ed58c60690e9f1b227b8de3c78b05ae98672230
This commit is contained in:
parent
032970b913
commit
6a52365e86
@ -200,6 +200,7 @@ module.exports = {
|
||||
"react/prop-types": "error",
|
||||
"react/sort-comp": ["error", {
|
||||
order: [
|
||||
"static-methods",
|
||||
"lifecycle",
|
||||
"everything-else",
|
||||
"render"
|
||||
|
@ -55,7 +55,21 @@ const { app: appModel } = require("./models");
|
||||
|
||||
class MemoryApp extends Component {
|
||||
static get propTypes() {
|
||||
return appModel;
|
||||
return {
|
||||
allocations: appModel.allocations,
|
||||
censusDisplay: appModel.censusDisplay,
|
||||
diffing: appModel.diffing,
|
||||
dispatch: appModel.dispatch,
|
||||
filter: appModel.filter,
|
||||
front: appModel.front,
|
||||
heapWorker: appModel.heapWorker,
|
||||
individuals: appModel.individuals,
|
||||
labelDisplay: appModel.labelDisplay,
|
||||
sizes: appModel.sizes,
|
||||
snapshots: appModel.snapshots,
|
||||
toolbox: appModel.toolbox,
|
||||
view: appModel.view,
|
||||
};
|
||||
}
|
||||
|
||||
static get childContextTypes() {
|
||||
|
@ -134,51 +134,6 @@ define(function(require, exports, module) {
|
||||
return defaultProps;
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
expandedNodes: props.expandedNodes,
|
||||
columns: ensureDefaultColumn(props.columns),
|
||||
selected: props.selected,
|
||||
lastSelectedIndex: 0
|
||||
};
|
||||
|
||||
this.toggle = this.toggle.bind(this);
|
||||
this.isExpanded = this.isExpanded.bind(this);
|
||||
this.onKeyDown = this.onKeyDown.bind(this);
|
||||
this.onClickRow = this.onClickRow.bind(this);
|
||||
this.getSelectedRow = this.getSelectedRow.bind(this);
|
||||
this.selectRow = this.selectRow.bind(this);
|
||||
this.isSelected = this.isSelected.bind(this);
|
||||
this.onFilter = this.onFilter.bind(this);
|
||||
this.onSort = this.onSort.bind(this);
|
||||
this.getMembers = this.getMembers.bind(this);
|
||||
this.renderRows = this.renderRows.bind(this);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { expandedNodes, selected } = nextProps;
|
||||
const state = {
|
||||
expandedNodes,
|
||||
lastSelectedIndex: this.getSelectedRowIndex()
|
||||
};
|
||||
|
||||
if (selected) {
|
||||
state.selected = selected;
|
||||
}
|
||||
|
||||
this.setState(Object.assign({}, this.state, state));
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
const selected = this.getSelectedRow();
|
||||
if (!selected && this.rows.length > 0) {
|
||||
this.selectRow(this.rows[
|
||||
Math.min(this.state.lastSelectedIndex, this.rows.length - 1)]);
|
||||
}
|
||||
}
|
||||
|
||||
static subPath(path, subKey) {
|
||||
return path + "/" + String(subKey).replace(/[\\/]/g, "\\$&");
|
||||
}
|
||||
@ -226,6 +181,51 @@ define(function(require, exports, module) {
|
||||
return expandedNodes;
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
expandedNodes: props.expandedNodes,
|
||||
columns: ensureDefaultColumn(props.columns),
|
||||
selected: props.selected,
|
||||
lastSelectedIndex: 0
|
||||
};
|
||||
|
||||
this.toggle = this.toggle.bind(this);
|
||||
this.isExpanded = this.isExpanded.bind(this);
|
||||
this.onKeyDown = this.onKeyDown.bind(this);
|
||||
this.onClickRow = this.onClickRow.bind(this);
|
||||
this.getSelectedRow = this.getSelectedRow.bind(this);
|
||||
this.selectRow = this.selectRow.bind(this);
|
||||
this.isSelected = this.isSelected.bind(this);
|
||||
this.onFilter = this.onFilter.bind(this);
|
||||
this.onSort = this.onSort.bind(this);
|
||||
this.getMembers = this.getMembers.bind(this);
|
||||
this.renderRows = this.renderRows.bind(this);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { expandedNodes, selected } = nextProps;
|
||||
const state = {
|
||||
expandedNodes,
|
||||
lastSelectedIndex: this.getSelectedRowIndex()
|
||||
};
|
||||
|
||||
if (selected) {
|
||||
state.selected = selected;
|
||||
}
|
||||
|
||||
this.setState(Object.assign({}, this.state, state));
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
const selected = this.getSelectedRow();
|
||||
if (!selected && this.rows.length > 0) {
|
||||
this.selectRow(this.rows[
|
||||
Math.min(this.state.lastSelectedIndex, this.rows.length - 1)]);
|
||||
}
|
||||
}
|
||||
|
||||
// Node expand/collapse
|
||||
|
||||
toggle(nodePath) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user