Skip to content

Commit 52cb7b6

Browse files
committed
merge main
2 parents a38fe21 + 84beae9 commit 52cb7b6

File tree

286 files changed

+13396
-6237
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

+13396
-6237
lines changed

.evergreen/start-docker-envs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if [ "$HAS_DOCKER" = true ]; then
3939
LOGS_DIR="$SCRIPT_DIR/logs"
4040
mkdir -p "$LOGS_DIR"
4141

42-
git clone -b v1.3.2 --single-branch https://github.com/mongodb-js/devtools-docker-test-envs.git test-envs
42+
git clone -b v1.3.4 --single-branch https://github.com/mongodb-js/devtools-docker-test-envs.git test-envs
4343
$DOCKER_COMPOSE -f test-envs/docker/enterprise/docker-compose.yaml up -d
4444
$DOCKER_COMPOSE -f test-envs/docker/ldap/docker-compose.yaml up -d
4545
$DOCKER_COMPOSE -f test-envs/docker/scram/docker-compose.yaml up -d

.github/workflows/test-installers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ jobs:
182182
# Similar to total task timeout, setting these higher than the default
183183
# value to account for very slow windows machines
184184
COMPASS_E2E_MOCHA_TIMEOUT: 720000 # 12min
185-
COMPASS_E2E_WEBDRIVER_WAITFOR_TIMEOUT: 360000 # 6min
185+
COMPASS_E2E_WEBDRIVER_WAITFOR_TIMEOUT: 600000 # 10min
186186
steps:
187187
- name: Checkout
188188
uses: actions/checkout@v2

.snyk

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ ignore:
77
reason: >-
88
Not applicable as we do not use a valueFormatter or cellRenderer
99
function
10-
expires: 2025-09-17T13:05:57.065Z
1110
created: 2024-01-18T18:27:24.353Z
1211
SNYK-JS-AGGRIDCOMMUNITY-7414157:
1312
- '*':
1413
reason: >-
1514
Not applicable as we don't use ag-grid utils and the library never
1615
passes user input directly to the merge function
17-
expires: 2025-09-17T13:05:57.065Z
1816
created: 2024-09-17T13:05:57.071Z
1917
SNYK-JS-ELECTRON-8642944:
2018
- '*':

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,4 @@ Jacob Lu <[email protected]>
112112
Nataly Carbonell <[email protected]>
113113
DarshanaVenkatesh <[email protected]>
114114
Kevin Pamaran <[email protected]>
115+
Leo Generali <[email protected]>

THIRD-PARTY-NOTICES.md

Lines changed: 361 additions & 88 deletions
Large diffs are not rendered by default.

configs/eslint-config-compass/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ module.exports = {
9898
plugins: [...shared.plugins, '@mongodb-js/compass', 'chai-friendly'],
9999
rules: {
100100
...shared.rules,
101+
'@mongodb-js/compass/no-inline-emotion-css': 'warn',
101102
'@mongodb-js/compass/no-leafygreen-outside-compass-components': 'error',
102103
'@mongodb-js/compass/unique-mongodb-log-id': [
103104
'error',

configs/eslint-config-compass/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mongodb-js/eslint-config-compass",
3-
"version": "1.4.8",
3+
"version": "1.4.10",
44
"description": "Shared Compass eslint configuration",
55
"license": "SSPL",
66
"main": "index.js",
@@ -17,9 +17,9 @@
1717
"@babel/core": "^7.24.3",
1818
"@babel/eslint-parser": "^7.14.3",
1919
"@mongodb-js/eslint-config-devtools": "^0.9.9",
20-
"@mongodb-js/eslint-plugin-compass": "^1.2.15",
21-
"@typescript-eslint/eslint-plugin": "^8.41.0",
22-
"@typescript-eslint/parser": "^8.41.0",
20+
"@mongodb-js/eslint-plugin-compass": "^1.2.16",
21+
"@typescript-eslint/eslint-plugin": "^8.43.0",
22+
"@typescript-eslint/parser": "^8.43.0",
2323
"eslint": "^8.57.1",
2424
"eslint-config-prettier": "^8.3.0",
2525
"eslint-plugin-chai-friendly": "^1.1.0",

configs/eslint-plugin-compass/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22
module.exports = {
33
rules: {
4+
'no-inline-emotion-css': require('./rules/no-inline-emotion-css'),
45
'no-leafygreen-outside-compass-components': require('./rules/no-leafygreen-outside-compass-components'),
56
'unique-mongodb-log-id': require('./rules/unique-mongodb-log-id'),
67
},

configs/eslint-plugin-compass/package.json

Lines changed: 1 addition & 1 deletion
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.2.15",
16+
"version": "1.2.16",
1717
"repository": {
1818
"type": "git",
1919
"url": "https://github.com/mongodb-js/compass.git"
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
'use strict';
2+
3+
/**
4+
* Checks if a node is a css() call from emotion.
5+
* @param {Object} node - AST node to check.
6+
* @returns {boolean} - Whether the node is a css() call.
7+
*/
8+
function isCssCall(node) {
9+
return (
10+
node &&
11+
node.type === 'CallExpression' &&
12+
node.callee &&
13+
node.callee.type === 'Identifier' &&
14+
node.callee.name === 'css'
15+
);
16+
}
17+
18+
/**
19+
* Checks if a call is inside a react function.
20+
* This only checks for JSXExpressionContainers or an uppercase function name,
21+
* so it may miss some cases.
22+
* @param {Object} context - ESLint context.
23+
* @returns {boolean} - Whether we're inside a function.
24+
*/
25+
function isInsideReactFunction(context) {
26+
const ancestors = context.getAncestors();
27+
28+
const hasJSXAncestor = ancestors.some(
29+
(ancestor) => ancestor.type === 'JSXExpressionContainer'
30+
);
31+
32+
if (hasJSXAncestor) {
33+
return true;
34+
}
35+
36+
const currentFunction = ancestors.find(
37+
(ancestor) =>
38+
ancestor.type === 'FunctionDeclaration' ||
39+
ancestor.type === 'FunctionExpression' ||
40+
ancestor.type === 'ArrowFunctionExpression'
41+
);
42+
if (currentFunction) {
43+
// If the function name starts with an uppercase letter maybe it's a React component.
44+
if (
45+
currentFunction.type === 'FunctionDeclaration' &&
46+
currentFunction.id &&
47+
/^[A-Z]/.test(currentFunction.id.name)
48+
) {
49+
return true;
50+
}
51+
}
52+
}
53+
54+
/** @type {import('eslint').Rule.RuleModule} */
55+
module.exports = {
56+
meta: {
57+
type: 'problem',
58+
docs: {
59+
description: 'Disallow dynamic emotion css() calls in render methods',
60+
},
61+
messages: {
62+
noInlineCSS:
63+
"Don't use a dynamic css() call in the render method, this creates a new class name every time component updates and is not performant. Static styles can be defined with css outside of render, dynamic should be passed through the style prop.",
64+
},
65+
},
66+
67+
create(context) {
68+
return {
69+
// Check for dynamic css() calls in react rendering.
70+
CallExpression(node) {
71+
if (!isCssCall(node)) {
72+
return;
73+
}
74+
75+
if (isInsideReactFunction(context)) {
76+
context.report({
77+
node,
78+
messageId: 'noInlineCSS',
79+
});
80+
}
81+
},
82+
};
83+
},
84+
};

0 commit comments

Comments
 (0)