JS: Ignore JSON-like files in js/useless-expression#3401
Conversation
|
If the goal is to exclude json-like constructs only, then I think we should try a little harder to weed out illegal json. Some ideas: can we remove variable references, function literals, regexp literals, calls? (We have previously tried to classify entire json-like files as generated, but we never found a scalable way to to that reliably.) |
|
Looking great! 👍 We should probably exclude |
I've removed function literals from the check for now. When I look at the results we no longer flag I only want to remove functions from those.
I don't think there is any need for that. |
|
An evaluation looks fine. |
The anomalous query results found a project with a lot of useless-expressions.
However, most of those results were from JSON-like files. And while the expressions are useless, the warning looks benign.
I added a condition on the
js/useless-expressionso it doesn't report an expression if the containing file only contains that expression.That pattern is somewhat common.
I could possibly restrict it further, such that we still report a useless expression if the expression contains a function?