Skip to content

Commit 94dc4fe

Browse files
authored
chore: add typecheck to 6 packages (#7366)
1 parent f508d7e commit 94dc4fe

File tree

11 files changed

+93
-57
lines changed

11 files changed

+93
-57
lines changed

configs/webpack-config-compass/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@
3636
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
3737
"compile": "tsc -p tsconfig.json",
3838
"postcompile": "gen-esm-wrapper . ./dist/.esm-wrapper.mjs",
39+
"typecheck": "tsc -p tsconfig-lint.json --noEmit",
3940
"eslint": "eslint-compass",
4041
"prettier": "prettier-compass",
4142
"lint": "npm run eslint . && npm run prettier -- --check .",
4243
"depcheck": "depcheck",
43-
"check": "npm run lint && npm run depcheck",
44+
"check": "npm run typecheck && npm run lint && npm run depcheck",
4445
"check-ci": "npm run check",
4546
"reformat": "npm run eslint . -- --fix && npm run prettier -- --write ."
4647
},

packages/compass-app-registry/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@
3636
"bootstrap": "npm run compile",
3737
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
3838
"compile": "tsc -p tsconfig.json && gen-esm-wrapper . ./dist/.esm-wrapper.mjs",
39+
"typecheck": "tsc -p tsconfig-lint.json --noEmit",
3940
"eslint": "eslint-compass",
4041
"prettier": "prettier-compass",
4142
"lint": "npm run eslint . && npm run prettier -- --check .",
4243
"depcheck": "compass-scripts check-peer-deps && depcheck",
43-
"check": "npm run lint && npm run depcheck",
44+
"check": "npm run typecheck && npm run lint && npm run depcheck",
4445
"check-ci": "npm run check",
4546
"test": "mocha",
4647
"test-cov": "nyc --compact=false --produce-source-map=false -x \"**/*.spec.*\" --reporter=lcov --reporter=text --reporter=html npm run test",

packages/compass-connections-navigation/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@
3636
"bootstrap": "npm run compile",
3737
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
3838
"compile": "tsc -p tsconfig.json",
39+
"typecheck": "tsc -p tsconfig-lint.json --noEmit",
3940
"eslint": "eslint-compass",
4041
"prettier": "prettier-compass",
4142
"lint": "npm run eslint . && npm run prettier -- --check .",
4243
"depcheck": "compass-scripts check-peer-deps && depcheck",
43-
"check": "npm run lint && npm run depcheck",
44+
"check": "npm run typecheck && npm run lint && npm run depcheck",
4445
"check-ci": "npm run check",
4546
"test": "mocha",
4647
"test-cov": "nyc --compact=false --produce-source-map=false -x \"**/*.spec.*\" --reporter=lcov --reporter=text --reporter=html npm run test",

packages/compass-connections-navigation/src/connections-navigation-tree.spec.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ describe('ConnectionsNavigationTree', function () {
286286
{
287287
...connections[0],
288288
csfleMode: 'enabled',
289-
},
289+
} as Connection,
290290
connections[1],
291291
connections[2],
292292
];
@@ -312,7 +312,7 @@ describe('ConnectionsNavigationTree', function () {
312312
{
313313
...connections[0],
314314
csfleMode: 'disabled',
315-
},
315+
} as Connection,
316316
connections[1],
317317
connections[2],
318318
];
@@ -326,7 +326,7 @@ describe('ConnectionsNavigationTree', function () {
326326
{
327327
...connections[0],
328328
csfleMode: 'unavailable',
329-
},
329+
} as Connection,
330330
connections[1],
331331
connections[2],
332332
];

packages/compass-connections-navigation/src/virtual-list/virtual-list.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ function NavigationTree({
9898
onDefaultAction={() => {}}
9999
onItemExpand={onExpandedChange}
100100
onItemAction={() => {}}
101-
getItemActions={() => []}
101+
getItemActions={() => ({ actions: [] })}
102+
getContextMenuGroups={() => []}
102103
width={100}
103104
renderItem={({ item }) => item.name}
104105
__TEST_OVER_SCAN_COUNT={Infinity}

packages/compass-data-modeling/src/components/drawer/relationships-section.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ import { getDefaultRelationshipName } from '../../utils';
1515
const titleBtnStyles = css({
1616
marginLeft: 'auto',
1717
maxHeight: 20, // To match accordion line height
18+
overflow: 'hidden',
19+
textOverflow: 'ellipsis',
20+
whiteSpace: 'nowrap',
1821
});
1922

2023
const emptyRelationshipMessageStyles = css({

packages/compass-logging/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@
3838
"bootstrap": "npm run compile",
3939
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
4040
"compile": "tsc -p tsconfig.json",
41+
"typecheck": "tsc -p tsconfig-lint.json --noEmit",
4142
"eslint": "eslint-compass",
4243
"prettier": "prettier-compass",
4344
"lint": "npm run eslint . && npm run prettier -- --check .",
4445
"depcheck": "compass-scripts check-peer-deps && depcheck",
45-
"check": "npm run lint && npm run depcheck",
46+
"check": "npm run typecheck && npm run lint && npm run depcheck",
4647
"check-ci": "npm run check",
4748
"test": "mocha",
4849
"test-cov": "nyc --compact=false --produce-source-map=false -x \"**/*.spec.*\" --reporter=lcov --reporter=text --reporter=html npm run test",

packages/databases-collections-list/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@
3535
"bootstrap": "npm run compile",
3636
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
3737
"compile": "tsc -p tsconfig.json",
38+
"typecheck": "tsc -p tsconfig-lint.json --noEmit",
3839
"eslint": "eslint-compass",
3940
"prettier": "prettier-compass",
4041
"lint": "npm run eslint . && npm run prettier -- --check .",
4142
"depcheck": "compass-scripts check-peer-deps && depcheck",
42-
"check": "npm run lint && npm run depcheck",
43+
"check": "npm run typecheck && npm run lint && npm run depcheck",
4344
"check-ci": "npm run check",
4445
"test": "mocha",
4546
"test-cov": "nyc --compact=false --produce-source-map=false -x \"**/*.spec.*\" --reporter=lcov --reporter=text --reporter=html npm run test",

packages/databases-collections-list/src/index.spec.tsx

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ import {
1313
PreferencesProvider,
1414
} from 'compass-preferences-model/provider';
1515
import { createSandboxFromDefaultPreferences } from 'compass-preferences-model';
16+
import type { CollectionProps } from 'mongodb-collection-model';
1617
import type { DatabaseProps } from 'mongodb-database-model';
1718

18-
function createDatabase(name) {
19-
const db: Partial<DatabaseProps> = {
19+
function createDatabase(name: string): DatabaseProps {
20+
const db: DatabaseProps = {
2021
_id: name,
2122
name: name,
2223
status: 'ready' as const,
@@ -34,6 +35,7 @@ function createDatabase(name) {
3435
data_size: 1000,
3536
index_count: 25,
3637
index_size: 100,
38+
calculated_storage_size: undefined,
3739
};
3840

3941
if (db.storage_size !== undefined && db.free_storage_size !== undefined) {
@@ -43,7 +45,10 @@ function createDatabase(name) {
4345
return db;
4446
}
4547

46-
function createCollection(name, props: any = {}) {
48+
function createCollection(
49+
name: string,
50+
props: Partial<CollectionProps> = {}
51+
): CollectionProps {
4752
const col = {
4853
_id: name,
4954
name: name,
@@ -79,6 +84,7 @@ function createCollection(name, props: any = {}) {
7984
free_storage_size: 1000,
8085
index_count: 15,
8186
index_size: 16,
87+
calculated_storage_size: undefined,
8288
...props,
8389
};
8490

@@ -89,21 +95,24 @@ function createCollection(name, props: any = {}) {
8995
return col;
9096
}
9197

92-
function createTimeSeries(name, props: any = {}) {
98+
function createTimeSeries(
99+
name: string,
100+
props: Partial<CollectionProps> = {}
101+
): CollectionProps {
93102
return {
94103
...createCollection(name, props),
95104
type: 'timeseries' as const,
96105
};
97106
}
98107

99-
const dbs = [
108+
const dbs: DatabaseProps[] = [
100109
createDatabase('foo'),
101110
createDatabase('bar'),
102111
createDatabase('buz'),
103112
createDatabase('bat'),
104113
];
105114

106-
const colls = [
115+
const colls: CollectionProps[] = [
107116
createCollection('foo.foo', { storage_size: 1000, free_storage_size: 1000 }), // 1000
108117
createCollection('bar.bar', { storage_size: 2000, free_storage_size: 500 }), // 1500
109118
createCollection('buz.buz', { storage_size: 3000, free_storage_size: 2000 }), // 1000
@@ -120,10 +129,16 @@ describe('databases and collections list', function () {
120129

121130
afterEach(cleanup);
122131

123-
const renderDatabasesList = (props) => {
132+
const renderDatabasesList = (
133+
props: Partial<React.ComponentProps<typeof DatabasesList>>
134+
) => {
124135
render(
125136
<PreferencesProvider value={preferences}>
126-
<DatabasesList {...props}></DatabasesList>
137+
<DatabasesList
138+
databases={[]}
139+
onDatabaseClick={() => {}}
140+
{...props}
141+
></DatabasesList>
127142
</PreferencesProvider>
128143
);
129144
};
@@ -200,10 +215,17 @@ describe('databases and collections list', function () {
200215

201216
afterEach(cleanup);
202217

203-
const renderCollectionsList = (props) => {
218+
const renderCollectionsList = (
219+
props: Partial<React.ComponentProps<typeof CollectionsList>>
220+
) => {
204221
render(
205222
<PreferencesProvider value={preferences}>
206-
<CollectionsList {...props}></CollectionsList>
223+
<CollectionsList
224+
onCollectionClick={() => {}}
225+
namespace="db"
226+
collections={[]}
227+
{...props}
228+
></CollectionsList>
207229
</PreferencesProvider>
208230
);
209231
};

packages/explain-plan-helper/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@
3636
"bootstrap": "npm run compile",
3737
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
3838
"compile": "tsc -p tsconfig.json && gen-esm-wrapper . ./dist/.esm-wrapper.mjs",
39+
"typecheck": "tsc -p tsconfig-lint.json --noEmit",
3940
"eslint": "eslint-compass",
4041
"prettier": "prettier-compass",
4142
"lint": "npm run eslint . && npm run prettier -- --check .",
4243
"depcheck": "compass-scripts check-peer-deps && depcheck",
43-
"check": "npm run lint && npm run depcheck",
44+
"check": "npm run typecheck && npm run lint && npm run depcheck",
4445
"check-ci": "npm run check",
4546
"test": "mocha",
4647
"test-cov": "nyc --compact=false --produce-source-map=false -x \"**/*.spec.*\" --reporter=lcov --reporter=text --reporter=html npm run test",

0 commit comments

Comments
 (0)