Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 464609 - Non-nls rule marks too many literals
Summary: Non-nls rule marks too many literals
Status: RESOLVED FIXED
Alias: None
Product: Orion
Classification: ECD
Component: JS Tools (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 9.0   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 428429
Blocks:
  Show dependency tree
 
Reported: 2015-04-14 10:25 EDT by Michael Rennie CLA
Modified: 2015-04-15 14:08 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Rennie CLA 2015-04-14 10:25:34 EDT
The new rule to mark missing NLS comments for string literals is cool, but it marks way too many literals that will not ever be shown to a person (i.e. needing to be translated).

Consider the following snippet:

var c = 'me';
if(c === ',') {
	var o = {
		"one": 1
	}
	function f(){}
	f("d");
}

we should be ignoring literals used in 

1. comparisons
2. object keys
3. typeof / unary expressions

as we find more we can update this list.
Comment 1 Mark Macdonald CLA 2015-04-14 10:39:43 EDT
4. "use strict";


:)
Comment 2 Michael Rennie CLA 2015-04-14 12:12:29 EDT
Also the pref is in the wrong spot on the pref page and spelled wrong.
Comment 3 Curtis Windatt CLA 2015-04-14 16:27:15 EDT
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=5a917ba46af47cb7a02c6826cf5d579c2f2a46f7
Added exceptions for binary/unary expressions and object keys (and 'use strict'). I changed the wording of the preference to match what is in Eclipse and put it alphabetically.

Mike suggested renaming the rule to match this wiki page:
https://wiki.eclipse.org/Orion/ESLint

So I will do that as part of this bug.
Comment 4 Curtis Windatt CLA 2015-04-14 17:20:08 EDT
(In reply to Curtis Windatt from comment #3)
> Mike suggested renaming the rule to match this wiki page:
> https://wiki.eclipse.org/Orion/ESLint
> 
> So I will do that as part of this bug.

I have the changes ready in my workspace, but had two issues, 1) eslint crashes because it is still looking for the previous rule setting and 2) eventually my editor wouldn't load at all.
Comment 5 Curtis Windatt CLA 2015-04-15 14:08:14 EDT
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=e09c8026f8511a9f466d926cddcd7642179aaa74

This commit contains the entirety of this fix (fix in comment #3 + name change comment #4 + Bug 380818 + Ignore require('foo') call expressions.  This was necessary due to Git History shenanigans: Bug 464709