You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Armand Grillet (JIRA)" <ji...@apache.org> on 2017/09/07 15:36:00 UTC

[jira] [Comment Edited] (MESOS-7924) Add a javascript linter to the webui.

    [ https://issues.apache.org/jira/browse/MESOS-7924?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16157096#comment-16157096 ] 

Armand Grillet edited comment on MESOS-7924 at 9/7/17 3:35 PM:
---------------------------------------------------------------

bq. here we seem to only need ESLint if we're changing code?

Correct. To lint Python we install Pylint in a virtual environment in src/python/cli_new (this is done automatically when a developer creates a commit including a .py file), we can do something similar for the .js code in the webui. A project such as https://github.com/ekalinin/nodeenv allows us to have a Python virtual environment for the webui and then use npm in it to install ESLint.

The structure would be:
# New class JsLinter in support/mesos-style.py, similar to PyLinter.
# New bootstrap file in src/webui/master, similar to the one in src/python/cli_new.
# New pip-requirements file in src/webui/master containing only a specific version of nodeenv.
# An activate and deactivate files in src/webui/master to handle the virtual environment.

The new bootstrap script will then do what is necessary to run ESLint and we will have a line like [this one|https://github.com/apache/mesos/blob/e5778d6730124890764c33384bd5be631cea9097/support/mesos-style.py#L308] but using the [ESLint CLI|https://eslint.org/docs/user-guide/command-line-interface]. This approach seems the most understandable due to how we currently lint Python, should I work on it?



was (Author: armandgrillet):
bq. here we seem to only need ESLint if we're changing code?

Correct. To lint Python we have a virtual environment in src/python/cli_new, this environment gets created when a Python file is modified in the codebase. We can do the same for the webui. A project such as https://github.com/ekalinin/nodeenv allows us to have a Python virtual environment for the webui and then use npm in it to install ESLint.

The structure would be:
# New class JsLinter in support/mesos-style.py, similar to PyLinter.
# New bootstrap file in src/webui/master, similar to the one in src/python/cli_new.
# New pip-requirements file in src/webui/master containing only a specific version of nodeenv.
# An activate and deactivate files in src/webui/master to handle the virtual environment.

The new bootstrap script will then do what is necessary to run ESLint and we will have a line like [this one|https://github.com/apache/mesos/blob/e5778d6730124890764c33384bd5be631cea9097/support/mesos-style.py#L308] but using the [ESLint CLI|https://eslint.org/docs/user-guide/command-line-interface]. This approach seems the most understandable due to how we lint Python, should I work on it?


> Add a javascript linter to the webui.
> -------------------------------------
>
>                 Key: MESOS-7924
>                 URL: https://issues.apache.org/jira/browse/MESOS-7924
>             Project: Mesos
>          Issue Type: Improvement
>          Components: webui
>            Reporter: Benjamin Mahler
>              Labels: tech-debt
>
> As far as I can tell, javascript linters (e.g. ESLint) help catch some functional errors as well, for example, we've made some "strict" mistakes a few times that ESLint can catch: MESOS-6624, MESOS-7912.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)