From 44f689d18781f41ac1dbd7ca1f788af4625968fb Mon Sep 17 00:00:00 2001 From: "F. Hinkelmann" Date: Wed, 14 Nov 2018 17:39:21 -0500 Subject: [PATCH] Remove semistandard from appengine configs (#902) Remove semistandard from appengine configs. Use eslint and prettier. --- .eslintignore | 2 +- README.md | 4 ---- appengine/analytics/package.json | 5 +---- appengine/building-an-app/build/package.json | 5 +---- appengine/building-an-app/update/package.json | 8 ++------ appengine/cloudsql/package.json | 6 +++--- appengine/cloudsql_postgresql/package.json | 6 +++--- appengine/datastore/package.json | 5 +---- appengine/endpoints/package.json | 8 ++++---- appengine/errorreporting/app.js | 2 +- appengine/errorreporting/package.json | 6 ++---- appengine/headless-chrome/package.json | 5 +---- appengine/hello-world/flexible/package.json | 7 ++----- appengine/hello-world/standard/package.json | 5 +---- appengine/mailjet/package.json | 6 +----- appengine/metadata/flexible/package.json | 5 +---- appengine/metadata/standard/package.json | 5 +---- appengine/storage/flexible/package.json | 2 +- appengine/storage/flexible/system-test/.eslintrc.yaml | 3 +++ appengine/storage/flexible/system-test/app.test.js | 2 +- appengine/storage/standard/system-test/.eslintrc.yaml | 3 +++ appengine/storage/standard/system-test/app.test.js | 2 +- appengine/system-test/all.test.js | 2 +- appengine/twilio/app.js | 4 +++- appengine/typescript/package.json | 3 +-- appengine/uglifyjs/package.json | 4 +--- appengine/uglifyjs/static/.eslintrc.yaml | 3 +++ 27 files changed, 44 insertions(+), 74 deletions(-) create mode 100644 appengine/storage/flexible/system-test/.eslintrc.yaml create mode 100644 appengine/storage/standard/system-test/.eslintrc.yaml create mode 100644 appengine/uglifyjs/static/.eslintrc.yaml diff --git a/.eslintignore b/.eslintignore index e0b31fc01e..a9e0165c94 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,4 +2,4 @@ appengine/loopback/* functions/** iot/* -appengine/* +appengine/parse-server/cloud/main.js \ No newline at end of file diff --git a/README.md b/README.md index 508544354a..d673a4a92c 100644 --- a/README.md +++ b/README.md @@ -131,14 +131,10 @@ on Google Cloud Platform. Read more about [Google Cloud Platform Authentication][gcp_auth]. - __Note for running unit tests:__ - - Install [semistandard][] (lint tool) [node]: https://nodejs.org/ [auth_command]: https://cloud.google.com/sdk/gcloud/reference/beta/auth/application-default/login [gcp_auth]: https://cloud.google.com/docs/authentication#projects_and_resources -[semistandard]: https://www.npmjs.com/package/semistandard ### How to run a sample diff --git a/appengine/analytics/package.json b/appengine/analytics/package.json index c5730a5285..5e295ddcd4 100644 --- a/appengine/analytics/package.json +++ b/appengine/analytics/package.json @@ -14,8 +14,6 @@ }, "scripts": { "start": "node app.js", - "lint": "semistandard '**/*.js'", - "pretest": "npm run lint", "system-test": "repo-tools test app", "test": "npm run system-test" }, @@ -24,8 +22,7 @@ "got": "8.3.2" }, "devDependencies": { - "@google-cloud/nodejs-repo-tools": "^3.0.0", - "semistandard": "^12.0.1" + "@google-cloud/nodejs-repo-tools": "^3.0.0" }, "cloud-repo-tools": { "test": { diff --git a/appengine/building-an-app/build/package.json b/appengine/building-an-app/build/package.json index ab864d8ab3..632b720f7c 100644 --- a/appengine/building-an-app/build/package.json +++ b/appengine/building-an-app/build/package.json @@ -7,8 +7,6 @@ "scripts": { "start": "node server.js", "deploy": "gcloud app deploy", - "lint": "samples lint", - "pretest": "npm run lint", "test": "samples test app" }, "repository": { @@ -25,8 +23,7 @@ }, "devDependencies": { "@google-cloud/nodejs-repo-tools": "1.4.17", - "ava": "0.25.0", - "semistandard": "^12.0.1" + "ava": "0.25.0" }, "cloud-repo-tools": { "requiresKeyFile": false, diff --git a/appengine/building-an-app/update/package.json b/appengine/building-an-app/update/package.json index 9f435efb47..1c72dce61d 100644 --- a/appengine/building-an-app/update/package.json +++ b/appengine/building-an-app/update/package.json @@ -7,8 +7,6 @@ "scripts": { "start": "node server.js", "deploy": "gcloud app deploy", - "lint": "samples lint", - "pretest": "npm run lint", "test": "ava --verbose test/*.test.js" }, "repository": { @@ -22,12 +20,10 @@ "license": "Apache-2.0", "dependencies": { "body-parser": "^1.18.2", - "express": "^4.16.3", - "semistandard": "^12.0.1" + "express": "^4.16.3" }, "devDependencies": { "@google-cloud/nodejs-repo-tools": "1.4.17", - "ava": "0.25.0", - "semistandard": "^12.0.1" + "ava": "0.25.0" } } diff --git a/appengine/cloudsql/package.json b/appengine/cloudsql/package.json index e508f8e6fd..172ec103d6 100644 --- a/appengine/cloudsql/package.json +++ b/appengine/cloudsql/package.json @@ -13,8 +13,6 @@ "node": ">=8" }, "scripts": { - "lint": "semistandard '**/*.js'", - "pretest": "npm run lint", "unit-test": "ava --verbose test/*.test.js", "start-proxy": "! pgrep cloud_sql_proxy > /dev/null && cloud_sql_proxy -instances=$INSTANCE_CONNECTION_NAME=tcp:$SQL_PORT &", "system-test": "repo-tools test app -- server.js", @@ -32,7 +30,9 @@ "devDependencies": { "@google-cloud/nodejs-repo-tools": "^3.0.0", "ava": "0.25.0", - "semistandard": "^12.0.1" + "proxyquire": "^2.1.0", + "sinon": "^7.1.1", + "supertest": "^3.3.0" }, "cloud-repo-tools": { "requiresKeyFile": true, diff --git a/appengine/cloudsql_postgresql/package.json b/appengine/cloudsql_postgresql/package.json index 37ee2aa9ef..c03d8d0fd6 100644 --- a/appengine/cloudsql_postgresql/package.json +++ b/appengine/cloudsql_postgresql/package.json @@ -13,8 +13,6 @@ "node": ">=8" }, "scripts": { - "lint": "semistandard '**/*.js'", - "pretest": "npm run lint", "unit-test": "ava --verbose test/*.test.js", "start-proxy": "! pgrep cloud_sql_proxy > /dev/null && cloud_sql_proxy -instances=$INSTANCE_CONNECTION_NAME=tcp:$SQL_PORT &", "system-test": "repo-tools test app -- server.js", @@ -32,7 +30,9 @@ "devDependencies": { "@google-cloud/nodejs-repo-tools": "^3.0.0", "ava": "0.25.0", - "semistandard": "^12.0.1" + "proxyquire": "^2.1.0", + "sinon": "^7.1.1", + "supertest": "^3.3.0" }, "cloud-repo-tools": { "requiresKeyFile": true, diff --git a/appengine/datastore/package.json b/appengine/datastore/package.json index db8c77da34..47bde5747f 100644 --- a/appengine/datastore/package.json +++ b/appengine/datastore/package.json @@ -14,8 +14,6 @@ }, "scripts": { "start": "node app.js", - "lint": "semistandard '**/*.js'", - "pretest": "npm run lint", "system-test": "repo-tools test app", "test": "npm run system-test" }, @@ -24,8 +22,7 @@ "express": "4.16.4" }, "devDependencies": { - "@google-cloud/nodejs-repo-tools": "^3.0.0", - "semistandard": "^12.0.1" + "@google-cloud/nodejs-repo-tools": "^3.0.0" }, "cloud-repo-tools": { "test": { diff --git a/appengine/endpoints/package.json b/appengine/endpoints/package.json index 579b9f6737..7dd1b1e182 100644 --- a/appengine/endpoints/package.json +++ b/appengine/endpoints/package.json @@ -10,13 +10,11 @@ "url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git" }, "engines": { - "node": ">=4.3.2" + "node": ">=8.0.0" }, "scripts": { "deploy": "gcloud app deploy", "start": "node app.js", - "lint": "semistandard '**/*.js'", - "pretest": "npm run lint", "unit-test": "ava --verbose test/*.test.js", "system-test": "repo-tools test app", "all-test": "npm run unit-test && npm run system-test", @@ -31,6 +29,8 @@ "devDependencies": { "@google-cloud/nodejs-repo-tools": "^3.0.0", "ava": "0.25.0", - "semistandard": "^12.0.1" + "proxyquire": "^2.1.0", + "sinon": "^7.1.1", + "supertest": "^3.3.0" } } diff --git a/appengine/errorreporting/app.js b/appengine/errorreporting/app.js index e02c16ffce..b799a1e9d2 100644 --- a/appengine/errorreporting/app.js +++ b/appengine/errorreporting/app.js @@ -24,7 +24,7 @@ app.get('/', (req, res, next) => { next(new Error('something is wrong!')); }); -app.use((err, req, res, next) => { +app.use((err, req, res) => { errors.report(err); res.status(500).send(err.message || 'Something broke!'); }); diff --git a/appengine/errorreporting/package.json b/appengine/errorreporting/package.json index f23b26a833..4fb0a68041 100644 --- a/appengine/errorreporting/package.json +++ b/appengine/errorreporting/package.json @@ -14,8 +14,6 @@ }, "scripts": { "start": "node app.js", - "lint": "semistandard '**/*.js'", - "pretest": "npm run lint", "unit-test": "ava --verbose test/*.test.js", "system-test": "repo-tools test app", "test": "npm run unit-test && npm run system-test" @@ -28,8 +26,8 @@ "@google-cloud/nodejs-repo-tools": "^3.0.0", "ava": "0.25.0", "proxyquire": "2.0.0", - "semistandard": "^12.0.1", - "sinon": "4.4.2" + "sinon": "4.4.2", + "supertest": "^3.3.0" }, "cloud-repo-tools": { "test": { diff --git a/appengine/headless-chrome/package.json b/appengine/headless-chrome/package.json index cba41f88a8..7b8ed6cf79 100644 --- a/appengine/headless-chrome/package.json +++ b/appengine/headless-chrome/package.json @@ -9,8 +9,6 @@ "start": "node app.js", "system-test": "repo-tools test app", "unit-test": "ava --verbose test/*.test.js", - "lint": "semistandard '**/*.js'", - "pretest": "npm run lint", "test": "npm run unit-test && npm run system-test" }, "repository": { @@ -27,8 +25,7 @@ }, "devDependencies": { "@google-cloud/nodejs-repo-tools": "^3.0.0", - "ava": "^0.25.0", - "semistandard": "^12.0.1" + "ava": "^0.25.0" }, "cloud-repo-tools": { "test": { diff --git a/appengine/hello-world/flexible/package.json b/appengine/hello-world/flexible/package.json index f9188a255c..790e8762e2 100644 --- a/appengine/hello-world/flexible/package.json +++ b/appengine/hello-world/flexible/package.json @@ -10,13 +10,11 @@ "url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git" }, "engines": { - "node": ">=4.3.2" + "node": ">=8.0.0" }, "scripts": { "deploy": "gcloud app deploy", "start": "node app.js", - "lint": "semistandard '**/*.js'", - "pretest": "npm run lint", "system-test": "repo-tools test app", "test": "npm run system-test", "e2e-test": "repo-tools test deploy" @@ -25,8 +23,7 @@ "express": "^4.16.3" }, "devDependencies": { - "@google-cloud/nodejs-repo-tools": "^2.3.0", - "semistandard": "^12.0.1" + "@google-cloud/nodejs-repo-tools": "^2.3.0" }, "cloud-repo-tools": { "test": { diff --git a/appengine/hello-world/standard/package.json b/appengine/hello-world/standard/package.json index 9c523a0d14..92f5af3b39 100644 --- a/appengine/hello-world/standard/package.json +++ b/appengine/hello-world/standard/package.json @@ -15,8 +15,6 @@ "scripts": { "deploy": "gcloud app deploy", "start": "node app.js", - "lint": "semistandard '**/*.js'", - "pretest": "npm run lint", "system-test": "repo-tools test app", "test": "npm run system-test", "e2e-test": "repo-tools test deploy" @@ -25,8 +23,7 @@ "express": "^4.16.3" }, "devDependencies": { - "@google-cloud/nodejs-repo-tools": "^2.3.0", - "semistandard": "^12.0.1" + "@google-cloud/nodejs-repo-tools": "^2.3.0" }, "cloud-repo-tools": { "test": { diff --git a/appengine/mailjet/package.json b/appengine/mailjet/package.json index 067ab28be8..b888a52f93 100644 --- a/appengine/mailjet/package.json +++ b/appengine/mailjet/package.json @@ -14,9 +14,6 @@ }, "scripts": { "start": "node app.js", - "lint": "semistandard '**/*.js'", - "pretest": "npm run lint", - "system-test": "repo-tools test app", "test": "npm run system-test" }, "dependencies": { @@ -26,8 +23,7 @@ "node-mailjet": "3.2.1" }, "devDependencies": { - "@google-cloud/nodejs-repo-tools": "^2.3.0", - "semistandard": "^12.0.1" + "@google-cloud/nodejs-repo-tools": "^2.3.0" }, "cloud-repo-tools": { "test": { diff --git a/appengine/metadata/flexible/package.json b/appengine/metadata/flexible/package.json index 1fb64f960f..1606b0f5ae 100644 --- a/appengine/metadata/flexible/package.json +++ b/appengine/metadata/flexible/package.json @@ -13,8 +13,6 @@ "node": ">=8" }, "scripts": { - "lint": "semistandard '**/*.js'", - "pretest": "npm run lint", "system-test": "repo-tools test app -- server.js", "test": "npm run system-test" }, @@ -23,8 +21,7 @@ "got": "8.3.2" }, "devDependencies": { - "@google-cloud/nodejs-repo-tools": "^2.3.0", - "semistandard": "^12.0.1" + "@google-cloud/nodejs-repo-tools": "^2.3.0" }, "cloud-repo-tools": { "test": { diff --git a/appengine/metadata/standard/package.json b/appengine/metadata/standard/package.json index 04b1497547..7bcb0ba3c6 100644 --- a/appengine/metadata/standard/package.json +++ b/appengine/metadata/standard/package.json @@ -13,8 +13,6 @@ "node": ">=8" }, "scripts": { - "lint": "semistandard '**/*.js'", - "pretest": "npm run lint", "system-test": "repo-tools test app -- ./server.js", "test": "npm run system-test" }, @@ -23,8 +21,7 @@ "got": "8.3.2" }, "devDependencies": { - "@google-cloud/nodejs-repo-tools": "^2.3.0", - "semistandard": "^12.0.1" + "@google-cloud/nodejs-repo-tools": "^2.3.0" }, "cloud-repo-tools": { "test": { diff --git a/appengine/storage/flexible/package.json b/appengine/storage/flexible/package.json index 00b8c1ab7a..edb4766599 100644 --- a/appengine/storage/flexible/package.json +++ b/appengine/storage/flexible/package.json @@ -6,7 +6,7 @@ "test": "ava system-test/*.test.js -T 30s" }, "engines": { - "node": ">=4.3.2" + "node": ">=8.0.0" }, "dependencies": { "@google-cloud/storage": "1.6.0", diff --git a/appengine/storage/flexible/system-test/.eslintrc.yaml b/appengine/storage/flexible/system-test/.eslintrc.yaml new file mode 100644 index 0000000000..8a2e3adc8d --- /dev/null +++ b/appengine/storage/flexible/system-test/.eslintrc.yaml @@ -0,0 +1,3 @@ +--- +rules: + no-empty: off \ No newline at end of file diff --git a/appengine/storage/flexible/system-test/app.test.js b/appengine/storage/flexible/system-test/app.test.js index 02236ac991..339956b5d2 100644 --- a/appengine/storage/flexible/system-test/app.test.js +++ b/appengine/storage/flexible/system-test/app.test.js @@ -27,7 +27,7 @@ const requestObj = utils.getRequest({cwd: cwd}); test.before(async () => { utils.checkCredentials(); - await bucket.create(bucket).then(data => { + await bucket.create(bucket).then(() => { return bucket.acl.add({ entity: 'allUsers', role: Storage.acl.READER_ROLE, diff --git a/appengine/storage/standard/system-test/.eslintrc.yaml b/appengine/storage/standard/system-test/.eslintrc.yaml new file mode 100644 index 0000000000..8a2e3adc8d --- /dev/null +++ b/appengine/storage/standard/system-test/.eslintrc.yaml @@ -0,0 +1,3 @@ +--- +rules: + no-empty: off \ No newline at end of file diff --git a/appengine/storage/standard/system-test/app.test.js b/appengine/storage/standard/system-test/app.test.js index 02236ac991..339956b5d2 100644 --- a/appengine/storage/standard/system-test/app.test.js +++ b/appengine/storage/standard/system-test/app.test.js @@ -27,7 +27,7 @@ const requestObj = utils.getRequest({cwd: cwd}); test.before(async () => { utils.checkCredentials(); - await bucket.create(bucket).then(data => { + await bucket.create(bucket).then(() => { return bucket.acl.add({ entity: 'allUsers', role: Storage.acl.READER_ROLE, diff --git a/appengine/system-test/all.test.js b/appengine/system-test/all.test.js index 8d5531cfdc..18a2a740c9 100644 --- a/appengine/system-test/all.test.js +++ b/appengine/system-test/all.test.js @@ -26,7 +26,7 @@ var sampleTests = [ msg: 'Hello World! Express.js + Grunt.js on Google App Engine.', TRAVIS_NODE_VERSION: '0.12', }, - // TODO: Investigate flaky test + // Investigate flaky test // { // dir: 'appengine/loopback', // cmd: 'node', diff --git a/appengine/twilio/app.js b/appengine/twilio/app.js index a30f085ddb..2277a6eb1e 100644 --- a/appengine/twilio/app.js +++ b/appengine/twilio/app.js @@ -28,7 +28,9 @@ if (!TWILIO_NUMBER) { console.log( 'Please configure environment variables as described in README.md' ); - process.exit(1); + throw new Error( + 'Please configure environment variables as described in README.md' + ); } const twilio = require('twilio')( diff --git a/appengine/typescript/package.json b/appengine/typescript/package.json index a070decd72..fb00904565 100644 --- a/appengine/typescript/package.json +++ b/appengine/typescript/package.json @@ -6,7 +6,7 @@ "license": "Apache Version 2.0", "author": "Google Inc.", "engines": { - "node": "8.x" + "node": ">=8.0.0" }, "scripts": { "test": "npm run gcp-build && npm run lint && repo-tools test app -- index.js", @@ -21,7 +21,6 @@ }, "devDependencies": { "@google-cloud/nodejs-repo-tools": "^2.3.3", - "semistandard": "^12.0.1", "tslint": "^5.11.0" } } diff --git a/appengine/uglifyjs/package.json b/appengine/uglifyjs/package.json index 65eaa84c27..772eb9c884 100644 --- a/appengine/uglifyjs/package.json +++ b/appengine/uglifyjs/package.json @@ -12,8 +12,7 @@ "start": "node ./index.js", "lint-css": "stylelint static/style.css", "lint-html": "htmlhint index.html", - "lint-js": "semistandard index.js static/message.js", - "lint": "npm run lint-css && npm run lint-html && npm run lint-js", + "lint": "npm run lint-css && npm run lint-html", "test": "npm run gcp-build && repo-tools test app -- index.js", "minify-css": "cleancss -o static/style.min.css static/style.css", "minify-js": "uglifyjs --compress --mangle -o static/message.min.js static/message.js", @@ -36,7 +35,6 @@ "devDependencies": { "@google-cloud/nodejs-repo-tools": "^2.3.3", "htmlhint": "^0.10.0", - "semistandard": "^12.0.1", "stylelint": "^9.4.0", "stylelint-config-recommended": "^2.1.0" }, diff --git a/appengine/uglifyjs/static/.eslintrc.yaml b/appengine/uglifyjs/static/.eslintrc.yaml new file mode 100644 index 0000000000..a7e8e75c4c --- /dev/null +++ b/appengine/uglifyjs/static/.eslintrc.yaml @@ -0,0 +1,3 @@ +--- +env: + browser: true \ No newline at end of file