Skip to content

Commit cb80260

Browse files
authored
fix(eslint): resolve react-hooks/static-components issues (#7611)
fix(eslint): resolve react-hooks/statis-components issues
1 parent 2b70205 commit cb80260

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

configs/eslint-config-compass/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const chaiFriendly = require('eslint-plugin-chai-friendly');
99
const tempNewEslintRulesDisabled = {
1010
'react-hooks/refs': 'off',
1111
'react-hooks/preserve-manual-memoization': 'off',
12-
'react-hooks/static-components': 'off',
1312
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
1413
};
1514

packages/compass-assistant/src/compass-assistant-provider.spec.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ const TestComponent: React.FunctionComponent<{
8888

8989
return (
9090
<DrawerContentProvider>
91+
{/* Breaking this rule is fine while none of the tests try to re-render the content */}
92+
{/* eslint-disable-next-line react-hooks/static-components */}
9193
<MockedProvider
9294
originForPrompt="mongodb-compass"
9395
appNameForPrompt="MongoDB Compass"
@@ -113,6 +115,8 @@ describe('useAssistantActions', function () {
113115

114116
return (
115117
<DrawerContentProvider>
118+
{/* Breaking this rule is fine while none of the tests try to re-render the content */}
119+
{/* eslint-disable-next-line react-hooks/static-components */}
116120
<MockedProvider
117121
originForPrompt="mongodb-compass"
118122
appNameForPrompt="MongoDB Compass"

packages/compass-collection/src/components/collection-tab.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ const CollectionTab = ({
331331
};
332332

333333
return (
334+
// This component is not created in render, just accessed from context
335+
// eslint-disable-next-line react-hooks/static-components
334336
<QueryBarPlugin {...pluginProps}>
335337
<CollectionTabWithMetadata
336338
collectionMetadata={collectionMetadata}

packages/compass-query-bar/src/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ export const QueryBar: React.FunctionComponent<
6767
React.ComponentProps<typeof QueryBarComponent>
6868
> = (props) => {
6969
const Component = useQueryBarComponent();
70+
// Component is not created, just accessed via context
71+
// eslint-disable-next-line react-hooks/static-components
7072
return <Component {...props}></Component>;
7173
};
7274

0 commit comments

Comments
 (0)