lukastaegert/eslint-plugin-tree-shaking

Improve error messages

lukastaegert opened this issue · 1 comments

Currently, the errors produced by eslint-plugin-tree-shaking may be accurate but also somewhat technical, i.e. "Could not determine side-effects of…".
Under this issue I want to collect ideas on how to improve this and give better feedback to the user.

I've been hunting down side effects in a large codebase. It's hard to get everything working. Adding lots of annotations isn't productive at this stage. What I really want is to identify the classes of problems to get an idea of what's going on. One technique I used is to add this to the error messages:

function generateIgnoreSuffix(module, filename) {
  return ' ' + JSON.stringify({'module': module, 'functions': [filename]});
}

Currently, it only works in some cases, but it's helpful in coming up with the list to ignore for the first pass and get an idea of how big the problems are and what are our next steps. It would be great to apply this to all error messages. It could be enabled with an option. While it's possible to go to the source line, it's hard if you are looking at hundreds of messages and want to aggregate them.