I'm trying to lint my React+Typescript project properly (with ESLint). I have a component in which i'm importing useParams hook from react-router.
import { useParams } from 'react-router';
ESLint is giving me error on that line
ESLint: '@types/react-router' should be listed in the project's dependencies, not devDependencies.(import/no-extraneous-dependencies)
As i guess @types/react-router is not needed in resulting build, because browsers don't understand TypeScript. So i have 2 questions here:
- why rule says
@types/react-routershould be listed in dependencies and not in devDependencies? - should i indeed move
@types/react-routerto dependencies? - Can i just disable that rule? If so, how can i understand when i can disable ESLint rules and when i should resolve ESLint error?
Thank you!