Skip to content

Commit f9225b4

Browse files
committed
Enable and ignore "react-refresh" eslint rule
1 parent 2380132 commit f9225b4

File tree

9 files changed

+15
-2
lines changed

9 files changed

+15
-2
lines changed

.eslintrc.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"plugin:react-hooks/recommended"
1212
],
1313
"parser": "@typescript-eslint/parser",
14-
"plugins": ["@typescript-eslint"],
14+
"plugins": ["@typescript-eslint", "react-refresh"],
1515
"root": true,
1616
"ignorePatterns": [
1717
// Ignore top-level dot files:
@@ -52,7 +52,8 @@
5252
],
5353
"react/display-name": "off",
5454
"react/no-unescaped-entities": "off",
55-
"react/prop-types": "off"
55+
"react/prop-types": "off",
56+
"react-refresh/only-export-components": "warn"
5657
},
5758
"settings": {
5859
"react": {

src/components/Announcer/AnnouncerContext.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { createContext } from "react";
22

3+
// eslint-disable-next-line react-refresh/only-export-components
34
export const ContextData = createContext({ message: "" });
45

6+
// eslint-disable-next-line react-refresh/only-export-components
57
export const ContextApi = createContext({
68
updateMessage: (message: string) => {
79
// do nothing

src/components/Chart/Chart.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as React from "react";
44
// @ts-expect-error TS(2554) FIXME: Expected 1 arguments, but got 0.
55
const ChartContext = createContext();
66

7+
// eslint-disable-next-line react-refresh/only-export-components
78
export const useDimensionsContext = () => useContext(ChartContext);
89

910
type Props = {

src/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { useLessonIndexWithFallback } from "./states/lessonIndexState";
1212
import { revisionModeState } from "./states/lessonState";
1313
import Analytics from "components/Analytics";
1414

15+
// eslint-disable-next-line react-refresh/only-export-components
1516
function AppWrapper(props: object) {
1617
const lessonIndex = useLessonIndexWithFallback();
1718
// @ts-expect-error TS(2740) FIXME: Type '{ lessonIndex: LessonIndexEntry[]; }' is mis... Remove this comment to see the full error message

src/pages/games/TPEURPBGS/TPEURPBGSContext/TPEURPBGSContext.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { createContext } from "react";
22
import { UntrustedMultilineString, defaultState } from "../gameReducer";
33

4+
// eslint-disable-next-line react-refresh/only-export-components
45
export const ContextData = createContext({
56
...defaultState,
67
repeatToWin: 10, // TODO: this should come from somewhere else
78
});
89

10+
// eslint-disable-next-line react-refresh/only-export-components
911
export const ContextApi = createContext({
1012
gameRestarted: () => {
1113
// do nothing

src/pages/lessons/components/Metronome.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,5 @@ const Metronome: FC<Props> = () => {
181181
};
182182

183183
export default Metronome;
184+
// eslint-disable-next-line react-refresh/only-export-components
184185
export { bpmBracketsSprite, playId };

src/pages/lessons/flashcards/Flashcards.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,7 @@ export class Flashcards extends Component<FlashcardsProps, State> {
779779
}
780780
}
781781

782+
// eslint-disable-next-line react-refresh/only-export-components
782783
export default withAppMethods(
783784
withAtomsCompat(FlashcardsWrapper, [
784785
["userSettings", userSettingsState],

src/pages/writer/Writer.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,12 +431,14 @@ class Writer extends Component<WithAppMethods<Props & {changeStenoLayout: Return
431431
}
432432
}
433433

434+
// eslint-disable-next-line react-refresh/only-export-components
434435
function WriterWrapper(props: WithAppMethods<Props>) {
435436
const changeStenoLayout = useChangeStenoLayout()
436437
const changeWriterInput = useChangeWriterInput()
437438
return <Writer {...props} {...{changeStenoLayout, changeWriterInput}} />;
438439
}
439440

441+
// eslint-disable-next-line react-refresh/only-export-components
440442
export default withAppMethods(withAtomsCompat(WriterWrapper, [
441443
["userSettings", userSettingsState],
442444
["globalUserSettings", globalUserSettingsState]

src/states/legacy/AppMethodsContext.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const AppMethodsContext = createContext<AppMethods>(null!);
3939

4040
export default AppMethodsContext;
4141

42+
// eslint-disable-next-line react-refresh/only-export-components
4243
export const useAppMethods = () => {
4344
return useContext(AppMethodsContext);
4445
}
@@ -47,6 +48,7 @@ export const useAppMethods = () => {
4748
export type WithAppMethods<P> = {
4849
appMethods: AppMethods;
4950
} & P;
51+
// eslint-disable-next-line react-refresh/only-export-components
5052
export const withAppMethods = <P, >(Component: ComponentType<WithAppMethods<P>>) => (props: P) => {
5153
return (
5254
<AppMethodsContext.Consumer>

0 commit comments

Comments
 (0)