
> frontend@0.0.0 lint
> eslint .


/home/pc-6/BNSP_UJIKOM/frontend/src/App.jsx
  1:8  error  'React' is defined but never used  no-unused-vars

/home/pc-6/BNSP_UJIKOM/frontend/src/components/AdminSidebar.jsx
  1:8  error  'React' is defined but never used  no-unused-vars

/home/pc-6/BNSP_UJIKOM/frontend/src/components/Footer.jsx
  1:8  error  'React' is defined but never used  no-unused-vars

/home/pc-6/BNSP_UJIKOM/frontend/src/components/Navbar.jsx
  1:8  error  'React' is defined but never used  no-unused-vars

/home/pc-6/BNSP_UJIKOM/frontend/src/components/ProductCard.jsx
  1:8  error  'React' is defined but never used  no-unused-vars

/home/pc-6/BNSP_UJIKOM/frontend/src/components/UserNavbar.jsx
  1:8  error  'React' is defined but never used              no-unused-vars
  6:9  error  'navigate' is assigned a value but never used  no-unused-vars

/home/pc-6/BNSP_UJIKOM/frontend/src/pages/Admin/AdminCategories.jsx
   1:8   error  'React' is defined but never used                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       no-unused-vars
  13:5   error  Error: Cannot access variable before it is declared

`fetchCategories` is accessed before it is declared, which prevents the earlier access from updating when this value changes over time.

  11 |
  12 |   useEffect(() => {
> 13 |     fetchCategories();
     |     ^^^^^^^^^^^^^^^ `fetchCategories` accessed before it is declared
  14 |   }, []);
  15 |
  16 |   const fetchCategories = async () => {

  14 |   }, []);
  15 |
> 16 |   const fetchCategories = async () => {
     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 17 |     try {
     | ^^^^^^^^^
> 18 |       const response = await axiosInstance.get('/categorys');
     …
     | ^^^^^^^^^
> 25 |     }
     | ^^^^^^^^^
> 26 |   };
     | ^^^^^ `fetchCategories` is declared here
  27 |
  28 |   const filteredCategories = categories.filter(c => 
  29 |     c.name.toLowerCase().includes(searchTerm.toLowerCase())  react-hooks/immutability
  39:18  error  'error' is defined but never used                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       no-unused-vars
  53:18  error  'error' is defined but never used                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       no-unused-vars
  67:18  error  'error' is defined but never used                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       no-unused-vars

/home/pc-6/BNSP_UJIKOM/frontend/src/pages/Admin/AdminDashboard.jsx
   1:8  error    'React' is defined but never used                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        no-unused-vars
  18:5  error    Error: Cannot access variable before it is declared

`fetchDashboardData` is accessed before it is declared, which prevents the earlier access from updating when this value changes over time.

  16 |
  17 |   useEffect(() => {
> 18 |     fetchDashboardData();
     |     ^^^^^^^^^^^^^^^^^^ `fetchDashboardData` accessed before it is declared
  19 |   }, []);
  20 |
  21 |   const fetchDashboardData = async () => {

  19 |   }, []);
  20 |
> 21 |   const fetchDashboardData = async () => {
     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 22 |     try {
     | ^^^^^^^^^
> 23 |       const [userRes, prodRes, orderRes] = await Promise.all([
     …
     | ^^^^^^^^^
> 43 |     }
     | ^^^^^^^^^
> 44 |   };
     | ^^^^^ `fetchDashboardData` is declared here
  45 |
  46 |   const filteredOrders = recentOrders.filter(o => 
  47 |     String(o.id).toLowerCase().includes(searchTerm.toLowerCase()) ||   react-hooks/immutability
  19:6  warning  React Hook useEffect has a missing dependency: 'fetchDashboardData'. Either include it or remove the dependency array                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    react-hooks/exhaustive-deps

/home/pc-6/BNSP_UJIKOM/frontend/src/pages/Admin/AdminNotifications.jsx
  1:8  error  'React' is defined but never used  no-unused-vars

/home/pc-6/BNSP_UJIKOM/frontend/src/pages/Admin/AdminOrders.jsx
   1:8   error  'React' is defined but never used                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      no-unused-vars
  13:5   error  Error: Cannot access variable before it is declared

`fetchOrders` is accessed before it is declared, which prevents the earlier access from updating when this value changes over time.

  11 |
  12 |   useEffect(() => {
> 13 |     fetchOrders();
     |     ^^^^^^^^^^^ `fetchOrders` accessed before it is declared
  14 |   }, []);
  15 |
  16 |   const fetchOrders = async () => {

  14 |   }, []);
  15 |
> 16 |   const fetchOrders = async () => {
     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 17 |     try {
     | ^^^^^^^^^
> 18 |       const response = await axiosInstance.get('/orders');
     …
     | ^^^^^^^^^
> 25 |     }
     | ^^^^^^^^^
> 26 |   };
     | ^^^^^ `fetchOrders` is declared here
  27 |
  28 |   const filteredOrders = orders.filter(o => 
  29 |     String(o.id).toLowerCase().includes(searchTerm.toLowerCase()) ||   react-hooks/immutability
  55:18  error  'error' is defined but never used                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      no-unused-vars

/home/pc-6/BNSP_UJIKOM/frontend/src/pages/Admin/AdminProducts.jsx
   1:8   error  'React' is defined but never used                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             no-unused-vars
  15:5   error  Error: Cannot access variable before it is declared

`fetchData` is accessed before it is declared, which prevents the earlier access from updating when this value changes over time.

  13 |
  14 |   useEffect(() => {
> 15 |     fetchData();
     |     ^^^^^^^^^ `fetchData` accessed before it is declared
  16 |   }, []);
  17 |
  18 |   const fetchData = async () => {

  16 |   }, []);
  17 |
> 18 |   const fetchData = async () => {
     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 19 |     try {
     | ^^^^^^^^^
> 20 |       const [prodRes, catRes] = await Promise.all([
     …
     | ^^^^^^^^^
> 31 |     }
     | ^^^^^^^^^
> 32 |   };
     | ^^^^^ `fetchData` is declared here
  33 |
  34 |   const filteredProducts = products.filter(p => 
  35 |     p.name.toLowerCase().includes(searchTerm.toLowerCase()) ||   react-hooks/immutability
  46:18  error  'error' is defined but never used                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             no-unused-vars

/home/pc-6/BNSP_UJIKOM/frontend/src/pages/Admin/AdminProfile.jsx
  1:8   error  'React' is defined but never used  no-unused-vars
  3:10  error  'Link' is defined but never used   no-unused-vars

/home/pc-6/BNSP_UJIKOM/frontend/src/pages/Admin/AdminUsers.jsx
   1:8  error  'React' is defined but never used                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     no-unused-vars
  13:5  error  Error: Cannot access variable before it is declared

`fetchUsers` is accessed before it is declared, which prevents the earlier access from updating when this value changes over time.

  11 |
  12 |   useEffect(() => {
> 13 |     fetchUsers();
     |     ^^^^^^^^^^ `fetchUsers` accessed before it is declared
  14 |   }, []);
  15 |
  16 |   const fetchUsers = async () => {

  14 |   }, []);
  15 |
> 16 |   const fetchUsers = async () => {
     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 17 |     try {
     | ^^^^^^^^^
> 18 |       const response = await axiosInstance.get('/users');
     …
     | ^^^^^^^^^
> 25 |     }
     | ^^^^^^^^^
> 26 |   };
     | ^^^^^ `fetchUsers` is declared here
  27 |
  28 |   const filteredUsers = users.filter(u => 
  29 |     u.name.toLowerCase().includes(searchTerm.toLowerCase()) ||   react-hooks/immutability

/home/pc-6/BNSP_UJIKOM/frontend/src/pages/Login/Login.jsx
  1:8  error  'React' is defined but never used  no-unused-vars

/home/pc-6/BNSP_UJIKOM/frontend/src/pages/Register/Register.jsx
  1:8  error  'React' is defined but never used  no-unused-vars

/home/pc-6/BNSP_UJIKOM/frontend/src/pages/User/Cart.jsx
   1:8  error  'React' is defined but never used                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                no-unused-vars
  14:5  error  Error: Cannot access variable before it is declared

`loadCart` is accessed before it is declared, which prevents the earlier access from updating when this value changes over time.

  12 |   useEffect(() => {
  13 |     AOS.init({ duration: 1000, once: true });
> 14 |     loadCart();
     |     ^^^^^^^^ `loadCart` accessed before it is declared
  15 |     
  16 |     const handleCartUpdate = () => loadCart();
  17 |     window.addEventListener('cartUpdated', handleCartUpdate);

  19 |   }, []);
  20 |
> 21 |   const loadCart = () => {
     |   ^^^^^^^^^^^^^^^^^^^^^^^^
> 22 |     const savedCart = JSON.parse(localStorage.getItem('cart') || '[]');
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 23 |     setCartItems(savedCart);
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 24 |   };
     | ^^^^^ `loadCart` is declared here
  25 |
  26 |   const updateQuantity = (id, delta) => {
  27 |     const newCart = cartItems.map(item =>   react-hooks/immutability

/home/pc-6/BNSP_UJIKOM/frontend/src/pages/User/Checkout.jsx
   1:8   error  'React' is defined but never used                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       no-unused-vars
  26:5   error  Error: Calling setState synchronously within an effect can trigger cascading renders

Effects are intended to synchronize state between React and external systems such as manually updating the DOM, state management libraries, or other platform APIs. In general, the body of an effect should do one or both of the following:
* Update external systems with the latest state from React.
* Subscribe for updates from some external system, calling setState in a callback function when external state changes.

Calling setState synchronously within an effect body causes cascading renders that can hurt performance, and is not recommended. (https://react.dev/learn/you-might-not-need-an-effect).

  24 |     AOS.init({ duration: 1000, once: true });
  25 |     const items = JSON.parse(localStorage.getItem('cart') || '[]');
> 26 |     setCartItems(items);
     |     ^^^^^^^^^^^^ Avoid calling setState() directly within an effect
  27 |     setTotal(items.reduce((acc, curr) => acc + (curr.price * curr.quantity), 0));
  28 |     fetchProvinces();
  29 |   }, []);                                                                                                                                    react-hooks/set-state-in-effect
  28:5   error  Error: Cannot access variable before it is declared

`fetchProvinces` is accessed before it is declared, which prevents the earlier access from updating when this value changes over time.

  26 |     setCartItems(items);
  27 |     setTotal(items.reduce((acc, curr) => acc + (curr.price * curr.quantity), 0));
> 28 |     fetchProvinces();
     |     ^^^^^^^^^^^^^^ `fetchProvinces` accessed before it is declared
  29 |   }, []);
  30 |
  31 |   const fetchProvinces = async () => {

  29 |   }, []);
  30 |
> 31 |   const fetchProvinces = async () => {
     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 32 |     try {
     | ^^^^^^^^^
> 33 |       const response = await fetch('https://www.emsifa.com/api-wilayah-indonesia/api/provinces.json');
     | ^^^^^^^^^
> 34 |       const data = await response.json();
     | ^^^^^^^^^
> 35 |       setProvinces(data);
     | ^^^^^^^^^
> 36 |     } catch (error) {
     | ^^^^^^^^^
> 37 |       console.error('Error fetching provinces:', error);
     | ^^^^^^^^^
> 38 |     }
     | ^^^^^^^^^
> 39 |   };
     | ^^^^^ `fetchProvinces` is declared here
  40 |
  41 |   const handleProvinceChange = async (e) => {
  42 |     const id = e.target.value;  react-hooks/immutability
  96:13  error  'response' is assigned a value but never used                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           no-unused-vars

/home/pc-6/BNSP_UJIKOM/frontend/src/pages/User/Home.jsx
   1:8  error  'React' is defined but never used                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     no-unused-vars
  18:5  error  Error: Cannot access variable before it is declared

`fetchData` is accessed before it is declared, which prevents the earlier access from updating when this value changes over time.

  16 |   useEffect(() => {
  17 |     AOS.init({ duration: 1000, once: true });
> 18 |     fetchData();
     |     ^^^^^^^^^ `fetchData` accessed before it is declared
  19 |   }, []);
  20 |
  21 |   const fetchData = async () => {

  19 |   }, []);
  20 |
> 21 |   const fetchData = async () => {
     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 22 |     try {
     | ^^^^^^^^^
> 23 |       const [prodRes, catRes] = await Promise.all([
     …
     | ^^^^^^^^^
> 36 |     }
     | ^^^^^^^^^
> 37 |   };
     | ^^^^^ `fetchData` is declared here
  38 |
  39 |   return (
  40 |     <div className="user-home">  react-hooks/immutability

/home/pc-6/BNSP_UJIKOM/frontend/src/pages/User/Orders.jsx
    1:8   error  'React' is defined but never used                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                no-unused-vars
   14:5   error  Error: Cannot access variable before it is declared

`fetchUserOrders` is accessed before it is declared, which prevents the earlier access from updating when this value changes over time.

  12 |   useEffect(() => {
  13 |     AOS.init({ duration: 1000, once: true });
> 14 |     fetchUserOrders();
     |     ^^^^^^^^^^^^^^^ `fetchUserOrders` accessed before it is declared
  15 |   }, []);
  16 |
  17 |   const fetchUserOrders = async () => {

  15 |   }, []);
  16 |
> 17 |   const fetchUserOrders = async () => {
     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 18 |     try {
     | ^^^^^^^^^
> 19 |       const user = JSON.parse(localStorage.getItem('user'));
     …
     | ^^^^^^^^^
> 28 |     }
     | ^^^^^^^^^
> 29 |   };
     | ^^^^^ `fetchUserOrders` is declared here
  30 |
  31 |   return (
  32 |     <div className="orders-page">  react-hooks/immutability
  131:63  error  'navigate' is not defined                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        no-undef

/home/pc-6/BNSP_UJIKOM/frontend/src/pages/User/ProductDetail.jsx
   1:8  error    'React' is defined but never used                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 no-unused-vars
  19:5  error    Error: Cannot access variable before it is declared

`fetchProduct` is accessed before it is declared, which prevents the earlier access from updating when this value changes over time.

  17 |     window.scrollTo(0, 0);
  18 |     AOS.init({ duration: 1000, once: true });
> 19 |     fetchProduct();
     |     ^^^^^^^^^^^^ `fetchProduct` accessed before it is declared
  20 |   }, [id]);
  21 |
  22 |   const fetchProduct = async () => {

  20 |   }, [id]);
  21 |
> 22 |   const fetchProduct = async () => {
     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 23 |     try {
     | ^^^^^^^^^
> 24 |       const response = await axiosInstance.get(`/products/${id}`);
     …
     | ^^^^^^^^^
> 31 |     }
     | ^^^^^^^^^
> 32 |   };
     | ^^^^^ `fetchProduct` is declared here
  33 |
  34 |   const handleAddToCart = () => {
  35 |     const cart = JSON.parse(localStorage.getItem('cart') || '[]');  react-hooks/immutability
  20:6  warning  React Hook useEffect has a missing dependency: 'fetchProduct'. Either include it or remove the dependency array                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   react-hooks/exhaustive-deps

/home/pc-6/BNSP_UJIKOM/frontend/src/pages/User/Products.jsx
   1:8  error  'React' is defined but never used                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  no-unused-vars
  22:5  error  Error: Calling setState synchronously within an effect can trigger cascading renders

Effects are intended to synchronize state between React and external systems such as manually updating the DOM, state management libraries, or other platform APIs. In general, the body of an effect should do one or both of the following:
* Update external systems with the latest state from React.
* Subscribe for updates from some external system, calling setState in a callback function when external state changes.

Calling setState synchronously within an effect body causes cascading renders that can hurt performance, and is not recommended. (https://react.dev/learn/you-might-not-need-an-effect).

  20 |
  21 |   useEffect(() => {
> 22 |     setFilter(categoryParam);
     |     ^^^^^^^^^ Avoid calling setState() directly within an effect
  23 |   }, [categoryParam]);
  24 |
  25 |   useEffect(() => {  react-hooks/set-state-in-effect
  27:5  error  Error: Cannot access variable before it is declared

`fetchData` is accessed before it is declared, which prevents the earlier access from updating when this value changes over time.

  25 |   useEffect(() => {
  26 |     AOS.init({ duration: 1000, once: true });
> 27 |     fetchData();
     |     ^^^^^^^^^ `fetchData` accessed before it is declared
  28 |   }, []);
  29 |
  30 |   const fetchData = async () => {

  28 |   }, []);
  29 |
> 30 |   const fetchData = async () => {
     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 31 |     try {
     | ^^^^^^^^^
> 32 |       const [prodRes, catRes] = await Promise.all([
     …
     | ^^^^^^^^^
> 42 |     }
     | ^^^^^^^^^
> 43 |   };
     | ^^^^^ `fetchData` is declared here
  44 |
  45 |   const filteredProducts = products.filter(p => 
  46 |     (filter === 'Semua' || p.Category?.name === filter) &&                                              react-hooks/immutability

/home/pc-6/BNSP_UJIKOM/frontend/src/pages/User/Profile.jsx
  16:7  error  Error: Calling setState synchronously within an effect can trigger cascading renders

Effects are intended to synchronize state between React and external systems such as manually updating the DOM, state management libraries, or other platform APIs. In general, the body of an effect should do one or both of the following:
* Update external systems with the latest state from React.
* Subscribe for updates from some external system, calling setState in a callback function when external state changes.

Calling setState synchronously within an effect body causes cascading renders that can hurt performance, and is not recommended. (https://react.dev/learn/you-might-not-need-an-effect).

  14 |     const storedUser = localStorage.getItem('user');
  15 |     if (storedUser) {
> 16 |       setUserData(JSON.parse(storedUser));
     |       ^^^^^^^^^^^ Avoid calling setState() directly within an effect
  17 |     } else {
  18 |       navigate('/login');
  19 |     }  react-hooks/set-state-in-effect

✖ 46 problems (44 errors, 2 warnings)

