Here are two solutions to address this problem, both of which have proven to be effective for me.
Even though I am using react.js, I managed to resolve the issue successfully. I believe these fixes could also work well for you.
I have tried multiple approaches, such as setting requireConfigFile
to false or configuring Babel in different files like .eslintrc.js
, .babelrc
, and in the "babel" section of package.json
, but none seemed to work.
Solution 1 - include these lines in your .eslintrc.js file
.eslintrc.js
"parser": '@babel/eslint-parser',
"parserOptions": {
"requireConfigFile": false,
}
Solution 2 - install the package @babel/core
npm i --save-dev @babel/core
.babelrc
{
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": ["@babel/plugin-proposal-optional-chaining"]
}