[WIP] JS lint and dead code removal (#1053)

* lint and dead code removal

* fix regressions
This commit is contained in:
Bruce Martin
2019-11-21 14:10:02 -08:00
committed by GitHub
parent 9a540a4f0a
commit ee62dd355f
16 changed files with 118 additions and 155 deletions
@@ -83,7 +83,7 @@ class Categories extends React.Component {
categoryNameErrorMessage = name => {
const err = this.categoryNameError(name);
if (err == "duplicate") {
if (err === "duplicate") {
return (
<span>
<span style={{ fontStyle: "italic" }}>{name}</span> already exists -
@@ -91,7 +91,7 @@ class Categories extends React.Component {
</span>
);
}
if (err == "characters") {
if (err === "characters") {
return (
<span>
<span style={{ fontStyle: "italic" }}>{name}</span> contains illegal
@@ -149,7 +149,7 @@ class Category extends React.Component {
or return an error type.
*/
const { metadataField, universe } = this.props;
const obsByName = universe.schema.annotations.obsByName;
const { obsByName } = universe.schema.annotations;
if (obsByName[metadataField].categories.indexOf(name) !== -1) {
return "duplicate";
@@ -165,7 +165,7 @@ class Category extends React.Component {
labelNameErrorMessage = name => {
const { metadataField } = this.props;
const err = this.labelNameError(name);
if (err == "duplicate") {
if (err === "duplicate") {
return (
<span>
<span style={{ fontStyle: "italic" }}>{name}</span> already exists
@@ -174,7 +174,7 @@ class Category extends React.Component {
</span>
);
}
if (err == "characters") {
if (err === "characters") {
return (
<span>
<span style={{ fontStyle: "italic" }}>{name}</span> contains illegal
@@ -242,8 +242,7 @@ class Category extends React.Component {
colorAccessor,
categoricalSelection,
isUserAnno,
annotations,
universe
annotations
} = this.props;
const { isTruncated } = categoricalSelection[metadataField];
@@ -288,7 +287,6 @@ class Category extends React.Component {
type="checkbox"
/>
<span className="bp3-control-indicator" />
{""}
</label>
<span
data-testid={`category-expand-${metadataField}`}
@@ -144,7 +144,9 @@ class Occupancy extends React.Component {
categoryIndex
} = this.props;
this.canvas?.getContext("2d").clearRect(0, 0, this._WIDTH, this._HEIGHT);
const { canvas } = this;
if (canvas)
canvas.getContext("2d").clearRect(0, 0, this._WIDTH, this._HEIGHT);
const colorByIsCatagoricalData = !!categoricalSelection[colorAccessor];
+2 -3
View File
@@ -9,13 +9,12 @@ import {
MenuItem,
Popover,
Position,
Icon,
PopoverInteractionKind
PopoverInteractionKind,
Tooltip
} from "@blueprintjs/core";
import Occupancy from "./occupancy";
import * as globals from "../../globals";
import styles from "./categorical.css";
import { Tooltip } from "@blueprintjs/core";
import { AnnotationsHelpers } from "../../util/stateManager";