Community
Participate
Working Groups
Its all too common to see functions that return more than one type (String and Number for example). We should detect this as an error by default, it makes the use of functions more difficult than they need to be - especially for ones with no doc
Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see: https://dev.eclipse.org/mhonarc/lists/orion-dev/msg03444.html
reopen
Michael, do you mean adding the rules "http://eslint.org/docs/rules/consistent-return" to fix this issue? If yes, I'll take it.
This rule is actually not exactly what you expect as it doesn't check the actual return type. It only checks that all return points return a value or no value, but they are all consistent. What you want is that not only they all return a value, but the value should be of the same type. I'll see if I can simply modify the existing rule implementation.
New Gerrit change created: https://git.eclipse.org/r/62965
Problem message should be "Inconsistent return types" Would be better to return a list of the different types "Inconsistent return types: string, boolean" "Inconsistent return types: string, undefined" Or for missing return types we can use the ESLint language: Expected no return value. I think we'll revisit this in January.
(In reply to Curtis Windatt from comment #6) > Problem message should be "Inconsistent return types" > Would be better to return a list of the different types > "Inconsistent return types: string, boolean" > "Inconsistent return types: string, undefined" > Or for missing return types we can use the ESLint language: Expected no > return value. I thought about reporting the found types. I was not sure the best message for this.
I abandonned the change in gerrit. I made local improvements but I still need to be able to handle cases like: return "" and return "" + 15; In both cases, this returns a string. Need more work.
New Gerrit change created: https://git.eclipse.org/r/63472
(In reply to Eclipse Genie from comment #9) > New Gerrit change created: https://git.eclipse.org/r/63472 Abandonned as well. Got created during a sync up with master by mistake.
New Gerrit change created: https://git.eclipse.org/r/63482
New Gerrit change created: https://git.eclipse.org/r/63604
(In reply to Eclipse Genie from comment #12) > New Gerrit change created: https://git.eclipse.org/r/63604 Abandonned again as it doesn't apply cleanly on master anymore. A new change is underway.
New Gerrit change created: https://git.eclipse.org/r/63759
Reverting the change and trying to create it again. For some reason, it looks like the change cannot be properly merged with master.
New Gerrit change created: https://git.eclipse.org/r/63865
Gerrit change https://git.eclipse.org/r/63865 was merged to [master]. Commit: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=5b2e6720ba683db14e6902185db4ee3a43860d9a