Search code examples
eslinttypescript-eslint

eslint error for using a specific function


I have a function in my react application which I want to move away from. I want to show eslint error when a developer calls/uses that function. Is there a way for that.

For now I have used @deprecated comment on top with some info on why not to use it. It strikes through anywhere where the function is called.


Solution

  • Yup, you're doing the exact right thing: @deprecated is the right JSDoc/TSDoc tag for this. eslint-plugin-deprecation is an ESLint plugin that can be configured to give errors or warnings on uses of things marked as @deprecated.