From b8c7846c3d819999228c820b0c115f670243f0d2 Mon Sep 17 00:00:00 2001 From: Michael Krotscheck Date: Thu, 25 Jun 2015 17:08:40 -0700 Subject: [PATCH] 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 --- .eslintrc | 6 +----- horizon/static/auth/.eslintrc | 21 +++++++++++++++++++++ horizon/static/framework/.eslintrc | 6 ++++++ horizon/static/horizon/.eslintrc | 21 +++++++++++++++++++++ openstack_dashboard/.eslintrc | 6 ++++++ 5 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 horizon/static/auth/.eslintrc create mode 100644 horizon/static/framework/.eslintrc create mode 100644 horizon/static/horizon/.eslintrc create mode 100644 openstack_dashboard/.eslintrc diff --git a/.eslintrc b/.eslintrc index c0e7ab40f7..16ef85eedb 100644 --- a/.eslintrc +++ b/.eslintrc @@ -4,10 +4,6 @@ # By default, ESLint uses Espree as its parser. parser: espree -# Enable eslint-plugin-angular -plugins: - - angular - # Set up globals globals: angular: false @@ -786,7 +782,7 @@ rules: # specify the maximum length of a line in your program # http://eslint.org/docs/rules/max-len max-len: - - 2 # TODO(krotscheck): Activate & Fix + - 2 - 100 # Limits the number of parameters that can be used in function declaration. diff --git a/horizon/static/auth/.eslintrc b/horizon/static/auth/.eslintrc new file mode 100644 index 0000000000..34e1f993e3 --- /dev/null +++ b/horizon/static/auth/.eslintrc @@ -0,0 +1,21 @@ +# ESLint styles for Horizon's Legacy javascript code. These rule overrides exist to enforce an +# older linting style, to ensure backward compatibility. + +rules: + + # Various rules applicable to our new Code Style guidelines were only intermittently enforced + # in the legacy code, and were not addressed during the JSCS move. This disables the applicable + # rules. + camelcase: 0 + max-len: 0 + space-before-blocks: 0 + one-var: 0 + space-infix-ops: 0 + space-after-keywords: 0 + no-console: 0 + no-multiple-empty-lines: 0 + no-sync: 0 + no-process-exit: 0 + space-unary-ops: 0 + curly: 0 + indent: 0 diff --git a/horizon/static/framework/.eslintrc b/horizon/static/framework/.eslintrc new file mode 100644 index 0000000000..0babf5584b --- /dev/null +++ b/horizon/static/framework/.eslintrc @@ -0,0 +1,6 @@ +# ESLint styles for this section of horizon's codebase. It activates the John Papa +# Style plugin for all javascript files in this directory or below. + +# Enable eslint-plugin-angular +plugins: + - angular diff --git a/horizon/static/horizon/.eslintrc b/horizon/static/horizon/.eslintrc new file mode 100644 index 0000000000..34e1f993e3 --- /dev/null +++ b/horizon/static/horizon/.eslintrc @@ -0,0 +1,21 @@ +# ESLint styles for Horizon's Legacy javascript code. These rule overrides exist to enforce an +# older linting style, to ensure backward compatibility. + +rules: + + # Various rules applicable to our new Code Style guidelines were only intermittently enforced + # in the legacy code, and were not addressed during the JSCS move. This disables the applicable + # rules. + camelcase: 0 + max-len: 0 + space-before-blocks: 0 + one-var: 0 + space-infix-ops: 0 + space-after-keywords: 0 + no-console: 0 + no-multiple-empty-lines: 0 + no-sync: 0 + no-process-exit: 0 + space-unary-ops: 0 + curly: 0 + indent: 0 diff --git a/openstack_dashboard/.eslintrc b/openstack_dashboard/.eslintrc new file mode 100644 index 0000000000..0babf5584b --- /dev/null +++ b/openstack_dashboard/.eslintrc @@ -0,0 +1,6 @@ +# ESLint styles for this section of horizon's codebase. It activates the John Papa +# Style plugin for all javascript files in this directory or below. + +# Enable eslint-plugin-angular +plugins: + - angular