Surya Hebbar has uploaded a new patch set (#4). ( 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 - Enforce spacing around the colon in object literal properties For nodejs installation, which is required for JS tests as well as linting, a seperate common script has been added to the "bin/nodejs" directory. The script now uses "IMPALA_NODEJS_VERSION" from "impala-config.sh". JS code review comments for the changed files are generated using ESLint in JSON format within "critique-gerrit-review.py", after code analysis using the set linting rules. Change-Id: Ieb3d0a9221738e2ac6fefd60087eaeee4366e33f --- M bin/jenkins/critique-gerrit-review.py A bin/nodejs/setup_nodejs.sh M tests/run-js-tests.sh 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 9 files changed, 226 insertions(+), 46 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/70/21970/4 -- 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: newpatchset Gerrit-Change-Id: Ieb3d0a9221738e2ac6fefd60087eaeee4366e33f Gerrit-Change-Number: 21970 Gerrit-PatchSet: 4 Gerrit-Owner: Surya Hebbar <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Michael Smith <[email protected]> Gerrit-Reviewer: Surya Hebbar <[email protected]>
