Typescript parsing error when EXTEND_ESLINT=true in create-react-app
UPDATE: Update react-scripts to latest version at least 3.4.1. It's fixed.
For pre 3.4.1 versions of react-scripts,
Open node_modules/react-scripts/config/webpack.config.js
Replace code block from line 365 with this code.
if (process.env.EXTEND_ESLINT === 'true') {
return undefined
} else {
return {
extends: [require.resolve('eslint-config-react-app')],
};
}
})(),
useEslintrc: process.env.EXTEND_ESLINT === 'true',
Now if you start your app by yarn or npm, you will see it is fixed.
The fix is originally introduced here
https://github.com/facebook/create-react-app/issues/7776#issuecomment-567587642
Run npx patch-package react-scripts
to make a patch for it.
And add "postinstall": "patch-package"
to your package.json scripts section.
The patch will be automatically applied after npm install