From 7b14a8f3faf7672f0aefbf93d5c37f62a169b535 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 6 Nov 2022 03:30:40 +0300 Subject: Cleanup ESLint warnings --- vnext/package.json | 3 ++- vnext/src/ui/Contact.js | 5 +++-- vnext/src/ui/Header.js | 3 --- vnext/src/ui/Icon.js | 3 ++- vnext/src/ui/Login.js | 2 +- vnext/src/ui/SearchBox.js | 10 +++++----- vnext/src/ui/UploadButton.js | 1 + vnext/src/ui/UserInfo.js | 7 +++++-- 8 files changed, 19 insertions(+), 15 deletions(-) (limited to 'vnext') diff --git a/vnext/package.json b/vnext/package.json index 3377a7e4..49acbc90 100644 --- a/vnext/package.json +++ b/vnext/package.json @@ -6,7 +6,8 @@ "test": "jest", "dist": "webpack --mode=production --progress && esbuild --bundle --sourcemap --keep-names --platform=node --target=node18 --loader:.css=file --loader:.js=jsx --loader:.png=file --loader:.svg=file --outfile=dist/server.js server/index.js", "start-ssr": "npm run dist && cross-env DEBUG=http node dist/server.js", - "start": "webpack serve" + "start": "webpack serve", + "lint": "eslint src/**/*.js" }, "keywords": [], "author": "", diff --git a/vnext/src/ui/Contact.js b/vnext/src/ui/Contact.js index 2d009738..a0d32e84 100644 --- a/vnext/src/ui/Contact.js +++ b/vnext/src/ui/Contact.js @@ -3,13 +3,14 @@ import { memo } from 'react'; import Avatar from './Avatar'; /** - * @typedef {Object} ContactProps + * @typedef {object} ContactProps * @property {import('../api').Chat} user - * @property {React.CSSProperties} style + * @property {import('react').CSSProperties} style */ /** * Contact component + * * @param {ContactProps} props */ function Contact({ user, style }) { diff --git a/vnext/src/ui/Header.js b/vnext/src/ui/Header.js index 4a665605..6cf07844 100644 --- a/vnext/src/ui/Header.js +++ b/vnext/src/ui/Header.js @@ -2,11 +2,8 @@ import { memo, useCallback } from 'react'; import { Link, useNavigate } from 'react-router-dom'; import SearchBox from './SearchBox'; -import { useVisitor } from './VisitorContext'; -import Avatar from './Avatar'; function Header() { - const [visitor] = useVisitor(); const navigate = useNavigate(); /** * @param {string} searchString diff --git a/vnext/src/ui/Icon.js b/vnext/src/ui/Icon.js index 3255346f..acf7bccf 100644 --- a/vnext/src/ui/Icon.js +++ b/vnext/src/ui/Icon.js @@ -5,7 +5,7 @@ import PropTypes from 'prop-types'; import evilIcons from 'evil-icons/assets/sprite.svg'; /** - * @typedef {Object} IconProps + * @typedef {object} IconProps * @property {string} size * @property {string=} className * @property {string} name @@ -14,6 +14,7 @@ import evilIcons from 'evil-icons/assets/sprite.svg'; /** * Icon inner component + * * @param {IconProps} props - icon props */ function IconElement(props) { diff --git a/vnext/src/ui/Login.js b/vnext/src/ui/Login.js index 98f9328b..07b0a2a3 100644 --- a/vnext/src/ui/Login.js +++ b/vnext/src/ui/Login.js @@ -32,7 +32,7 @@ function Login({ onAuth }) { } }, [navigate, location.state, visitor]); - const { register, handleSubmit, formState: { errors }, } = useForm(); + const { register, handleSubmit } = useForm(); /** @type { import('react-hook-form').SubmitHandler } */ let onSubmit = (values) => { diff --git a/vnext/src/ui/SearchBox.js b/vnext/src/ui/SearchBox.js index e6085fdc..636967b1 100644 --- a/vnext/src/ui/SearchBox.js +++ b/vnext/src/ui/SearchBox.js @@ -1,19 +1,19 @@ import { useForm } from 'react-hook-form'; /** - * @typedef {Object} SearchBoxPropsFields - * @property {function} onSearch + * @typedef {object} SearchBoxPropsFields + * @property {Function} onSearch */ /** -* @typedef {SearchBoxPropsFields} SearchBoxProps -*/ + * @typedef {SearchBoxPropsFields} SearchBoxProps + */ /** * @param {SearchBoxProps} props */ function SearchBox({ onSearch }) { - const { register, handleSubmit, formState: { errors }, } = useForm(); + const { register, handleSubmit } = useForm(); /** @type { import('react-hook-form').SubmitHandler } */ let onSubmit = ( values ) => { onSearch(values.search); diff --git a/vnext/src/ui/UploadButton.js b/vnext/src/ui/UploadButton.js index b652e522..f07501de 100644 --- a/vnext/src/ui/UploadButton.js +++ b/vnext/src/ui/UploadButton.js @@ -9,6 +9,7 @@ import Icon from './Icon'; /** * Upload button + * * @param {UploadButtonProps} props */ export default function UploadButton(props) { diff --git a/vnext/src/ui/UserInfo.js b/vnext/src/ui/UserInfo.js index bcf5c20e..91e3b5cf 100644 --- a/vnext/src/ui/UserInfo.js +++ b/vnext/src/ui/UserInfo.js @@ -13,7 +13,8 @@ let isMounted; /** * User info component - * @param {{uname: string, onUpdate?: function, children?: import('react').ReactElement}} props + * + * @param {{uname: string, onUpdate?: Function, children?: import('react').ReactElement}} props */ export default function UserInfo({ uname, onUpdate, children }) { const [user, setUser] = useState({ @@ -66,6 +67,7 @@ export default function UserInfo({ uname, onUpdate, children }) { /** * User summary component + * * @param {{user: import('../api').User}} props */ function Summary({ user }) { @@ -90,6 +92,7 @@ const UserSummary = memo(Summary); /** * Link to user + * * @param {{ user: import('../api').User}} props */ export function UserLink(props) { @@ -107,7 +110,7 @@ export function UserLink(props) { uri: userRef.current.uri }); } - }).catch(reason => { + }).catch(() => { setUser({ uid: 0, uname: userRef.current.uri, -- cgit v1.2.3