Skip to content

Commit cbb0656

Browse files
committed
Merge branch 'main' of github.com:mongodb-js/compass into gagik/headless-context-menu
2 parents ee658e1 + 58a1873 commit cbb0656

File tree

286 files changed

+8430
-4782
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

286 files changed

+8430
-4782
lines changed

.evergreen/print-compass-env.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ if [[ "${EVERGREEN_PROJECT}" == "10gen-compass-main" ]]; then
4343
month=$(escapeLeadingZero "${ts[1]}")
4444
day=$(escapeLeadingZero "${ts[2]}")
4545
hour=$(escapeLeadingZero "${ts[3]}")
46-
minute="${ts[4]}"
47-
second="${ts[5]}"
46+
minute=$(escapeLeadingZero "${ts[4]}")
47+
second=$(escapeLeadingZero "${ts[5]}")
4848
export DEV_VERSION_IDENTIFIER="${year}.${month}.${day}-dev.${hour}${minute}${second}"
4949
fi
5050
fi

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @mongodb-js/compass-developers
File renamed without changes.

.github/workflows/test-installers.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ jobs:
4646
run: echo "[Evergreen Task](${{ github.event.inputs.evergreen_task_url }})" >> $GITHUB_STEP_SUMMARY
4747
test:
4848
name: ${{ matrix.package }} test ${{ matrix.test }} (${{ matrix.hadron-distribution }})
49-
timeout-minutes: 30
49+
# Windows specifically takes A TON of time to bootstrap itself before being
50+
# able to run tests, so we're setting the timeout pretty high to account for
51+
# that
52+
timeout-minutes: 60
5053
strategy:
5154
fail-fast: false
5255
matrix:
@@ -174,7 +177,7 @@ jobs:
174177
runs-on: ${{ matrix.runs-on }}
175178
container: ${{ matrix.container }}
176179
env:
177-
DEBUG: compass:smoketests:*
180+
DEBUG: compass:smoketests:*,compass-e2e-tests:*
178181
steps:
179182
- name: Checkout
180183
uses: actions/checkout@v2

.github/workflows/update-eslint.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ jobs:
3838
3939
- name: Bump eslint
4040
run: |
41-
npm i --save eslint@8 -w @mongodb-js/eslint-config-compass
41+
npm i --save --workspace @mongodb-js/eslint-config-compass \
42+
eslint@8 \
43+
@typescript-eslint/eslint-plugin@latest \
44+
@typescript-eslint/parser@latest
4245
4346
- name: Create Pull Request
4447
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # 7.0.5

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,4 @@ Dylan Richardson <[email protected]>
104104
Ruby Dong <[email protected]>
105105
Neal Beeken <[email protected]>
106106
Walter Tan <[email protected]>
107+
Raymond Lo <[email protected]>

THIRD-PARTY-NOTICES.md

Lines changed: 388 additions & 41 deletions
Large diffs are not rendered by default.

configs/eslint-config-compass/index.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const path = require('path');
44
const shared = require('@mongodb-js/eslint-config-devtools');
55
const common = require('@mongodb-js/eslint-config-devtools/common');
6+
const chaiFriendly = require('eslint-plugin-chai-friendly');
67

78
const extraTsRules = {
89
// Newly converted plugins use `any` quite a lot, we can't enable the rule,
@@ -15,6 +16,18 @@ const extraTsRules = {
1516
'error',
1617
{ fixMixedExportsWithInlineTypeSpecifier: false },
1718
],
19+
// We use chai outside of tests, hence applying these rules to all ts files
20+
...chaiFriendly.configs.recommended.rules,
21+
'@typescript-eslint/prefer-promise-reject-errors': 'off',
22+
'@typescript-eslint/only-throw-error': 'off',
23+
24+
// TODO: a lot new hits with latest typescript-eslint, we should gradually
25+
// clean those out and re-enable the rules
26+
'@typescript-eslint/no-explicit-any': 'warn',
27+
'@typescript-eslint/no-base-to-string': 'warn',
28+
'@typescript-eslint/unbound-method': 'warn',
29+
'@typescript-eslint/no-duplicate-type-constituents': 'warn',
30+
'@typescript-eslint/no-unsafe-declaration-merging': 'warn',
1831
};
1932

2033
const tsRules = {
@@ -50,7 +63,7 @@ const commonTestOverrides = {
5063
{
5164
patterns: [
5265
{
53-
group: '@testing-library/*',
66+
group: ['@testing-library/*'],
5467
message: 'Use @mongodb-js/testing-library-compass instead',
5568
allowTypeImports: false,
5669
},
@@ -84,7 +97,7 @@ const testTsOverrides = {
8497
};
8598

8699
module.exports = {
87-
plugins: [...shared.plugins, '@mongodb-js/compass'],
100+
plugins: [...shared.plugins, '@mongodb-js/compass', 'chai-friendly'],
88101
rules: {
89102
...shared.rules,
90103
'@mongodb-js/compass/no-leafygreen-outside-compass-components': 'error',

configs/eslint-config-compass/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mongodb-js/eslint-config-compass",
3-
"version": "1.3.9",
3+
"version": "1.3.10",
44
"description": "Shared Compass eslint configuration",
55
"license": "SSPL",
66
"main": "index.js",
@@ -18,10 +18,11 @@
1818
"@babel/eslint-parser": "^7.14.3",
1919
"@mongodb-js/eslint-config-devtools": "^0.9.9",
2020
"@mongodb-js/eslint-plugin-compass": "^1.2.9",
21-
"@typescript-eslint/eslint-plugin": "^5.59.0",
22-
"@typescript-eslint/parser": "^5.59.0",
21+
"@typescript-eslint/eslint-plugin": "^8.34.0",
22+
"@typescript-eslint/parser": "^8.34.0",
2323
"eslint": "^8.57.1",
2424
"eslint-config-prettier": "^8.3.0",
25+
"eslint-plugin-chai-friendly": "^1.1.0",
2526
"eslint-plugin-filename-rules": "^1.2.0",
2627
"eslint-plugin-jsx-a11y": "^6.10.2",
2728
"eslint-plugin-mocha": "^8.0.0",

configs/eslint-config-compass/plugin.js

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,51 @@ function restrictedProviderImport(servicePkg) {
1010
};
1111
}
1212

13+
// node built-ins with meaningful polyfills in web environment
14+
const allowedNodeJSBuiltinModules = ['assert', 'stream', 'events'];
15+
1316
module.exports = {
1417
...baseConfig,
1518
rules: {
1619
...baseConfig.rules,
1720
'no-restricted-imports': 'off',
1821
'@typescript-eslint/no-restricted-imports': [
1922
'error',
20-
restrictedProviderImport('@mongodb-js/compass-logging'),
21-
restrictedProviderImport('@mongodb-js/compass-telemetry'),
22-
restrictedProviderImport('@mongodb-js/compass-app-stores'),
23-
restrictedProviderImport('@mongodb-js/my-queries-storage'),
24-
restrictedProviderImport('@mongodb-js/atlas-service'),
25-
restrictedProviderImport('compass-preferences-model'),
26-
{
27-
paths: require('module').builtinModules,
28-
message: 'Using Node.js built-in modules in plugins is not allowed.',
29-
allowTypeImports: false,
30-
},
3123
{
32-
paths: ['electron', '@electron/remote'],
33-
message: 'Using electron modules in plugins is not allowed.',
34-
allowTypeImports: false,
24+
paths: [
25+
restrictedProviderImport('@mongodb-js/compass-logging'),
26+
restrictedProviderImport('@mongodb-js/compass-telemetry'),
27+
restrictedProviderImport('@mongodb-js/compass-app-stores'),
28+
restrictedProviderImport('@mongodb-js/my-queries-storage'),
29+
restrictedProviderImport('@mongodb-js/atlas-service'),
30+
restrictedProviderImport('compass-preferences-model'),
31+
...require('module')
32+
.builtinModules.filter((module) => {
33+
return (
34+
!module.startsWith('_') &&
35+
!allowedNodeJSBuiltinModules.includes(module)
36+
);
37+
})
38+
.flatMap((name) => {
39+
const config = {
40+
message:
41+
'Using Node.js built-in modules in plugins is not allowed.',
42+
allowTypeImports: true,
43+
};
44+
45+
return [
46+
{ name, ...config },
47+
{ name: `node:${name}`, ...config },
48+
];
49+
}),
50+
...['electron', '@electron/remote'].map((name) => {
51+
return {
52+
name,
53+
message: 'Using electron modules in plugins is not allowed.',
54+
allowTypeImports: false,
55+
};
56+
}),
57+
],
3558
},
3659
],
3760
},

configs/testing-library-compass/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"email": "[email protected]"
1212
},
1313
"homepage": "https://github.com/mongodb-js/compass",
14-
"version": "1.3.1",
14+
"version": "1.3.2",
1515
"repository": {
1616
"type": "git",
1717
"url": "https://github.com/mongodb-js/compass.git"
@@ -45,7 +45,7 @@
4545
"reformat": "npm run eslint . -- --fix && npm run prettier -- --write ."
4646
},
4747
"devDependencies": {
48-
"@mongodb-js/eslint-config-compass": "^1.3.9",
48+
"@mongodb-js/eslint-config-compass": "^1.3.10",
4949
"@mongodb-js/mocha-config-compass": "^1.6.8",
5050
"@mongodb-js/prettier-config-compass": "^1.2.8",
5151
"@mongodb-js/tsconfig-compass": "^1.2.8",

configs/webpack-config-compass/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"email": "[email protected]"
1414
},
1515
"homepage": "https://github.com/mongodb-js/compass",
16-
"version": "1.6.10",
16+
"version": "1.8.0",
1717
"repository": {
1818
"type": "git",
1919
"url": "https://github.com/mongodb-js/compass.git"
@@ -45,7 +45,7 @@
4545
"reformat": "npm run eslint . -- --fix && npm run prettier -- --write ."
4646
},
4747
"devDependencies": {
48-
"@mongodb-js/eslint-config-compass": "^1.3.9",
48+
"@mongodb-js/eslint-config-compass": "^1.3.10",
4949
"@mongodb-js/prettier-config-compass": "^1.2.8",
5050
"@mongodb-js/tsconfig-compass": "^1.2.8",
5151
"@types/cli-progress": "^3.9.2",
@@ -66,12 +66,12 @@
6666
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
6767
"babel-loader": "^8.2.5",
6868
"babel-plugin-istanbul": "^5.2.0",
69-
"browserslist": "^4.24.4",
69+
"browserslist": "^4.25.0",
7070
"chalk": "^4.1.2",
7171
"cli-progress": "^3.9.1",
7272
"core-js": "^3.17.3",
7373
"css-loader": "^4.3.0",
74-
"electron": "^32.3.3",
74+
"electron": "^36.4.0",
7575
"html-webpack-plugin": "^5.6.0",
7676
"less": "^3.13.1",
7777
"less-loader": "^10.0.1",

configs/webpack-config-compass/src/index.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,17 @@ export function createElectronMainConfig(
147147
sharedObjectLoader(opts),
148148
sourceLoader(opts),
149149
],
150+
parser: {
151+
javascript: {
152+
// Webpack compile time check for imports matching exports is too strict
153+
// in cases where the code expects some name export to be optional
154+
// (webpack will break the build if it fails to statically see the
155+
// matching export) this is why we switch the check to just warn. If
156+
// this ever hides a real case where a missing import is being used, it
157+
// will definitely break in runtime anyway
158+
importExportsPresence: 'warn' as const,
159+
},
160+
},
150161
},
151162
node: false as const,
152163
externals: toCommonJsExternal(sharedExternals),
@@ -218,6 +229,11 @@ export function createElectronRendererConfig(
218229
sharedObjectLoader(opts),
219230
sourceLoader(opts),
220231
],
232+
parser: {
233+
javascript: {
234+
importExportsPresence: 'warn' as const,
235+
},
236+
},
221237
},
222238
plugins: [
223239
...entriesToHtml(entries),
@@ -301,7 +317,7 @@ export function createElectronRendererConfig(
301317
export function createWebConfig(args: Partial<ConfigArgs>): WebpackConfig {
302318
const opts = webpackArgsWithDefaults(args, { target: 'web' });
303319

304-
// eslint-disable-next-line @typescript-eslint/no-var-requires
320+
// eslint-disable-next-line @typescript-eslint/no-require-imports
305321
const { peerDependencies } = require(path.join(opts.cwd, 'package.json')) as {
306322
peerDependencies: Record<string, string>;
307323
};
@@ -338,6 +354,11 @@ export function createWebConfig(args: Partial<ConfigArgs>): WebpackConfig {
338354
assetsLoader(opts),
339355
sourceLoader(opts),
340356
],
357+
parser: {
358+
javascript: {
359+
importExportsPresence: 'warn' as const,
360+
},
361+
},
341362
},
342363
// This follows current Compass plugin behavior and is here more or less to
343364
// keep compat for the external plugin users

configs/webpack-config-compass/src/loaders.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { isServe } from './args';
77
import chalk from 'chalk';
88

99
function isLatestBrowserslist() {
10-
// eslint-disable-next-line @typescript-eslint/no-var-requires
10+
// eslint-disable-next-line @typescript-eslint/no-require-imports
1111
const browserslistVersion = require('browserslist/package.json').version;
1212
const command = `npm view browserslist version --json`;
1313
const latestBrowserslistVersion = JSON.parse(
@@ -18,7 +18,7 @@ function isLatestBrowserslist() {
1818
}
1919

2020
const electronVersion = (() => {
21-
// eslint-disable-next-line @typescript-eslint/no-var-requires
21+
// eslint-disable-next-line @typescript-eslint/no-require-imports
2222
const [maj, min] = require('electron/package.json').version.split(
2323
'.'
2424
) as string[];

configs/webpack-config-compass/src/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function entriesToHtml(
3838
fs.statSync(maybeTemplatePath);
3939
template = maybeTemplatePath;
4040
break;
41-
} catch (e) {
41+
} catch {
4242
// ignore and use default template, electron renderer entry will need
4343
// at least some kind of html page provided one way or the other
4444
}
@@ -62,7 +62,7 @@ export function camelCase(str: string): string {
6262
}
6363

6464
export function getLibraryNameFromCwd(cwd: string): string {
65-
// eslint-disable-next-line @typescript-eslint/no-var-requires
65+
// eslint-disable-next-line @typescript-eslint/no-require-imports
6666
const { name, productName } = require(path.join(cwd, 'package.json')) as {
6767
name: string;
6868
productName: string;

0 commit comments

Comments
 (0)