This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 485877 - [quickfix] provide fixes for no-new-wrappers rule
Summary: [quickfix] provide fixes for no-new-wrappers rule
Status: RESOLVED FIXED
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: JS Tools (show other bugs)
Version: 11.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 11.0   Edit
Assignee: Michael Rennie CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-14 14:54 EST by Michael Rennie CLA
Modified: 2016-01-15 12:04 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Rennie CLA 2016-01-14 14:54:56 EST
We should offer the following fixes for the no-new-wrappers rule:

1. remove the 'new' keyword (perhaps they actually want to call the function)
2. convert the value to a literal, for example:
   var n = new String("hi"); -> var n = "hi";
   var n = String(); -> var n = "";

   var n = new Boolean(true); -> var n = true;
   var n = Boolean(); -> var n = false;

   var n = new Number(12); -> var n = 12;
   var n = Number(); -> var n = 0;