From 8ce595e5d69af0cbc31d6a300ef465276ab0aa37 Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Fri, 10 Apr 2020 12:58:46 -0400 Subject: [PATCH] Add rule banning literal text in JSX (#1367) --- package.json | 9 ++++++++- src/components/LoadingMessage.tsx | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 51a2d1f89..b72d3cf31 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,14 @@ } ], "prefer-template": "warn", - "prettier/prettier": "warn" + "prettier/prettier": "warn", + "no-restricted-syntax": [ + "warn", + { + "selector": "JSXText[value=/\\w/]", + "message": "Use 't(...)' instead of literal text in JSX" + } + ] } }, "homepage": ".", diff --git a/src/components/LoadingMessage.tsx b/src/components/LoadingMessage.tsx index 59321f874..0bfd4232f 100644 --- a/src/components/LoadingMessage.tsx +++ b/src/components/LoadingMessage.tsx @@ -4,7 +4,7 @@ export const LoadingMessage = () => { // !! KEEP THIS IN SYNC WITH index.html !! return (
- Loading scene... + {"Loading scene..."}
); };