Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linter appengine #902

Merged
merged 4 commits into from
Nov 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
appengine/loopback/*
functions/**
iot/*
appengine/*
appengine/parse-server/cloud/main.js
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 1 addition & 4 deletions appengine/analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand All @@ -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": {
Expand Down
5 changes: 1 addition & 4 deletions appengine/building-an-app/build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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,
Expand Down
8 changes: 2 additions & 6 deletions appengine/building-an-app/update/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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"
}
}
6 changes: 3 additions & 3 deletions appengine/cloudsql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions appengine/cloudsql_postgresql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
Expand Down
5 changes: 1 addition & 4 deletions appengine/datastore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand All @@ -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": {
Expand Down
8 changes: 4 additions & 4 deletions appengine/endpoints/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
}
2 changes: 1 addition & 1 deletion appengine/errorreporting/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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!');
});
Expand Down
6 changes: 2 additions & 4 deletions appengine/errorreporting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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": {
Expand Down
5 changes: 1 addition & 4 deletions appengine/headless-chrome/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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": {
Expand Down
7 changes: 2 additions & 5 deletions appengine/hello-world/flexible/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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": {
Expand Down
5 changes: 1 addition & 4 deletions appengine/hello-world/standard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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": {
Expand Down
6 changes: 1 addition & 5 deletions appengine/mailjet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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": {
Expand Down
5 changes: 1 addition & 4 deletions appengine/metadata/flexible/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand All @@ -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": {
Expand Down
5 changes: 1 addition & 4 deletions appengine/metadata/standard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand All @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion appengine/storage/flexible/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions appengine/storage/flexible/system-test/.eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
rules:
no-empty: off
2 changes: 1 addition & 1 deletion appengine/storage/flexible/system-test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions appengine/storage/standard/system-test/.eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
rules:
no-empty: off
2 changes: 1 addition & 1 deletion appengine/storage/standard/system-test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion appengine/system-test/all.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 3 additions & 1 deletion appengine/twilio/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')(
Expand Down
3 changes: 1 addition & 2 deletions appengine/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -21,7 +21,6 @@
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^2.3.3",
"semistandard": "^12.0.1",
"tslint": "^5.11.0"
}
}
Loading