Reputation: 21
For a React project, I installed Sanity under the schema folder and then I started adding different JS files into it, but even though there is no code in them, I get the error in the header for each js file.
I also tried
npm install --save-dev @babel/preset-react
but it didn't work.
I started to watch Clever Programmer's Uniswap video but I cannot move forward with the error.
Upvotes: 2
Views: 3140
Reputation: 69
Yes, In my case, this command is working now "eslint.workingDirectories": ["./web", "./studio"]
after adding this command project will working
Upvotes: 0
Reputation: 654
I don't know if you solved it. You might need to change your webpack.config file. Go to:
node_modules/react-scripts/config
and open your webpack.config.js. Inside this file search for babel options and add this preset:
presets: [
[
require.resolve('babel-preset-react-app'),
{
runtime: hasJsxRuntime ? 'automatic' : 'classic',
},
],
],
so your webpack.config file should look like
test: /\.(js|mjs|jsx|ts|tsx)$/,
include: paths.appSrc,
loader: require.resolve('babel-loader'),
options: {
customize: require.resolve(
'babel-preset-react-app/webpack-overrides'
),
presets: [
[
require.resolve('babel-preset-react-app'),
{
runtime: hasJsxRuntime ? 'automatic' : 'classic',
},
],
],
// @remove-on-eject-begin
babelrc: false,
configFile: false,
Upvotes: 1
Reputation: 121
In your Sanity folder, you can add this code to the .eslintrc file:
"eslint.workingDirectories": ["./web", "./studio"]
So it should be like this:
{
"extends": "@sanity/eslint-config-studio",
"eslint.workingDirectories": ["./web", "./studio"]
}
Upvotes: 12
Reputation: 11
You can just change your .eslinc files into:
["next/babel", "next/core-web-vitals"]
Upvotes: -1