diff --git a/configs/eslint-config-compass/index.js b/configs/eslint-config-compass/index.js
index a117a1abbe7..56214a4e42b 100644
--- a/configs/eslint-config-compass/index.js
+++ b/configs/eslint-config-compass/index.js
@@ -6,9 +6,7 @@ const common = require('@mongodb-js/eslint-config-devtools/common');
const chaiFriendly = require('eslint-plugin-chai-friendly');
// TODO(COMPASS-9459): disabling a bunch of new rules to unblock automatic updates
-const tempNewEslintRulesDisabled = {
- '@typescript-eslint/no-unsafe-enum-comparison': 'off',
-};
+const tempNewEslintRulesDisabled = {};
const extraTsRules = {
// Newly converted plugins use `any` quite a lot, we can't enable the rule,
diff --git a/packages/compass-aggregations/src/modules/search-indexes.ts b/packages/compass-aggregations/src/modules/search-indexes.ts
index e25cf00b0aa..7d23a54c89a 100644
--- a/packages/compass-aggregations/src/modules/search-indexes.ts
+++ b/packages/compass-aggregations/src/modules/search-indexes.ts
@@ -4,7 +4,7 @@ import type { SearchIndex } from 'mongodb-data-service';
import { isAction } from '../utils/is-action';
// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
-enum SearchIndexesStatuses {
+export enum SearchIndexesStatuses {
INITIAL = 'INITIAL',
LOADING = 'LOADING',
READY = 'READY',
@@ -41,7 +41,7 @@ export type SearchIndexesAction =
type State = {
isSearchIndexesSupported: boolean;
indexes: SearchIndex[];
- status: SearchIndexesStatus;
+ status: SearchIndexesStatuses;
};
export const INITIAL_STATE: State = {
diff --git a/packages/compass-global-writes/src/components/index.spec.tsx b/packages/compass-global-writes/src/components/index.spec.tsx
index c5ab3f89791..4e5c6f94418 100644
--- a/packages/compass-global-writes/src/components/index.spec.tsx
+++ b/packages/compass-global-writes/src/components/index.spec.tsx
@@ -3,20 +3,27 @@ import { expect } from 'chai';
import { screen } from '@mongodb-js/testing-library-compass';
import { GlobalWrites } from './index';
import { renderWithStore } from './../../tests/create-store';
+import { ShardingStatuses } from '../store/reducer';
describe('Compass GlobalWrites Plugin', function () {
it('renders plugin in NOT_READY state', async function () {
- await renderWithStore();
+ await renderWithStore(
+
+ );
expect(screen.getByText(/loading/i)).to.exist;
});
it('renders plugin in UNSHARDED state', async function () {
- await renderWithStore();
+ await renderWithStore(
+
+ );
expect(screen.getByTestId('shard-collection-button')).to.exist;
});
it('renders plugin in SHARDING state', async function () {
- await renderWithStore();
+ await renderWithStore(
+
+ );
expect(screen.getByText(/sharding your collection/i)).to.exist;
});
});
diff --git a/packages/compass-global-writes/src/components/index.tsx b/packages/compass-global-writes/src/components/index.tsx
index 4a62e749417..73bb4a85cdc 100644
--- a/packages/compass-global-writes/src/components/index.tsx
+++ b/packages/compass-global-writes/src/components/index.tsx
@@ -7,7 +7,7 @@ import {
SpinLoaderWithLabel,
ConfirmationModalArea,
} from '@mongodb-js/compass-components';
-import type { RootState, ShardingStatus } from '../store/reducer';
+import type { RootState } from '../store/reducer';
import { ShardingStatuses } from '../store/reducer';
import UnshardedState from './states/unsharded';
import ShardingState from './states/sharding';
@@ -36,13 +36,13 @@ const loaderStyles = css({
});
type GlobalWritesProps = {
- shardingStatus: ShardingStatus;
+ shardingStatus: ShardingStatuses;
};
function ShardingStateView({
shardingStatus,
}: {
- shardingStatus: Exclude;
+ shardingStatus: Exclude;
}) {
if (shardingStatus === ShardingStatuses.UNSHARDED) {
return ;
@@ -72,7 +72,7 @@ function ShardingStateView({
return ;
}
- if (shardingStatus === String(ShardingStatuses.LOADING_ERROR)) {
+ if (shardingStatus === ShardingStatuses.LOADING_ERROR) {
return ;
}
diff --git a/packages/compass-indexes/src/components/indexes/indexes.spec.tsx b/packages/compass-indexes/src/components/indexes/indexes.spec.tsx
index 050c346e09a..1310fdd4851 100644
--- a/packages/compass-indexes/src/components/indexes/indexes.spec.tsx
+++ b/packages/compass-indexes/src/components/indexes/indexes.spec.tsx
@@ -23,6 +23,7 @@ import type { RootState } from '../../modules';
import type { Document } from 'mongodb';
import { CompassExperimentationProvider } from '@mongodb-js/compass-telemetry';
import { ExperimentTestGroup } from '@mongodb-js/compass-telemetry/provider';
+import { FetchStatuses } from '../../utils/fetch-status';
const renderIndexes = async (
options: Partial = {},
@@ -82,7 +83,7 @@ describe('Indexes Component', function () {
regularIndexes: {
indexes: [],
error: 'Some random error',
- status: 'ERROR',
+ status: FetchStatuses.ERROR,
inProgressIndexes: [],
},
});
@@ -124,7 +125,7 @@ describe('Indexes Component', function () {
await renderIndexes(undefined, undefined, {
indexView: 'regular-indexes',
regularIndexes: {
- status: 'NOT_READY',
+ status: FetchStatuses.NOT_READY,
inProgressIndexes: [],
indexes: [],
},
@@ -161,7 +162,7 @@ describe('Indexes Component', function () {
},
] as RegularIndex[],
error: undefined,
- status: 'READY',
+ status: FetchStatuses.READY,
inProgressIndexes: [],
},
});
@@ -211,7 +212,7 @@ describe('Indexes Component', function () {
},
],
error: undefined,
- status: 'READY',
+ status: FetchStatuses.READY,
},
});
@@ -269,7 +270,7 @@ describe('Indexes Component', function () {
},
],
error: undefined,
- status: 'READY',
+ status: FetchStatuses.READY,
},
});
diff --git a/packages/compass-indexes/src/components/indexes/indexes.tsx b/packages/compass-indexes/src/components/indexes/indexes.tsx
index 987d9859003..68adce4be02 100644
--- a/packages/compass-indexes/src/components/indexes/indexes.tsx
+++ b/packages/compass-indexes/src/components/indexes/indexes.tsx
@@ -25,7 +25,6 @@ import { VIEW_PIPELINE_UTILS } from '@mongodb-js/mongodb-constants';
import type { State as RegularIndexesState } from '../../modules/regular-indexes';
import type { State as SearchIndexesState } from '../../modules/search-indexes';
import { FetchStatuses } from '../../utils/fetch-status';
-import type { FetchStatus } from '../../utils/fetch-status';
import type { RootState } from '../../modules';
import {
CreateSearchIndexModal,
@@ -174,7 +173,7 @@ type IndexesProps = {
collectionStats: CollectionStats;
};
-function isRefreshingStatus(status: FetchStatus) {
+function isRefreshingStatus(status: FetchStatuses) {
return (
status === FetchStatuses.FETCHING || status === FetchStatuses.REFRESHING
);
diff --git a/packages/compass-indexes/src/components/search-indexes-table/search-indexes-table.spec.tsx b/packages/compass-indexes/src/components/search-indexes-table/search-indexes-table.spec.tsx
index d5954e7b8c5..f8e70aff1bb 100644
--- a/packages/compass-indexes/src/components/search-indexes-table/search-indexes-table.spec.tsx
+++ b/packages/compass-indexes/src/components/search-indexes-table/search-indexes-table.spec.tsx
@@ -26,7 +26,7 @@ const renderIndexList = (
void;
onEditIndexClick: (name: string) => void;
onOpenCreateModalClick: () => void;
@@ -56,7 +55,7 @@ type SearchIndexesTableProps = {
onSearchIndexesClosed: (tabId: string) => void;
};
-function isReadyStatus(status: FetchStatus) {
+function isReadyStatus(status: FetchStatuses) {
return (
status === FetchStatuses.READY ||
status === FetchStatuses.REFRESHING ||
diff --git a/packages/compass-indexes/src/modules/regular-indexes.ts b/packages/compass-indexes/src/modules/regular-indexes.ts
index a357f824eea..1a9e3e8704e 100644
--- a/packages/compass-indexes/src/modules/regular-indexes.ts
+++ b/packages/compass-indexes/src/modules/regular-indexes.ts
@@ -7,9 +7,7 @@ import {
} from '@mongodb-js/compass-components';
import { FetchStatuses, NOT_FETCHABLE_STATUSES } from '../utils/fetch-status';
-import type { FetchStatus } from '../utils/fetch-status';
import { FetchReasons } from '../utils/fetch-reason';
-import type { FetchReason } from '../utils/fetch-reason';
import { isAction } from '../utils/is-action';
import type { CreateIndexSpec } from './create-index';
import type { IndexesThunkAction, RootState } from '.';
@@ -131,7 +129,7 @@ type IndexesClosedAction = {
type FetchIndexesStartedAction = {
type: ActionTypes.FetchIndexesStarted;
- reason: FetchReason;
+ reason: FetchReasons;
};
type FetchIndexesSucceededAction = {
@@ -172,7 +170,7 @@ type RollingIndexTimeoutCheckAction = {
};
export type State = {
- status: FetchStatus;
+ status: FetchStatuses;
indexes: RegularIndex[];
inProgressIndexes: InProgressIndex[];
rollingIndexes?: RollingIndex[];
@@ -347,7 +345,7 @@ export default function reducer(
}
const fetchIndexesStarted = (
- reason: FetchReason
+ reason: FetchReasons
): FetchIndexesStartedAction => ({
type: ActionTypes.FetchIndexesStarted,
reason,
@@ -381,7 +379,7 @@ function pickCollectionStatFields(state: RootState) {
}
const fetchIndexes = (
- reason: FetchReason
+ reason: FetchReasons
): IndexesThunkAction, FetchIndexesActions> => {
return async (
dispatch,
diff --git a/packages/compass-indexes/src/modules/search-indexes.ts b/packages/compass-indexes/src/modules/search-indexes.ts
index e1c867229d7..dad0994ccd3 100644
--- a/packages/compass-indexes/src/modules/search-indexes.ts
+++ b/packages/compass-indexes/src/modules/search-indexes.ts
@@ -9,10 +9,8 @@ import type { SearchIndex } from 'mongodb-data-service';
import { isAction } from '../utils/is-action';
import { FetchStatuses, NOT_FETCHABLE_STATUSES } from '../utils/fetch-status';
-import type { FetchStatus } from '../utils/fetch-status';
import { FetchReasons } from '../utils/fetch-reason';
-import type { FetchReason } from '../utils/fetch-reason';
import type { IndexesThunkAction } from '.';
import { switchToSearchIndexes } from './index-view';
@@ -49,7 +47,7 @@ export enum ActionTypes {
type FetchSearchIndexesStartedAction = {
type: ActionTypes.FetchSearchIndexesStarted;
- reason: FetchReason;
+ reason: FetchReasons;
};
type FetchSearchIndexesSucceededAction = {
@@ -119,7 +117,7 @@ type UpdateSearchIndexState = {
};
export type State = {
- status: FetchStatus;
+ status: FetchStatuses;
createIndex: CreateSearchIndexState;
updateIndex: UpdateSearchIndexState;
error?: string;
@@ -377,7 +375,7 @@ export const updateSearchIndexClosed = (): UpdateSearchIndexClosedAction => ({
});
const fetchSearchIndexesStarted = (
- reason: FetchReason
+ reason: FetchReasons
): FetchSearchIndexesStartedAction => ({
type: ActionTypes.FetchSearchIndexesStarted,
reason,
@@ -597,7 +595,7 @@ type FetchSearchIndexesActions =
| FetchSearchIndexesFailedAction;
const fetchIndexes = (
- reason: FetchReason
+ reason: FetchReasons
): IndexesThunkAction, FetchSearchIndexesActions> => {
return async (dispatch, getState, { dataService }) => {
const {