You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ra...@apache.org on 2019/04/19 18:39:04 UTC

[incubator-openwhisk-runtime-nodejs] branch master updated: instructions on how to use linter (#123)

This is an automated email from the ASF dual-hosted git repository.

rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-runtime-nodejs.git


The following commit(s) were added to refs/heads/master by this push:
     new 0f88d94  instructions on how to use linter (#123)
0f88d94 is described below

commit 0f88d94d0ab33b9ae9bb7ecb0515496a5b4c2974
Author: Priti Desai <pd...@us.ibm.com>
AuthorDate: Fri Apr 19 11:38:59 2019 -0700

    instructions on how to use linter (#123)
---
 README.md                            | 19 +++++++++++++++++++
 core/nodejsActionBase/.eslintrc.json |  7 +++++++
 core/nodejsActionBase/package.json   |  8 ++++++++
 3 files changed, 34 insertions(+)

diff --git a/README.md b/README.md
index 53c11fd..3e10d0b 100644
--- a/README.md
+++ b/README.md
@@ -133,6 +133,25 @@ Using IntelliJ:
 -Dhttp.proxyPort=3128
 ```
 
+### How to use ESLint?
+
+ESLint can fix syntactic errors automatically by running:
+
+```
+git clone https://github.com/apache/incubator-openwhisk-runtime-nodejs.git
+cd core/nodejsActionBase
+npm install
+./node_modules/.bin/eslint --fix --ignore-path .gitignore .
+```
+
+`eslint` might produce few errors/warnings along with auto fixing syntax errors:
+
+```
+✖ 3 problems (3 errors, 0 warnings)
+```
+
+ESLint configuration file is located at (.eslintrc.json)[core/nodejsActionBase/.eslintrc.json] which can be updated if needed.
+
 # Disclaimer
 
 Apache OpenWhisk Runtime Node.js is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicat [...]
diff --git a/core/nodejsActionBase/.eslintrc.json b/core/nodejsActionBase/.eslintrc.json
new file mode 100644
index 0000000..d41dfbf
--- /dev/null
+++ b/core/nodejsActionBase/.eslintrc.json
@@ -0,0 +1,7 @@
+{
+  "extends": "standard",
+  "rules": {
+      "indent": ["error", 4],
+      "max-len": [2, 120, 8]
+  }
+}
diff --git a/core/nodejsActionBase/package.json b/core/nodejsActionBase/package.json
index 8322950..12d1ebd 100644
--- a/core/nodejsActionBase/package.json
+++ b/core/nodejsActionBase/package.json
@@ -1,6 +1,14 @@
 {
   "name": "nodejsAction",
   "version": "0.0.1",
+  "devDependencies": {
+    "eslint": "^5.16.0",
+    "eslint-config-standard": "^12.0.0",
+    "eslint-plugin-import": "^2.17.2",
+    "eslint-plugin-node": "^8.0.1",
+    "eslint-plugin-promise": "^4.1.1",
+    "eslint-plugin-standard": "^4.0.0"
+  },
   "dependencies": {
     "body-parser": "1.15.2",
     "btoa": "1.1.2",