I recently tried linting my react native project. While linting, I made some installation and changes, but it rained a storm of errors in my code afterwards. I've tried reversing to branches before that but it just keeps throwing the same error.
Important to note that these errors occur in some files and not in some others. I can't seem to find the pattern here.
I have tried the solution found here (NPM package cannot be used as a JSX Component - Type errors) to no avail. Here's what some of my files look like:
.eslint.js
module.exports = {
root: true,
extends: '@react-native-community',
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'@typescript-eslint/no-shadow': ['error'],
'no-shadow': 'off',
'no-undef': 'off',
'no-console': 'warn',
},
},
],
};
tsconfig.js
{
"compilerOptions": {
"allowJs": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"isolatedModules": true,
"jsx": "react-native",
"lib": ["es2017"],
"moduleResolution": "node",
"noEmit": true,
"strict": true,
"target": "esnext"
},
"exclude": [
"node_modules",
"babel.config.js",
"metro.config.js",
"jest.config.js"
]
}
I also added a resolutions in my package.json
:
"resolutions": {
"@types/react": "17.0.30",
"@types/react-dom": "17.0.2"
},