From 687abb318e2878b819f71a5c37902a1753fcad9c Mon Sep 17 00:00:00 2001 From: Artemy Date: Sat, 22 Apr 2023 12:23:29 +0300 Subject: [PATCH] fix: linting --- .eslintrc.cjs | 17 +++++++++++++++++ src/components/markdown.jsx | 5 +++-- src/localisation/en.js | 1 - src/localisation/eo.js | 2 +- src/localisation/es.js | 2 +- src/localisation/ja.js | 2 +- src/localisation/zh.js | 2 +- src/pages/create.jsx | 5 +---- 8 files changed, 25 insertions(+), 11 deletions(-) create mode 100644 .eslintrc.cjs diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 0000000..2da6303 --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,17 @@ +module.exports = { + env: { browser: true, es2020: true }, + extends: [ + "eslint:recommended", + "plugin:react/recommended", + "plugin:react/jsx-runtime", + "plugin:react-hooks/recommended", + ], + parserOptions: { ecmaVersion: "latest", sourceType: "module" }, + settings: { react: { version: "18.2" } }, + plugins: ["react-refresh"], + rules: { + "react-refresh/only-export-components": "warn", + "react/prop-types": 0, + "no-undef": 0, + }, +}; diff --git a/src/components/markdown.jsx b/src/components/markdown.jsx index cdff5fd..c0adc59 100644 --- a/src/components/markdown.jsx +++ b/src/components/markdown.jsx @@ -48,14 +48,15 @@ function CodeBlock(props) { function RenderMarkdown(props) { return ( + > + {props.children} + ); } diff --git a/src/localisation/en.js b/src/localisation/en.js index bbd5a41..c078446 100644 --- a/src/localisation/en.js +++ b/src/localisation/en.js @@ -71,7 +71,6 @@ let en = { Search: "Search", NoNotesFound: "No notes found", LocalNote: "Local", - PublicNote: "Public", Menu: "Menu", }; diff --git a/src/localisation/eo.js b/src/localisation/eo.js index 75252c8..16a61c0 100644 --- a/src/localisation/eo.js +++ b/src/localisation/eo.js @@ -73,7 +73,7 @@ let eo = { Search: "Serĉo", NoNotesFound: "Neniuj notoj trovitaj", LocalNote: "Loka", - PublicNote: "Publika", + PublishNote: "Publika", Menu: "Menuo", }; diff --git a/src/localisation/es.js b/src/localisation/es.js index 5757b2e..30009ea 100644 --- a/src/localisation/es.js +++ b/src/localisation/es.js @@ -73,7 +73,7 @@ let es = { Search: "Buscar", NoNotesFound: "No se encontraron notas", LocalNote: "Local", - PublicNote: "Pública", + PublishNote: "Pública", Menu: "Menú", }; diff --git a/src/localisation/ja.js b/src/localisation/ja.js index 2c32055..3758b31 100644 --- a/src/localisation/ja.js +++ b/src/localisation/ja.js @@ -73,7 +73,7 @@ let ja = { Search: "検索", NoNotesFound: "メモが見つかりません", LocalNote: "地元", - PublicNote: "公共", + PublishNote: "公共", Menu: "メニュー", }; diff --git a/src/localisation/zh.js b/src/localisation/zh.js index efc456a..78c7265 100644 --- a/src/localisation/zh.js +++ b/src/localisation/zh.js @@ -71,7 +71,7 @@ let zh = { Search: "搜索", NoNotesFound: "找不到笔记", LocalNote: "当地的", - PublicNote: "民众", + PublishNote: "民众", Menu: "菜单", }; diff --git a/src/pages/create.jsx b/src/pages/create.jsx index bba2d0b..5c9dc40 100644 --- a/src/pages/create.jsx +++ b/src/pages/create.jsx @@ -65,8 +65,6 @@ function CreateNote() { const [text, setText] = useState(localStorage.getItem("NoteText")); const [name, setName] = useState(localStorage.getItem("NoteName")); - const [date, setDate] = useState(Date.now()); - async function previewChange(val) { let md = await unified() .use(remarkGfm) @@ -106,7 +104,7 @@ function CreateNote() { localStorage.setItem("NoteName", data.name); }); - socket.on("roomJoined", (data) => { + socket.on("roomJoined", () => { nameUpdate(localStorage.getItem("NoteName"), true); textUpdate(localStorage.getItem("NoteText"), true); }); @@ -124,7 +122,6 @@ function CreateNote() { id="preview" onClick={(val) => { setText(localStorage.getItem("NoteText")); - setDate(Date.now()); setPreview(val.target.checked); }} />