> On April 11, 2018, 10:42 p.m., Benjamin Mahler wrote:
> > src/webui/app/agents/agent-browse-controller.js
> > Lines 35 (patched)
> > <https://reviews.apache.org/r/66554/diff/1/?file=1995816#file1995816line35>
> >
> >     I noticed these .js files just assume the right js files are already 
> > "imported" and there is a globals table in the linter? Is this how it's 
> > normally done or do files explicitly import other files? It struck me as 
> > tedious that we would have to keep a globals table up-to-date for the 
> > linter.

In JavaScript, the scope of a variable is its current execution context, i.e. 
either the enclosing function or global. ESLint offers two options to handle 
global variables as shown in 
https://eslint.org/docs/user-guide/configuring#specifying-globals. 
The issue with the first option, using `/* global var1, var2 */`, is that we 
need to add that comment in each file using `var1` or `var2`. My wish would 
have been to add e.g. `/* global updateMetrics, updateState */` in `utils.js` 
but this is not possible from what I have seen during my tests. 
The second solution, used in this review request, is a burden but does not 
oblige us to specify globals in multiple files.
A third solution would be to disable the `no-undef` rule but, from my 
experience, having those error messages can be useful.


- Armand


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/66554/#review200941
-----------------------------------------------------------


On April 11, 2018, 3:23 p.m., Armand Grillet wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/66554/
> -----------------------------------------------------------
> 
> (Updated April 11, 2018, 3:23 p.m.)
> 
> 
> Review request for mesos, Benjamin Mahler and Till Toenshoff.
> 
> 
> Bugs: MESOS-8503
>     https://issues.apache.org/jira/browse/MESOS-8503
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Removes `controllers.js` and adds one file per controller. The shared
> functions are now in a file called `utils.js` and the linter has been
> updated to know about it. This gives more freedom to add or update
> each controller while making the structure of the UI more visible.
> 
> 
> Diffs
> -----
> 
>   src/Makefile.am 9f4b6d369a23af337e2384e52e3e41f4017df38a 
>   src/webui/app/agents/agent-browse-controller.js PRE-CREATION 
>   src/webui/app/agents/agent-controller.js PRE-CREATION 
>   src/webui/app/agents/agent-executor-controller.js PRE-CREATION 
>   src/webui/app/agents/agent-framework-controller.js PRE-CREATION 
>   src/webui/app/agents/agent-task-and-executor-rerouter-controller.js 
> PRE-CREATION 
>   src/webui/app/agents/agents-controller.js PRE-CREATION 
>   src/webui/app/app.js 7de0899c2071c5127881fb725d0dd0246b10f849 
>   src/webui/app/controllers.js 66a4f2955a88fa44c3e5c717e9ce6b680050cc34 
>   src/webui/app/frameworks/framework-controller.js PRE-CREATION 
>   src/webui/app/frameworks/frameworks-controller.js PRE-CREATION 
>   src/webui/app/home.html  
>   src/webui/app/home/home-controller.js PRE-CREATION 
>   src/webui/app/maintenance/maintenance-controller.js PRE-CREATION 
>   src/webui/app/offers/offers-controller.js PRE-CREATION 
>   src/webui/app/roles/roles-controller.js PRE-CREATION 
>   src/webui/app/services.js  
>   src/webui/app/shared/main-controller.js PRE-CREATION 
>   src/webui/app/shared/utils.js PRE-CREATION 
>   src/webui/index.html 149d765429dc2211875783129da6c6b101f38ecf 
>   support/.eslintrc.js cd23ddebd2b40f795fa297e6decacada356a01f8 
> 
> 
> Diff: https://reviews.apache.org/r/66554/diff/1/
> 
> 
> Testing
> -------
> 
> ```
> GTEST_FILTER="" make check -j4
> ```
> And tested manually.
> 
> 
> Thanks,
> 
> Armand Grillet
> 
>

Reply via email to