Hello Guys, How are you all? Hope You all Are Fine. Today I am facing the following error error ‘axios’ is defined but never used no-unused-vars in Javascript. So Here I am Explain to you all the possible solutions here.
Without wasting your time, Let’s start This Article to Solve This Error.
How error ‘axios’ is defined but never used no-unused-vars Error Occurs ?
I get error 'axios' is defined but never used no-unused-vars
error which I’m trying to disable. I tried adding // eslint-disable-next-line no-unused-vars
comment as I’ve read in some answers would help, but I still get this error!
How To Solve error ‘axios’ is defined but never used no-unused-vars Error ?
- How To Solve error 'axios' is defined but never used no-unused-vars Error ?
To Solve error 'axios' is defined but never used no-unused-vars Error Add this in package.json file and restart your dev server and rules key should not be twice in the package.json file.
- error 'axios' is defined but never used no-unused-vars
To Solve error 'axios' is defined but never used no-unused-vars Error Add this in package.json file and restart your dev server and rules key should not be twice in the package.json file.
Solution 1: Disabling a rule on a line
Just disable a eslint rule on one line by adding // eslint-disable-next-line no-unused-vars
above the line you want to disable, for example:
// eslint-disable-next-line no-unused-vars
import axios from 'axios';
You put your comment in the wrong line, it’s supposed to be above import axios from 'axios';
, so change
// eslint-disable-next-line no-unused-vars
import axios from 'axios';
to
// eslint-disable-next-line no-unused-vars
import axios from 'axios';
Solution 2: Set “no-unused-vars”: “off”
Add this in package.json file and restart your dev server and rules key should not be twice in the package.json file.
"rules": {
"no-unused-vars": "off"
}
Summery
It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?
Also Read