diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 000000000..d328b76ab --- /dev/null +++ b/.eslintrc @@ -0,0 +1,52 @@ +# For a detailed list of all options please see here: +# http://eslint.org/docs/configuring/ + +env: +# Use jquery global variables + jquery: true + browser: true + +rules: + # Specify whether backticks, double or single quotes should be used + # http://eslint.org/docs/rules/quotes + quotes: + - 0 # TODO(kzaitsev): Activate & Fix + - 'single' + + # Require camel case names + # http://eslint.org/docs/rules/camelcase + camelcase: + - 1 + - properties: "never" + + +globals: + # allow accessing horizon + horizon: false + +# Only support ECMA5, disable everything else. +# NOTE(kzaitsev): blatantly copied from horizon +ecmaFeatures: + arrowFunctions: false + binaryLiterals: false + blockBindings: false + classes: false + defaultParams: false + destructuring: false + forOf: false + generators: false + modules: false + objectLiteralComputedProperties: false + objectLiteralDuplicateProperties: false + objectLiteralShorthandMethods: false + objectLiteralShorthandProperties: false + octalLiterals: false + regexUFlag: false + regexYFlag: false + restParams: false + spread: false + superInFunctions: false + templateStrings: false + unicodeCodePointEscapes: false + globalReturn: false + jsx: false diff --git a/.gitignore b/.gitignore index b929a66de..9a6e6ef0c 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,5 @@ doc/source/api # Tests muranodashboard/test/functional/config/config.conf +node_modules +npm-debug.log diff --git a/package.json b/package.json new file mode 100644 index 000000000..da0aec2af --- /dev/null +++ b/package.json @@ -0,0 +1,15 @@ +{ + "version": "0.0.0", + "private": true, + "name": "muranodashboard", + "description": "Murano Dashboard", + "repository": "none", + "license": "Apache 2.0", + "devDependencies": { + "eslint": "^0.23.0" + }, + "scripts": { + "lint": "eslint --no-color muranodashboard/static" + }, + "dependencies": {} +} diff --git a/test-requirements.txt b/test-requirements.txt index 717ca9d32..cf987502f 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -22,3 +22,6 @@ sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 Django<1.8,>=1.4.2 django-compressor>=1.4 django-openstack-auth!=1.1.8,>=1.1.7 + +# js lint tests +nodeenv>=0.9.4 # BSD License diff --git a/tox.ini b/tox.ini index 7e182ba50..e71a23742 100644 --- a/tox.ini +++ b/tox.ini @@ -33,6 +33,13 @@ commands = nosetests --cover-erase --cover-package=muranodashboard --with-xcover deps = flake8 commands = flake8 +[testenv:eslint] +deps = -r{toxinidir}/test-requirements.txt +passenv = * +commands = nodeenv -p + npm install + npm run lint + [tox:jenkins] downloadcache = ~/cache/pip