Surya Hebbar has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/21970


Change subject: IMPALA-13473: Add support for JS code analysis and linting with 
ESLint
......................................................................

IMPALA-13473: Add support for JS code analysis and linting with ESLint

This patch adds support for JS code analysis and linting to webUI
scripts using ESLint.

Support to enforce code style and quality is partcularly beneficial,
as the codebase for client-side scripts is consistently growing.

The following code style and quality rules have been added using ESLint.
  - Disallow unused variables
  - Enforce strict equality (=== and !==)
  - Require curly braces for all control statements (if, while, etc.)
  - Enforce semicolons at the end of statements
  - Enforce double quotes for strings
  - Set maximum line length to 90
  - Disallow `var`, use `let` or `const`
  - Prefer `const` where possible
  - Disallow multiple empty lines
  - Enforce spacing around infix operators (eg. +, =)
  - Disallow the use of undeclared variables
  - Require parentheses around arrow function arguments
  - Require a space before blocks
  - Enforce consistent spacing inside braces
  - Disallow shadowing variables declared in the outer scope
  - Disallow constant conditions in if statements, loops, etc
  - Disallow unnecessary parentheses in expressions
  - Disallow duplicate arguments in function definitions
  - Disallow duplicate keys in object literals
  - Disallow unreachable code after return, throw, continue, etc
  - Disallow reassigning function parameters
  - Require functions to always consistently return or not return at all
  - Enforce consistent use of dot notation wherever possible
  - Disallow multiple empty lines

To execute code analysis the following commands can be used with
NodeJS installation present locally or in the toolchain directory.

For terminal output,

  npm run eslint

For JSON output,

  npm run eslint-json

Change-Id: Ieb3d0a9221738e2ac6fefd60087eaeee4366e33f
---
A www/scripts/.gitignore
A www/scripts/eslint.config.js
A www/scripts/eslint/eslint_custom_output_formatter.js
A www/scripts/package.json
M www/scripts/query_timeline/package.json
M www/scripts/tests/package.json
6 files changed, 89 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/70/21970/1
--
To view, visit http://gerrit.cloudera.org:8080/21970
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieb3d0a9221738e2ac6fefd60087eaeee4366e33f
Gerrit-Change-Number: 21970
Gerrit-PatchSet: 1
Gerrit-Owner: Surya Hebbar <[email protected]>

Reply via email to