Added @typescript-eslint/recommended config with suppressions (#2345)

* Disabled @blueprintjs/classes-constants. #2288.

* thuang-eslint-bp-off (#2344)

* Disabled @blueprintjs/classes-constants on webpack dev and shared. #2288.

* Added TS recommended, suppress lint errors codemod.

* Added per-error/warning ignore for tests.

* Added per-error/warning ignore for configuration.

* Added per-error/warning ignore for src. Removed suppress package.

* Minor linting.

Co-authored-by: Timmy Huang <tihuan@users.noreply.github.com>
This commit is contained in:
Mim Hastie
2021-07-28 16:06:34 -07:00
committed by GitHub
co-authored by Timmy Huang
parent 32f60a1547
commit 27575b8d86
163 changed files with 1827 additions and 64 deletions
+1
View File
@@ -2,6 +2,7 @@
Reducer for the annoMatrix
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
const AnnoMatrix = (state = null, action: any) => {
if (action.annoMatrix) {
return action.annoMatrix;
+2
View File
@@ -1,6 +1,7 @@
/*
Reducers for annotation UI-state.
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
const Annotations = (
state = {
/*
@@ -28,6 +29,7 @@ const Annotations = (
labelEditable: { category: null, label: null },
promptForFilename: true,
},
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
action: any
) => {
switch (action.type) {
+3
View File
@@ -1,3 +1,4 @@
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
const Autosave = (
state = {
// cell labels
@@ -11,7 +12,9 @@ const Autosave = (
// error state
error: false,
},
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
action: any,
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
nextSharedState: any
) => {
switch (action.type) {
+2
View File
@@ -1,3 +1,4 @@
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
export default function cascadeReducers(arg: any) {
/*
Combine a set of cascading reducers into a single reducer. Cascading
@@ -23,6 +24,7 @@ export default function cascadeReducers(arg: any) {
*/
const reducers = arg instanceof Map ? arg : new Map(arg);
const reducerKeys = [...reducers.keys()];
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
return (prevState: any, action: any) => {
const nextState = {};
let stateChange = false;
@@ -11,9 +11,13 @@ Label state default (if missing) is up to the component, but typically true.
...
}
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
const CategoricalSelection = (
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
state: any,
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
action: any,
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
nextSharedState: any
) => {
switch (action.type) {
+3
View File
@@ -2,9 +2,12 @@ const initialState = {
showLabels: false,
};
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
const centroidLabels = (
state = initialState,
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
action: any,
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
sharedNextState: any
) => {
const {
+2
View File
@@ -2,11 +2,13 @@
Color By UI state
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
const ColorsReducer = (
state = {
colorMode: null /* by continuous, by expression */,
colorAccessor: null /* tissue, Apod */,
},
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
action: any
) => {
switch (action.type) {
+2
View File
@@ -1,9 +1,11 @@
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
const Config = (
state = {
displayNames: null,
features: null,
parameters: null,
},
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
action: any
) => {
switch (action.type) {
@@ -1,5 +1,6 @@
import { makeContinuousDimensionName } from "../util/nameCreators";
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
const ContinuousSelection = (state = {}, action: any) => {
switch (action.type) {
case "reset subset":
+2
View File
@@ -1,6 +1,7 @@
import uniq from "lodash.uniq";
import filter from "lodash.filter";
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
const Controls = (
state = {
// data loading flag
@@ -20,6 +21,7 @@ const Controls = (
datasetDrawer: false,
},
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
action: any
) => {
/*
+2
View File
@@ -1,3 +1,4 @@
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
const Differential = (
state = {
loading: null,
@@ -5,6 +6,7 @@ const Differential = (
celllist1: null,
celllist2: null,
},
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
action: any
) => {
switch (action.type) {
+3
View File
@@ -24,12 +24,14 @@
*/
import { diffexpPopNamePrefix1, diffexpPopNamePrefix2 } from "../globals";
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
const GeneSets = (
state = {
initialized: false,
lastTid: undefined,
genesets: new Map(),
},
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
action: any
) => {
switch (action.type) {
@@ -375,6 +377,7 @@ const GeneSets = (
const diffExpGeneSets = [];
for (const polarity of Object.keys(genesetNames)) {
const genes = new Map(
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
data[polarity].map((diffExpGene: any) => [
diffExpGene[0],
{
+2
View File
@@ -1,12 +1,14 @@
/*
Reducers for geneset UI-state.
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
const GeneSetsUI = (
state = {
createGenesetModeActive: false,
isEditingGenesetName: false,
isAddingGenesToGeneset: false,
},
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
action: any
) => {
switch (action.type) {
+2
View File
@@ -1,8 +1,10 @@
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
const GraphSelection = (
state = {
tool: "lasso", // what selection tool mode (lasso, brush, ...)
selection: { mode: "all" }, // current selection, which is tool specific
},
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
action: any
) => {
switch (action.type) {
+6
View File
@@ -7,6 +7,7 @@ about commonly used names. Preferentially, pick in the following order:
3. "pca"
4. give up, use the first available
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
function bestDefaultLayout(layouts: any) {
const preferredNames = ["umap", "tsne", "pca"];
const idx = preferredNames.findIndex((name) => layouts.indexOf(name) !== -1);
@@ -14,20 +15,25 @@ function bestDefaultLayout(layouts: any) {
return layouts[0];
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
function setToDefaultLayout(schema: any) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
const available = schema.layout.obs.map((v: any) => v.name).sort();
const current = bestDefaultLayout(available);
const currentDimNames = schema.layout.obsByName[current].dims;
return { available, current, currentDimNames };
}
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
const LayoutChoice = (
state = {
available: [], // all available choices
current: undefined, // name of the current layout, eg, 'umap'
currentDimNames: [], // dimension name
},
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
action: any,
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
nextSharedState: any
) => {
switch (action.type) {
+1
View File
@@ -2,6 +2,7 @@
Reducer for the obsCrossfilter
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
const ObsCrossfilter = (state = null, action: any) => {
if (action.obsCrossfilter) {
return action.obsCrossfilter;
+1
View File
@@ -3,6 +3,7 @@ const initialState = {
categoryField: "",
};
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
const pointDialation = (state = initialState, action: any) => {
const { metadataField, label: categoryField } = action;
+12
View File
@@ -61,6 +61,7 @@ const filterActionKey = `${historyKeyPrefix}filterAction`;
const pendingKey = `${historyKeyPrefix}pending`;
const defaultHistoryLimit = -100;
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
const Undoable = (reducer: any, undoableKeys: any, options = {}) => {
// @ts-expect-error ts-migrate(2339) FIXME: Property 'debug' does not exist on type '{}'.
const { debug } = options;
@@ -69,6 +70,7 @@ const Undoable = (reducer: any, undoableKeys: any, options = {}) => {
if (!historyLimit) historyLimit = defaultHistoryLimit;
if (historyLimit > 0) historyLimit = -historyLimit;
const actionFilter =
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
(options as any).actionFilter || (() => ({ [filterActionKey]: "save" }));
if (!Array.isArray(undoableKeys) || undoableKeys.length === 0)
@@ -78,6 +80,7 @@ const Undoable = (reducer: any, undoableKeys: any, options = {}) => {
/*
Undo the current to previous history
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
function undo(currentState: any) {
const past = currentState[pastKey];
const future = currentState[futureKey];
@@ -101,6 +104,7 @@ const Undoable = (reducer: any, undoableKeys: any, options = {}) => {
/*
Replay future, previously undone.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
function redo(currentState: any) {
const past = currentState[pastKey] || [];
const future = currentState[futureKey] || [];
@@ -124,6 +128,7 @@ const Undoable = (reducer: any, undoableKeys: any, options = {}) => {
/*
Clear the history state. No side-effects on current state.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
function clear(currentState: any) {
return {
...currentState,
@@ -137,6 +142,7 @@ const Undoable = (reducer: any, undoableKeys: any, options = {}) => {
/*
Reduce current action, with no history side-effects
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
function skip(currentState: any, action: any, filterState: any) {
const past = currentState[pastKey] || [];
const future = currentState[futureKey] || [];
@@ -154,6 +160,7 @@ const Undoable = (reducer: any, undoableKeys: any, options = {}) => {
/*
Save current state in the history, then reduce action.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
function save(currentState: any, action: any, filterState: any) {
const past = currentState[pastKey] || [];
const currentUndoableState = Object.entries(currentState).filter((kv) =>
@@ -174,6 +181,7 @@ const Undoable = (reducer: any, undoableKeys: any, options = {}) => {
/*
Save current state as pending history change. No other side effects.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
function stashPending(currentState: any) {
const currentUndoableState = Object.entries(currentState).filter((kv) =>
undoableKeysSet.has(kv[0])
@@ -187,6 +195,7 @@ const Undoable = (reducer: any, undoableKeys: any, options = {}) => {
/*
Cancel pending history state change. No other side effects.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
function cancelPending(currentState: any) {
return {
...currentState,
@@ -197,6 +206,7 @@ const Undoable = (reducer: any, undoableKeys: any, options = {}) => {
/*
Push pending state onto the history stack
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
function applyPending(currentState: any) {
const past = currentState[pastKey] || [];
const pendingState = currentState[pendingKey];
@@ -217,6 +227,7 @@ const Undoable = (reducer: any, undoableKeys: any, options = {}) => {
[filterStateKey]: {},
[pendingKey]: null,
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
action: any
) => {
if (debug > 1) console.log("---- ACTION", action.type);
@@ -277,6 +288,7 @@ const Undoable = (reducer: any, undoableKeys: any, options = {}) => {
};
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
function push(arr: any, val: any, limit = undefined) {
/*
functional array push, with a max length limit to the new array.
+8
View File
@@ -125,6 +125,7 @@ See graph definition for the transitions that use each.
Signature: (fsm, transition, reducerState, reducerAction) => undoableAction
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
const stashPending = (fsm: any) => ({
[actionKey]: "stashPending",
[stateKey]: { fsm },
@@ -155,6 +156,7 @@ StateMachine when it doesn't know what to do.
Signature: (fsm, event, from) => undoableAction
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
const onFsmError = (fsm: any, event: any, from: any) => {
console.error(`FSM error [event: "${event}", state: "${from}"]`, fsm);
// In production, try to recover gracefully if we have unexpected state
@@ -183,9 +185,13 @@ Basic approach:
* only implement complex state machines where absolutely required (eg,
multi-event selection and the like)
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
const actionFilter = (debug: any) => (
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
state: any,
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
action: any,
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
prevFilterState: any
) => {
const actionType = action.type;
@@ -233,6 +239,7 @@ return true if objA and objB are ===, OR if:
- have same own properties
- all values are strict equal (===)
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
function shallowObjectEq(objA: any, objB: any) {
if (objA === objB) return true;
if (!objA || !objB) return false;
@@ -245,6 +252,7 @@ function shallowObjectEq(objA: any, objB: any) {
return true if arrA and arrB contain the same strict-equal values,
in the same order.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
function shallowArrayEq(arrA: any, arrB: any) {
if (arrA.length !== arrB.length) return false;
for (let i = 0, l = arrA.length; i < l; i += 1) {
+9
View File
@@ -18,13 +18,20 @@ b) compound actions that should be collapsed into a single history change.
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
const createFsmTransitions = (
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
stashPending: any,
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
cancelPending: any,
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
applyPending: any,
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
skip: any,
// @ts-expect-error ts-migrate(6133) FIXME: 'clear' is declared but its value is never read.
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
clear: any,
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
save: any
) => {
return [
@@ -47,6 +54,7 @@ const createFsmTransitions = (
to: "done",
/* if current selection is all, cancelPending. Else, applyPending */
// @ts-expect-error ts-migrate(6133) FIXME: 'fsm' is declared but its value is never read.
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
action: (fsm: any, transition: any, data: any) =>
data.state.graphSelection.selection.mode === "all"
? cancelPending()
@@ -78,6 +86,7 @@ const createFsmTransitions = (
to: "done",
/* if current selection is all, cancelPending. Else, applyPending */
// @ts-expect-error ts-migrate(6133) FIXME: 'fsm' is declared but its value is never read.
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
action: (fsm: any, transition: any, data: any) =>
data.state.graphSelection.selection.mode === "all"
? cancelPending()
+1
View File
@@ -1,3 +1,4 @@
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
const UserInfo = (state = {}, action: any) => {
switch (action.type) {
case "initial data load start":