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
+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.