1nwf / Produx-v2

Found unused variables in TypeScript code JS-0356
Performance
Major
52 occurrences in this check
'PostTypes' is defined but never used. Allowed unused vars must match /^_/u
 1import { createSlice, PayloadAction } from '@reduxjs/toolkit'
 2import { PostTypes } from '../interfaces' 3
 4interface ChannelInterface {
 5    channel: string
'User' is defined but never used. Allowed unused vars must match /^_/u
  3    NewProduct,
  4    Product,
  5    ProductUser,
  6    User,  7    Post,
  8    UserInfo,
  9} from '../interfaces'
'OneProductResponse' is defined but never used. Allowed unused vars must match /^_/u
 20    page: number
 21    products: Product[]
 22}
 23interface OneProductResponse { 24    product: Product
 25}
 26
'number' is defined but never used. Allowed unused vars must match /^_/u
  9} from '../interfaces'
 10import { RootState } from '../store'
 11import { ProductPostsResponse } from '../interfaces'
 12import { number } from 'prop-types' 13import Posts from '../../components/Products/Home/Posts/Posts'
 14interface ProductSearch {
 15    name?: string
'RootState' is defined but never used. Allowed unused vars must match /^_/u
  7    Post,
  8    UserInfo,
  9} from '../interfaces'
 10import { RootState } from '../store' 11import { ProductPostsResponse } from '../interfaces'
 12import { number } from 'prop-types'
 13import Posts from '../../components/Products/Home/Posts/Posts'
'Posts' is defined but never used. Allowed unused vars must match /^_/u
 10import { RootState } from '../store'
 11import { ProductPostsResponse } from '../interfaces'
 12import { number } from 'prop-types'
 13import Posts from '../../components/Products/Home/Posts/Posts' 14interface ProductSearch {
 15    name?: string
 16    field?: string
'b1' is assigned a value but never used. Allowed unused vars must match /^_/u
 84
 85type ChannelInfo = Record<ChannelName, ChannelBody>
 86
 87const b1: ChannelInfo = { 88    bugs: { icon: '', color: '' },
 89}
 90
'e' is defined but never used. Allowed unused args must match /^_/u
14    password: "",
15  });
16
17  const submitHandler = async (e: any) => {18    await signIn(userInfo)
19      .then((res: any) => {
20        localStorage.setItem("token", res.data.token);
'Loading' is defined but never used. Allowed unused vars must match /^_/u
  3import { useEffect, useState, useRef, useCallback } from 'react'
  4import LoadingSpinner from '../LoadingSpinner'
  5import { Channel } from '../../state/interfaces'
  6import { Loading } from '@nextui-org/react'  7import Posts from './Home/Posts/Posts'
  8export default function LatestPosts() {
  9    const [channel, setChannel] = useState('Bugs')
'p' is defined but never used. Allowed unused args must match /^_/u
 44
 45    useEffect(() => {
 46        if (data) {
 47            setPosts((p) => [...posts, ...data.posts]) 48        }
 49    }, [data])
 50    const channels: Channel = {
'error' is assigned a value but never used. Allowed unused vars must match /^_/u
  7import Posts from './Home/Posts/Posts'
  8export default function LatestPosts() {
  9    const [channel, setChannel] = useState('Bugs')
 10    const [getPosts, { data, isLoading, error }] = useLazyGetLatestPostsQuery() 11    const [posts, setPosts] = useState([])
 12    const observer = useRef()
 13    const hasMore = data ? data.hasMore : false
'Posts' is defined but never used. Allowed unused vars must match /^_/u
  4import LoadingSpinner from '../LoadingSpinner'
  5import { Channel } from '../../state/interfaces'
  6import { Loading } from '@nextui-org/react'
  7import Posts from './Home/Posts/Posts'  8export default function LatestPosts() {
  9    const [channel, setChannel] = useState('Bugs')
 10    const [getPosts, { data, isLoading, error }] = useLazyGetLatestPostsQuery()
'isLoading' is assigned a value but never used. Allowed unused vars must match /^_/u
 25  };
 26  const [followProduct] = useFollowProductMutation();
 27  const [follow, setFollow] = useState(false);
 28  const { data, isLoading, error } = useGetUserInfoQuery(); 29  const mdBreakpoint = 1024;
 30  const channelName = channel.charAt(0).toUpperCase() + channel.slice(1);
 31  const filters = ["😱 All Posts", "🎉 Latest Posts", "🙌 Most Upvoted Posts"];
'error' is assigned a value but never used. Allowed unused vars must match /^_/u
 25  };
 26  const [followProduct] = useFollowProductMutation();
 27  const [follow, setFollow] = useState(false);
 28  const { data, isLoading, error } = useGetUserInfoQuery(); 29  const mdBreakpoint = 1024;
 30  const channelName = channel.charAt(0).toUpperCase() + channel.slice(1);
 31  const filters = ["😱 All Posts", "🎉 Latest Posts", "🙌 Most Upvoted Posts"];
'filters' is assigned a value but never used. Allowed unused vars must match /^_/u
 28  const { data, isLoading, error } = useGetUserInfoQuery();
 29  const mdBreakpoint = 1024;
 30  const channelName = channel.charAt(0).toUpperCase() + channel.slice(1);
 31  const filters = ["😱 All Posts", "🎉 Latest Posts", "🙌 Most Upvoted Posts"]; 32  const [width, setWidth] = useState(window.innerWidth);
 33  useEffect(() => {
 34    if (window !== undefined) {
'data' is assigned a value but never used. Allowed unused vars must match /^_/u
 13  productUserID: number;
 14}) {
 15  const [filteredUsers, setFilteredUsers] = useState(users);
 16  const [updateRole, { data, error, isLoading }] = useUpdateUserRoleMutation(); 17  const onlineUsers = useAppSelector((state) => state.product.onlineUsers);
 18  const [showUserInfo, setShowUserInfo] = useState({
 19    show: false,
'isLoading' is assigned a value but never used. Allowed unused vars must match /^_/u
 13  productUserID: number;
 14}) {
 15  const [filteredUsers, setFilteredUsers] = useState(users);
 16  const [updateRole, { data, error, isLoading }] = useUpdateUserRoleMutation(); 17  const onlineUsers = useAppSelector((state) => state.product.onlineUsers);
 18  const [showUserInfo, setShowUserInfo] = useState({
 19    show: false,
'error' is assigned a value but never used. Allowed unused vars must match /^_/u
14  channel: string;
15}) {
16  const [showAdd, setShowAdd] = useState(false);
17  const { data, isLoading, error } = useGetPostsQuery({18    productId,
19    channel: channel.toLowerCase(),
20  });
'setPosts' is assigned a value but never used. Allowed unused elements of array destructuring patterns must match /^_/u
24    Suggestions: { icon: "🙏", color: "#0094FF" },
25    Changelogs: { icon: "🔑", color: "#FF4D00" },
26  };
27  const [posts, setPosts] = useState(data ? data.posts : []);28  const observer = useRef();
29  const lastPostRef = useCallback(
30    (node) => {
'userInfo' is defined but never used. Allowed unused vars must match /^_/u
 1import { Comment } from '../../../../../state/interfaces'
 2import { Avatar, Link } from '@nextui-org/react'
 3import moment from 'moment'
 4import { userInfo } from 'os' 5export default function CommentCard({ comment }: { comment: Comment }) {
 6    return (
 7        <div className="bg-white p-5 rounded-3xl min-w-[20vw] items-center mx-6 ">
'Link' is defined but never used. Allowed unused vars must match /^_/u
 1import { Comment } from '../../../../../state/interfaces'
 2import { Avatar, Link } from '@nextui-org/react' 3import moment from 'moment'
 4import { userInfo } from 'os'
 5export default function CommentCard({ comment }: { comment: Comment }) {
'ChangeEvent' is defined but never used. Allowed unused vars must match /^_/u
 1import { ChangeEvent, MouseEventHandler, useState } from 'react' 2import { Loading, Button, Textarea } from '@nextui-org/react'
 3import { useCreateCommentMutation } from '../../../../../state/reducers/api'
 4import { useRouter } from 'next/router'
'MouseEventHandler' is defined but never used. Allowed unused vars must match /^_/u
 1import { ChangeEvent, MouseEventHandler, useState } from 'react' 2import { Loading, Button, Textarea } from '@nextui-org/react'
 3import { useCreateCommentMutation } from '../../../../../state/reducers/api'
 4import { useRouter } from 'next/router'
'data' is assigned a value but never used. Allowed unused vars must match /^_/u
10    postId: number
11}) {
12    const [comment, setComment] = useState('')
13    const [createComment, { data, error, isLoading }] =14        useCreateCommentMutation()
15    const [shoErr, setShowErr] = useState(false)
16    const router = useRouter()
'error' is assigned a value but never used. Allowed unused vars must match /^_/u
10    postId: number
11}) {
12    const [comment, setComment] = useState('')
13    const [createComment, { data, error, isLoading }] =14        useCreateCommentMutation()
15    const [shoErr, setShowErr] = useState(false)
16    const router = useRouter()