So I am building a REACT JS project, and after a while I noticed that it doesn't underline undefined functions nor wrong imports, for example if I does that:
import React, { useState } from 'reactaeasdfas';
it wont say that reactaeasdfas
is undefined.
After a bit of searching I found that people say that jsconfig.json
should be initialized.
I found a basic one on the internet:
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"jsx": "react"
},
"include": [
"src"
]
}
This code above does solve the problem that if I call an undefined function, it will underline it in red, but it still doesn't work if I include undefined import.
Note: I installed react project via create-react-app
Install the ESLint extension for Visual Studio Code - https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
More details:
A standard create-react-app package is already using ESLint, so you shouldn't need to make any changes to the app. However, your editor needs to be set up to work with ESLint. For VS Code this is done by installing an extension/plugin. The CRA documentation has more information about setting up editors - https://create-react-app.dev/docs/setting-up-your-editor/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With