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
[compiler] Script to produce markdown of lint rule docs (facebook#34260)
The docs site is in a separate repo, but this gives us a semi-automated
way to update the docs about our lint rules. The script generates
markdown files from the rule definitions which we can then manually
copy/paste into the docs site somewhere. In the future we can automate
this fully.
'Verifies that automatic effect dependencies are compiled if opted-in',
639
-
recommended: true,
651
+
recommended: false,
640
652
};
641
653
}
642
654
caseErrorCategory.CapitalizedCalls: {
@@ -652,7 +664,7 @@ export function getRuleForCategory(category: ErrorCategory): LintRule {
652
664
return{
653
665
category,
654
666
name: 'config',
655
-
description: 'Validates the configuration',
667
+
description: 'Validates the compiler configuration options',
656
668
recommended: true,
657
669
};
658
670
}
@@ -678,7 +690,7 @@ export function getRuleForCategory(category: ErrorCategory): LintRule {
678
690
category,
679
691
name: 'set-state-in-effect',
680
692
description:
681
-
'Validates against calling setState synchronously in an effect',
693
+
'Validates against calling setState synchronously in an effect, which can lead to re-renders that degrade performance',
682
694
recommended: true,
683
695
};
684
696
}
@@ -687,7 +699,7 @@ export function getRuleForCategory(category: ErrorCategory): LintRule {
687
699
category,
688
700
name: 'error-boundaries',
689
701
description:
690
-
'Validates usage of error boundaries instead of try/catch for errors in JSX',
702
+
'Validates usage of error boundaries instead of try/catch for errors in child components',
691
703
recommended: true,
692
704
};
693
705
}
@@ -711,7 +723,8 @@ export function getRuleForCategory(category: ErrorCategory): LintRule {
711
723
return{
712
724
category,
713
725
name: 'gating',
714
-
description: 'Validates configuration of gating mode',
726
+
description:
727
+
'Validates configuration of [gating mode](https://react.dev/reference/react-compiler/gating)',
715
728
recommended: true,
716
729
};
717
730
}
@@ -720,7 +733,8 @@ export function getRuleForCategory(category: ErrorCategory): LintRule {
720
733
category,
721
734
name: 'globals',
722
735
description:
723
-
'Validates against assignment/mutation of globals during render',
736
+
'Validates against assignment/mutation of globals during render, part of ensuring that '+
737
+
'[side effects must render outside of render](https://react.dev/reference/rules/components-and-hooks-must-be-pure#side-effects-must-run-outside-of-render)',
724
738
recommended: true,
725
739
};
726
740
}
@@ -742,7 +756,7 @@ export function getRuleForCategory(category: ErrorCategory): LintRule {
742
756
category,
743
757
name: 'immutability',
744
758
description:
745
-
'Validates that immutable values (props, state, etc) are not mutated',
759
+
'Validates against mutating props, state, and other values that [are immutable](https://react.dev/reference/rules/components-and-hooks-must-be-pure#props-and-state-are-immutable)',
746
760
recommended: true,
747
761
};
748
762
}
@@ -759,7 +773,9 @@ export function getRuleForCategory(category: ErrorCategory): LintRule {
759
773
category,
760
774
name: 'preserve-manual-memoization',
761
775
description:
762
-
'Validates that existing manual memoized is preserved by the compiler',
776
+
'Validates that existing manual memoized is preserved by the compiler. '+
777
+
'React Compiler will only compile components and hooks if its inference '+
778
+
'[matches or exceeds the existing manual memoization](https://react.dev/learn/react-compiler/introduction#what-should-i-do-about-usememo-usecallback-and-reactmemo)',
763
779
recommended: true,
764
780
};
765
781
}
@@ -768,7 +784,7 @@ export function getRuleForCategory(category: ErrorCategory): LintRule {
768
784
category,
769
785
name: 'purity',
770
786
description:
771
-
'Validates that the component/hook is pure, and does not call known-impure functions',
787
+
'Validates that [components/hooks are pure](https://react.dev/reference/rules/components-and-hooks-must-be-pure) by checking that they do not call known-impure functions',
772
788
recommended: true,
773
789
};
774
790
}
@@ -777,15 +793,16 @@ export function getRuleForCategory(category: ErrorCategory): LintRule {
777
793
category,
778
794
name: 'refs',
779
795
description:
780
-
'Validates correct usage of refs, not reading/writing during render',
796
+
'Validates correct usage of refs, not reading/writing during render. See the "pitfalls" section in [`useRef()` usage](https://react.dev/reference/react/useRef#usage)',
781
797
recommended: true,
782
798
};
783
799
}
784
800
caseErrorCategory.RenderSetState: {
785
801
return{
786
802
category,
787
803
name: 'set-state-in-render',
788
-
description: 'Validates against setting state during render',
804
+
description:
805
+
'Validates against setting state during render, which can trigger additional renders and potential infinite render loops',
789
806
recommended: true,
790
807
};
791
808
}
@@ -794,7 +811,7 @@ export function getRuleForCategory(category: ErrorCategory): LintRule {
794
811
category,
795
812
name: 'static-components',
796
813
description:
797
-
'Validates that components are static, not recreated every render',
814
+
'Validates that components are static, not recreated every render. Components that are recreated dynamically can reset state and trigger excessive re-rendering',
798
815
recommended: true,
799
816
};
800
817
}
@@ -826,15 +843,17 @@ export function getRuleForCategory(category: ErrorCategory): LintRule {
826
843
return{
827
844
category,
828
845
name: 'unsupported-syntax',
829
-
description: 'Validates against syntax that we do not plan to support',
846
+
description:
847
+
'Validates against syntax that we do not plan to support in React Compiler',
830
848
recommended: true,
831
849
};
832
850
}
833
851
caseErrorCategory.UseMemo: {
834
852
return{
835
853
category,
836
854
name: 'use-memo',
837
-
description: 'Validates usage of the useMemo() hook',
855
+
description:
856
+
'Validates usage of the useMemo() hook against common mistakes. See [`useMemo()` docs](https://react.dev/reference/react/useMemo) for more information.',
0 commit comments