Skip to content

Commit 35a114a

Browse files
committed
add eslint react-hooks plugin again
1 parent 1c5fb71 commit 35a114a

2 files changed

Lines changed: 17 additions & 17 deletions

File tree

examples/vite-ts/eslint.config.mjs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
import js from '@eslint/js';
22
import globals from 'globals';
3-
import reactHooks from 'eslint-plugin-react-hooks';
43
import reactRefresh from 'eslint-plugin-react-refresh';
54
import tseslint from 'typescript-eslint';
5+
import reactHooksPlugin from 'eslint-plugin-react-hooks';
66

7-
export default tseslint.config(
8-
{ ignores: ['dist'] },
9-
{
10-
extends: [js.configs.recommended, ...tseslint.configs.recommended],
11-
files: ['**/*.{ts,tsx}'],
12-
languageOptions: {
13-
ecmaVersion: 2020,
14-
globals: globals.browser,
15-
},
16-
plugins: {
17-
'react-refresh': reactRefresh,
18-
},
19-
rules: {
20-
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
21-
},
7+
export default tseslint.config({ ignores: ['dist'] }, reactHooksPlugin.configs.flat.recommended, {
8+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
9+
files: ['**/*.{ts,tsx}'],
10+
languageOptions: {
11+
ecmaVersion: 2020,
12+
globals: globals.browser,
2213
},
23-
);
14+
plugins: {
15+
'react-refresh': reactRefresh,
16+
},
17+
rules: {
18+
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
19+
},
20+
});

examples/vite-ts/src/AppShell.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ function AppShell() {
9393
<ResponsivePopover
9494
className={classes.popover}
9595
open={popoverOpen}
96+
// The ResponsivePopover needs the ref to the ShellBarItem to position itself correctly.
97+
// Since ShellBarItem is abstract and doesn't render a real DOM element, using an id is not efficient.
98+
// eslint-disable-next-line react-hooks/refs
9699
opener={popoverOpenerRef.current}
97100
onClose={() => {
98101
setPopoverOpen(false);

0 commit comments

Comments
 (0)