You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we are using no-restricted-syntax config blocks to ban creation of Emotion styles or styled components within components. One of the issues with this is the warning messages don't allow us to add clickable links to the description of the error:
'Declaring Emotion styles or a styled component within a React component will cause the element to get recreated, causing loss of state and other problems - see the react/no-unstable-nested-components docs for more info https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md',
},
Additionally, while we are doing this, we should optimize this rule to only trigger on React components (currently it is triggered on any FunctionDeclaration, which includes any function). One way of detecting a React component would be to use the component utilities from eslint-plugin-react:
Currently, we are using
no-restricted-syntax
config blocks to ban creation of Emotion styles or styled components within components. One of the issues with this is the warning messages don't allow us to add clickable links to the description of the error:One way to solve this Is moving these checks into a new custom ESLint rule:
eslint-config-upleveled/index.cjs
Lines 195 to 204 in e2b5ce4
Additionally, while we are doing this, we should optimize this rule to only trigger on React components (currently it is triggered on any
FunctionDeclaration
, which includes any function). One way of detecting a React component would be to use the component utilities fromeslint-plugin-react
:https://github.com/jsx-eslint/eslint-plugin-react/blob/c8833f301314dab3e79ef7ac4cf863e4d5fa0019/lib/util/Components.js#L436-L444
The text was updated successfully, but these errors were encountered: