This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 461929 - [eslint] Break out support for no-implied-eval from the no-eval rule to match upstream eslint
Summary: [eslint] Break out support for no-implied-eval from the no-eval rule to match...
Status: RESOLVED FIXED
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: JS Tools (show other bugs)
Version: 8.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 9.0   Edit
Assignee: Joshua Wilson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-11 11:32 EDT by Michael Rennie CLA
Modified: 2015-05-14 14:53 EDT (History)
3 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-03-11 11:32:47 EDT
Currently we support no-implied-eval as part of the no-eval rule. To stay more line with upstream eslint we should break it out into its own rule:

http://eslint.org/docs/rules/no-implied-eval.html
Comment 1 Joshua Wilson CLA 2015-04-28 15:13:14 EDT
I will try to fix this.
Comment 3 Joshua Wilson CLA 2015-04-30 18:29:40 EDT
Thanks for the direction.

I reviewed ESLint and the files your pointed me to and I am hoping you can clear up some confusion. It looks like ESLint already has the rules and the tests (though the tests are a different style). 

It appears that you are manually writing your own version of the rules instead of using the ones from ESLint. If that is true and can you help me understand why? The biggest difference that I found is their use of "module.export".

I'm just wondering if it would be easier to bring in the ESLint rules and just keep them up to date vs manually writing them.

Sorry for the nob question, I just started looking at the code base of Orion and I don't understand the history yet.
Comment 4 Michael Rennie CLA 2015-05-01 15:17:03 EDT
(In reply to Joshua Wilson from comment #3)
> Thanks for the direction.
> It appears that you are manually writing your own version of the rules
> instead of using the ones from ESLint. If that is true and can you help me
> understand why? 

The Eclipse foundation lawyers have issue with the IP provenance of the contributed rules for upstream ESLint. That is the sole reason we are coding our own (because we are not allowed to use the existing ones). I would love to be able to use the existing rules from ESLint, and this is one of the reasons we keep the same names - if some day we can use the upstream rules no changes will be required on our end.
Comment 5 Joshua Wilson CLA 2015-05-01 15:35:28 EDT
That occurred to me earlier today as a colleague was discussing IP in Eclipse. Thanks for the clarification.
Comment 6 Max Rydahl Andersen CLA 2015-05-01 17:41:34 EDT
Michael, is there a past and/or ongoing IPZilla discussing the reasons for not allowing use of ESLint ?
Comment 7 Mark Macdonald CLA 2015-05-01 18:41:21 EDT
(In reply to Max Rydahl Andersen from comment #6)
> Michael, is there a past and/or ongoing IPZilla discussing the reasons for
> not allowing use of ESLint ?

The original CQ request (with discussion) was here: https://dev.eclipse.org/ipzilla/show_bug.cgi?id=7466#c5

Since then, ESLint added a formal Contributor License Agreement, but it doesn't apply retroactively. In the legal folks' view, the only way to rectify this is for ESLint's maintainers to go through a provenance exercise -- basically tracking down the author of every line of contributed code that predates the CLA, and ensuring they agree to the CLA terms. The maintainers have not had the time for that thus far.
https://dev.eclipse.org/ipzilla/show_bug.cgi?id=8420
Comment 8 Eclipse Genie CLA 2015-05-04 15:21:42 EDT
New Gerrit change created: https://git.eclipse.org/r/47087
Comment 9 Michael Rennie CLA 2015-05-06 10:18:50 EDT
The changes look good. Just one missing piece though: we need to hook the new rule up in the validator to make sure that we can change its severity.

Have a look at: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/tree/bundles/org.eclipse.orion.client.javascript/web/javascript/validator.js

We either need to provide a new pref for the new rule, or just have the one pref for no-eval also control no-implied-eval.

Steps:
1. use the following snippet:

/*eslint-env browser */
eval('foo.bar'); //$NON-NLS-1$

setInterval(100);

setTimeout(200);

2. go to the prefs and set 'Discouraged eval use' to error
3. back in the editor 'eval' is marked, but setInterval and setTimeout are not.
Comment 10 Joshua Wilson CLA 2015-05-06 17:03:51 EDT
I think I have figured out what needed to be change.  

However I now have 2 commits, they both have the same Change-ID. 

Do I: 
1)push the second
2)rebase the commits into one commit
3)reset them and use commit --amend 

As I understand it 2 and 3 basically do the same thing.
Comment 11 Michael Rennie CLA 2015-05-07 12:26:21 EDT
(In reply to Joshua Wilson from comment #10)
> I think I have figured out what needed to be change.  
> 
> However I now have 2 commits, they both have the same Change-ID. 
> 
> Do I: 
> 1)push the second
> 2)rebase the commits into one commit
> 3)reset them and use commit --amend 
> 
> As I understand it 2 and 3 basically do the same thing.

If you amend the previous commit (with the same change-ID) and push it (to gerrit), the gerrit change will update (and only show as one change).
Comment 12 Joshua Wilson CLA 2015-05-07 13:38:15 EDT
As I understand it --amend only works if you haven't committed yet. Since I committed I would need to 'git reset --soft [sha index]' and then I could --amend the changes into the previous commit. Or I could just 'git rebase -i' and merge the 2 commits. 

My problem is that I think these 2 actions do the same thing but I am not sure.
Comment 13 Michael Rennie CLA 2015-05-07 14:13:02 EDT
(In reply to Joshua Wilson from comment #12)
> As I understand it --amend only works if you haven't committed yet. Since I
> committed I would need to 'git reset --soft [sha index]' and then I could
> --amend the changes into the previous commit. Or I could just 'git rebase
> -i' and merge the 2 commits. 
> 
> My problem is that I think these 2 actions do the same thing but I am not
> sure.

I would reset and re-commit, just to be safe :)
Comment 14 Joshua Wilson CLA 2015-05-07 15:14:32 EDT
I made the changes and I think I figured out how to make git do what I wanted.

The gerrit has been update too  https://git.eclipse.org/r/47087
Comment 15 Joshua Wilson CLA 2015-05-13 12:35:43 EDT
Please let me know if there is something else that I need to do for this issue.
Comment 17 Michael Rennie CLA 2015-05-14 14:53:37 EDT
(In reply to Joshua Wilson from comment #15)
> Please let me know if there is something else that I need to do for this
> issue.

Changes merged with master, thank you Joshua!