Skip to content

Bug: The no-unused-var error cleared by duplicating React Router import #18172

Answered by Rec0iL99
w3dd1e asked this question in General
Discussion options

You must be logged in to vote

Hi @w3dd1e, I'm guessing you got a Parsing Error from ESLint since you had a syntax error (missing bracket). ESLint will not lint the file unless it has valid JS code (with no syntax errors).

// now this is valid JavaScript

import { Link } from 'react-router-dom';
import { useState } from 'react';
//other imported items

const LoginForm = () => {
	const handleLogin = async (e) => {
		e.preventDefault();
		 // other code 
        }
	return(
		<form onSubmit={(e) => handleLogin(e)} method='post' id='login'>
		// other code
		<input  onClick={(e) => handleLogin(e)} type='submit' value='Sign In' className='button'/>
		</form>
	);
};

The no-unused-vars rule is complaining here because Link, u…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@w3dd1e
Comment options

Answer selected by w3dd1e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ESLint is working incorrectly repro:needed
2 participants
Converted from issue

This discussion was converted from issue #18171 on March 06, 2024 07:10.