mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-30 21:38:11 +08:00
Add linting rules around ESLint directive comments (#1551)
* add eslint-plugin-eslint-comments and require descriptive configuration https://eslint.org/docs/user-guide/configuring#using-configuration-comments * update ESLint * audit ESLint disables * update ESLint and related dependencies
This commit is contained in:
@@ -151,11 +151,10 @@ class Camera {
|
||||
let viewChanged = false;
|
||||
switch (e.type) {
|
||||
case "mousemove": {
|
||||
/* eslint-disable no-bitwise */
|
||||
/* eslint-disable-next-line no-bitwise --- MouseEvent.buttons exposes a bitmask, best acted on with bitops */
|
||||
if (e.buttons & 0x1) {
|
||||
viewChanged = this.mousePan(e, projectionTF);
|
||||
}
|
||||
/* eslint-enable no-bitwise */
|
||||
this.flush(e);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* eslint-disable max-classes-per-file */
|
||||
/* eslint-disable max-classes-per-file -- Classes are interrelated*/
|
||||
/**
|
||||
Label indexing - map a label to & from an integer offset. See Dataframe
|
||||
for how this is used.
|
||||
@@ -11,7 +11,7 @@ Private utility functions
|
||||
*/
|
||||
function extent(tarr) {
|
||||
let min = 0x7fffffff;
|
||||
let max = ~min; // eslint-disable-line no-bitwise
|
||||
let max = ~min; // eslint-disable-line no-bitwise -- Establishes 0 of same size
|
||||
for (let i = 0, l = tarr.length; i < l; i += 1) {
|
||||
const v = tarr[i];
|
||||
if (v < min) {
|
||||
@@ -41,25 +41,22 @@ class IdentityInt32Index {
|
||||
return k;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
/* eslint-disable class-methods-use-this -- having these accessors as class methods allows for polymorphism */
|
||||
getOffset(i) {
|
||||
// label to offset
|
||||
return i;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
getOffsets(arr) {
|
||||
// labels to offsets
|
||||
return arr;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
getLabel(i) {
|
||||
// offset to label
|
||||
return i;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
getLabels(arr) {
|
||||
// offsets to labels
|
||||
return arr;
|
||||
@@ -68,6 +65,7 @@ class IdentityInt32Index {
|
||||
size() {
|
||||
return this.maxOffset;
|
||||
}
|
||||
/* eslint-enable class-methods-use-this -- enable */
|
||||
|
||||
__promote(labelArray) {
|
||||
/*
|
||||
@@ -215,7 +213,6 @@ class DenseInt32Index {
|
||||
return this.__promote(labels);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
isubset(offsets) {
|
||||
/* validate subset */
|
||||
const { rindex } = this;
|
||||
@@ -317,7 +314,6 @@ class KeyIndex {
|
||||
return new KeyIndex(labels);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
isubset(offsets) {
|
||||
const { rindex } = this;
|
||||
const maxOffset = rindex.length;
|
||||
@@ -347,7 +343,6 @@ class KeyIndex {
|
||||
return new KeyIndex(labelArray);
|
||||
}
|
||||
}
|
||||
/* eslint-enable class-methods-use-this */
|
||||
|
||||
function isLabelIndex(i) {
|
||||
return (
|
||||
@@ -358,3 +353,4 @@ function isLabelIndex(i) {
|
||||
}
|
||||
|
||||
export { DenseInt32Index, IdentityInt32Index, KeyIndex, isLabelIndex };
|
||||
/* eslint-enable max-classes-per-file -- enable*/
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// jshint esversion: 6
|
||||
/* eslint no-bitwise: "off" */
|
||||
/* eslint-disable no-bitwise -- crossfilter relies on bitwise ops */
|
||||
|
||||
// BitArray is a 2D bitarray with size [length, nBitWidth].
|
||||
// Each bit is referred to as a `dimension`. Dimensions may be
|
||||
@@ -291,3 +290,4 @@ class BitArray {
|
||||
}
|
||||
|
||||
export default BitArray;
|
||||
/* eslint-enable no-bitwise -- enable */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// eslint-disable-next-line max-classes-per-file
|
||||
// eslint-disable-next-line max-classes-per-file -- classes are interrelated
|
||||
import PositiveIntervals from "./positiveIntervals";
|
||||
import BitArray from "./bitArray";
|
||||
import {
|
||||
@@ -408,7 +408,7 @@ class ImmutableScalarDimension extends _ImmutableBaseDimension {
|
||||
this.index = makeSortIndex(array);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
// eslint-disable-next-line class-methods-use-this -- needed for polymorphism
|
||||
_createValueArray(data, mapf, array) {
|
||||
// create dimension value array
|
||||
const len = data.length;
|
||||
@@ -512,7 +512,7 @@ class ImmutableEnumDimension extends ImmutableScalarDimension {
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
// eslint-disable-next-line class-methods-use-this -- enables polymorphism
|
||||
selectRange() {
|
||||
throw new Error("range selection unsupported on Enumerated dimension");
|
||||
}
|
||||
|
||||
@@ -30,7 +30,8 @@ class PositiveIntervals {
|
||||
res.push(copy[i]);
|
||||
} else if (copy[i][1] > res[res.length - 1][1]) {
|
||||
// merge this into previous
|
||||
res[res.length - 1][1] = copy[i][1]; // eslint-disable-line prefer-destructuring
|
||||
// eslint-disable-line prefer-destructuring -- destructuring impedes readability
|
||||
res[res.length - 1][1] = copy[i][1];
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { isTypedArray, isFpTypedArray } from "../typeHelpers";
|
||||
|
||||
/* eslint no-bitwise: "off" */
|
||||
/* eslint-disable no-bitwise -- code relies on bitwise ops */
|
||||
|
||||
/*
|
||||
** fast sort and search, with separate code paths for floats (NaN ordering),
|
||||
@@ -426,3 +426,4 @@ export function binarySearch(valueArray, value, first, last) {
|
||||
if (index !== last && value === valueArray[index]) return index;
|
||||
return last;
|
||||
}
|
||||
/* eslint-enable no-bitwise -- enable */
|
||||
|
||||
Reference in New Issue
Block a user