Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions compiler/packages/babel-plugin-react-compiler/src/CompilerError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,9 @@ export enum ErrorCategory {
// Checks for no setState in effect bodies
EffectSetState = 'EffectSetState',

EffectDerivationsOfState = 'EffectDerivationsOfState',
EffectDerivationDeriveInRender = 'EffectDerivationDeriveInRender',

EffectDerivationShadowingParentState = 'EffectDerivationShadowingParentState',

// Validates against try/catch in place of error boundaries
ErrorBoundaries = 'ErrorBoundaries',
Expand Down Expand Up @@ -692,12 +694,21 @@ function getRuleForCategoryImpl(category: ErrorCategory): LintRule {
recommended: false,
};
}
case ErrorCategory.EffectDerivationsOfState: {
case ErrorCategory.EffectDerivationDeriveInRender: {
return {
category,
name: 'no-deriving-state-in-effects',
description:
'Validates if a useEffect is deriving state from props and/or local state that could be calculated in render.',
recommended: false,
};
}
case ErrorCategory.EffectDerivationShadowingParentState: {
return {
category,
name: 'no-deriving-state-in-effects',
description:
'Validates against deriving values from state in an effect',
'Validates if a useEffect is deriving state from parent state and if the component is updating the shadowed state locally.',
recommended: false,
};
}
Expand Down
Loading