Commit Graph

28 Commits

Author SHA1 Message Date
Tatiana Ovchinnikova 807a33e1c8 Update ESLint devDependencies in package.json
This patch updates outdated JavaScript dev dependencies.

The latest ESLint version adds rules changes. Some rules are disabled
to prevent checks failures, some minor issues are fixed.

Change-Id: I01c5ccb5c8f7ceb827a3978157b4d76805d259c1
2020-12-16 12:20:10 -06:00
Matt Borland f0a11af56a Disabling warnings of 'quote-props'
Disables warnings of type 'quote-props' as discussed in a recent IRC meeting.

Change-Id: I36fd59dc639f93997bd9401e622f8ddfc662145e
Closes-Bug: 1583346
2016-05-18 15:04:00 -06:00
Michael Krotscheck a4d58e7101
Upgraded eslint-config-openstack to 1.2.4
This patch upgrades eslint to version 1.2.4, incorporating new rule
changes on no-undefined, brace-style, quote-props, space-in-parens,
no-use-before-define, no-uneeded-ternary, and quote.

For now, rules that have been activated that cause checks to fail
have been switched to warning-only. Additionally, rules that
have been entirely disabled have been removed.

Change-Id: Ifba7a19da669288cb19cfc8055bdfa7b94f00292
2016-04-13 05:13:59 -07:00
Matt Borland 74fe0ac371 Cleaning code to remove eslint warnings from Launch Instance
Cleans up eslint warnings.

Change-Id: I920f434c008c4679ce5758c70031d1ec5d26a2b7
Partial-Bug: 1554824
2016-03-18 14:23:48 -06:00
Jenkins 5ee95b95ee Merge "Enable "no-new" and "guard-for-in"" 2016-01-31 09:55:18 +00:00
Jenkins 76038f1673 Merge "Enable no-redeclare" 2016-01-30 01:21:09 +00:00
Jenkins d62393941b Merge "Enable semi-spacing" 2016-01-28 01:02:32 +00:00
Jenkins a2ef8b232e Merge "Enable consistent-return" 2016-01-27 23:20:25 +00:00
Rajat Vig 846413c149 Update eslint-plugin-angular to the latest
eslint-plugin-angular in use by the project is
quite old and the new library has changed rules.
This patch updates the library and fixes the code
where rule names have changed.

Change-Id: I2e60a07b899325f17f38b96d40325602b4b58219
Closes-Bug: #1527417
2016-01-11 10:42:06 -08:00
Michael Krotscheck b68efcaffb Enable "no-new" and "guard-for-in"
This patch enables both the "no-new" and the "guard-for-in" rules
from upstream eslint-config-openstack. There were no detected
violations for the former, and the latter is only set to "warn"
in eslint-config-openstack.

http://eslint.org/docs/rules/no-new
http://eslint.org/docs/rules/guard-for-in

Change-Id: Iac9eaba6ac3532795ce26e55d1304ba3c67ccff2
2015-12-23 09:48:10 -08:00
Michael Krotscheck c6c7110a9c Enable no-redeclare
This enables the no-redeclare linting rule from eslint-config-openstack,
and corrects any errors found.

Change-Id: I2835b3ee9e20b735901315aa19919eb810cf5b75
2015-12-23 09:47:20 -08:00
Michael Krotscheck 4e52904000 Enable semi-spacing
This patch enables the "semi-spacing" rule from eslint-config-openstack,
and corrects any errors found.

http://eslint.org/docs/rules/semi-spacing

Change-Id: Ib6a2d856f24b53b24c65c4165cec92a7c1428832
2015-12-23 09:47:19 -08:00
Michael Krotscheck 91ceb5c6fa Enable consistent-return
This rule enables the "consistent-return" eslint rule from eslint-config-openstack,
and corrects any linting errors found.

http://eslint.org/docs/rules/consistent-return

Change-Id: Icf048ff81d3a1339a27a15c42822c293d335d259
2015-12-23 09:47:17 -08:00
Michael Krotscheck 1b9d22fd5c Enable strict
This rule enables the "strict" eslint rule from eslint-config-openstack,
and corrects any linting errors found.

http://eslint.org/docs/rules/strict

Change-Id: Id7d5a6ec89e664dbf391fc0e2a2e8491057ab2be
2015-12-04 08:45:56 -08:00
Michael Krotscheck 06f1547add Enable eqeqeq
This enables the eqeqeq linting rule from eslint-config-openstack,
and corrects any errors found.

http://eslint.org/docs/rules/eqeqeq

Change-Id: Iad857ae3f9963c7cb93c494d351c3908d87cd4a0
2015-11-25 08:20:57 -08:00
Michael Krotscheck 87a8f3bee5 Enable radix
This enables the radix linting rule from eslint-config-openstack,
and corrects any found errors.

Change-Id: Icfb8dd7a91770a84f94468693609093aedd31337
2015-11-18 10:14:30 -08:00
Michael Krotscheck 2aa78ad0b7 Enable no-unused-vars
This enables the no-unused-vars rule from the upstream
eslint-config-openstack, and corrects all linting errors found.

Change-Id: I9f5fb29cd9b2429698819ecf556ced933378b081
2015-11-18 10:14:28 -08:00
Michael Krotscheck 1dd3a7fd5b Enable no-multi-spaces
Enable the no-multi-spaces rule, and correct linting errors
where found.

Change-Id: Ia7ed2a35d69b455e92849df2ccde9d9cf8e7a104
2015-11-16 18:04:16 -08:00
Michael Krotscheck bfa5c71de3 Upgraded eslint-config-openstack to 1.2.3
This updates eslint-config-openstack to 1.2.3, and downgrades the
new rules so we can tackle them one at a time.

Change-Id: I3d7a20a6141a8748a60ceefcd33a1310456302dd
2015-11-16 18:04:12 -08:00
Michael Krotscheck d7ef2b34bf Upgraded eslint rule libraries.
The newer version of eslint comes with somewhat stricter rules
about indentation and whitespace, so some files have been
adjusted to accomodate.

The newer version of eslint-config-openstack includes a relaxed
version requirement for eslint, as well as a switch/case
indentation update.

The newer version of the angular eslint rules includes a
deprecation rule for $cookieStorage, which has been set to
warning.

Change-Id: Id201a42e3ab484222f938a541507df2e96da2dcf
Partially-Implements: blueprint jscs-cleanup
2015-10-16 06:34:25 -07:00
Michael Krotscheck 066780fd43 Use eslint-config-openstack
Instead of explicitly copying all the linting rules between projects,
openstack now publishes a set of rules (much like hacking) that can
be included in projects that want to adhere by our standards. This
patch switches horizon to use this set of rules.

Note: The rules in eslint-config-openstack are a verbatim copy
of what's currently in use in Horizon. Future versions will likely start
activating rules flagged as "TODO", however you can avoid build
instability by avoiding the use of fuzzy version matching in
package.json (which this patch does).

Change-Id: Ib93e0def096999ece7f636d028e3b1ecd4a4facc
2015-07-15 13:36:55 -07:00
Michael Krotscheck acf0511944 Revert "Ignore the ng_on_watch error from eslint"
This reverts commit 9b21076650.

The original commit was merged with a -1. The concern raised was
that it does not force engineers to clean up after themselves, which
is a best practice explicitly mentioned in the John Papa style guides
under Y070. While this rule is only specific to directives, it's
common sense, and the directive to "clean up your pointers" goes
back as far as C.

https://github.com/johnpapa/angular-styleguide#style-y070

Change-Id: Iea243c2b0b3c6154c5b02fd9e29172e1d5e3b434
2015-07-13 08:57:53 -07:00
Jenkins 1246a3605d Merge "Add selective ESLint rule activation for Horizon Legacy JS" 2015-07-11 00:57:07 +00:00
Jenkins 82941cc6cc Merge "Ignore the ng_on_watch error from eslint" 2015-07-10 18:42:46 +00:00
Travis Tripp 5af83b582c Change the ESLINT controller as to ctrl
This rule forces the controller to be named vm.  This is
too strict and also is a very overload term in OpenStack.

So, making this a warning and looking for ctrl.

Change-Id: Ieadf2f0b2d91c3c6979a6a65652d37f0c2980178
Partially-Implements: blueprint jscs-cleanup
2015-07-09 16:50:21 -06:00
Michael Krotscheck b8c7846c3d Add selective ESLint rule activation for Horizon Legacy JS
This patch adds the files for eslint overrides in the two different
segments of horizon's codebase: Legacy and Dashboard. There are
quite a few rules that had to be deactivated, which will reduce
the effectiveness of legacy linting.

Note: You cannot disable plugins in .eslintrc files, you can
only enable them. This is why there appear to be two redundant
.eslintrc files that enable the angular rules.

Change-Id: I5768cbc43e788a4320a6bb637c263dc3c3df3db9
Partially-Implements: blueprint jscs-cleanup
2015-07-08 17:06:15 -07:00
Nathan Zeplowitz 9b21076650 Ignore the ng_on_watch error from eslint
Based on the discussion at
https://github.com/Gillespie59/eslint-plugin-angular/issues/114
it seems that the rule is only applicable when the watches are
assigned on the $rootScope.
This rule is also not a part of the JP style guide.

Change-Id: Ic8c218c7d46229a4a2e7d9dcd951433aedd9d1ca
Partially-Implements: blueprint jscs-cleanup
2015-07-07 11:58:54 -07:00
Michael Krotscheck c6c0352982 Switched from JSCS to ESLint
This patch switches horizon from using JSCS to using ESlint. It
adds the john papa style guides as an eslint plugin, and deactivates
additional linting rules so current cleanup efforts can focus on the
issues remaining from JSCS. Once that cleanup effort is complete,
we can switch our linting job to voting and move forward from there.

YAML for .eslintrc was chosen because the JSON specification does
not allow comments, and having comments (including rule links) will
make it easier to discuss linting changes.

Deactivated eslint rules have each been annotated with a # TODO
statement, so we can address them in the future. Links in the
documentation have been updated to new contributor guidelines, which
will be updated after this patch lands.

Linting may be executed by first installing npm dependencies using
`npm install`, and then executing `npm run lint` at any time in the
future. No python venv is required.

For clarification: We are switching to ESLint because JSCS explicitly
focuses on code-style, not on language use errors. For that purpose,
JSCS explicitly defers to JSHint, which due to the 'do no evil' license is
not usable. Since ESLint provides both the codestyle functionality, and
the language use checks, of both JSCS and JSHint, it was deemed the
only viable tool,

http://lists.openstack.org/pipermail/openstack-dev/2015-June/067030.html

Change-Id: Ib4c3f77f8cc3cdaa3c7558b7bc3a6d1299b6dcbe
Partially-Implements: blueprint jscs-cleanup
2015-06-30 23:00:29 -07:00