Skip to content

Commit

Permalink
Style(web-react): Introduce ESlint rule to avoid using useLayoutEffect
Browse files Browse the repository at this point in the history
refs #DS-1004
  • Loading branch information
literat committed Nov 5, 2023
1 parent 7715998 commit 84df51b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/web-react/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,16 @@ module.exports = {
'import/no-extraneous-dependencies': ['error', { packageDir: ['./', '../../'] }],
// disable double quotes
quotes: ['warn', 'single'],
// use useIsomorphicLayoutEffect instead of useLayoutEffect
// @see: https://medium.com/@alexandereardon/uselayouteffect-and-ssr-192986cdcf7a
'no-restricted-imports': [
'error',
// Disabling using of useLayoutEffect from react
{
name: 'react',
importNames: ['useLayoutEffect'],
message: '`useLayoutEffect` causes a warning in SSR. Use `useIsomorphicLayoutEffect`',
},
],
},
};

0 comments on commit 84df51b

Please sign in to comment.