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

chore(deps): update dependency prettier to v2 #1631

Merged
merged 5 commits into from
Mar 24, 2020
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 .kokoro/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build_file: "nodejs-docs-samples/.kokoro/trampoline.sh"
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/node:8-user"
value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user"
}

# Export XUnit test results for further analysis
Expand Down
5 changes: 1 addition & 4 deletions appengine/analytics/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ app.get('/', async (req, res, next) => {
'Example label',
'100'
);
res
.status(200)
.send('Event tracked.')
.end();
res.status(200).send('Event tracked.').end();
} catch (error) {
// This sample treats an event tracking error as a fatal error. Depending
// on your application's needs, failing to track an event may not be
Expand Down
10 changes: 5 additions & 5 deletions appengine/building-an-app/update/test/server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ const cwd = path.join(__dirname, '../');

const requestObj = supertest(proxyquire(path.join(cwd, 'server'), {process}));

const stubConsole = function() {
const stubConsole = function () {
sinon.stub(console, `error`);
sinon.stub(console, `log`);
};

const restoreConsole = function() {
const restoreConsole = function () {
console.log.restore();
console.error.restore();
};
Expand All @@ -40,7 +40,7 @@ it('should send greetings', async () => {
await requestObj
.get('/')
.expect(200)
.expect(response => {
.expect((response) => {
assert.strictEqual(response.text, 'Hello from App Engine!');
});
});
Expand All @@ -49,7 +49,7 @@ it('should display form', async () => {
await requestObj
.get('/submit')
.expect(200)
.expect(response => {
.expect((response) => {
assert.strictEqual(
response.text.includes('textarea name="message" placeholder="Message"'),
true
Expand All @@ -64,7 +64,7 @@ it('should record message', async () => {
message: 'sample-message',
})
.expect(200)
.expect(response => {
.expect((response) => {
assert.strictEqual(response.text, 'Thanks for your message!');
});
});
2 changes: 1 addition & 1 deletion appengine/cloudsql/createTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ prompt.get(FIELDS, async (err, config) => {

// Create the "visits" table
try {
await knex.schema.createTable('visits', table => {
await knex.schema.createTable('visits', (table) => {
table.increments();
table.timestamp('timestamp');
table.string('userIp');
Expand Down
4 changes: 2 additions & 2 deletions appengine/cloudsql/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ const insertVisit = (knex, visit) => {
* @param {object} knex The Knex connection object.
* @returns {Promise}
*/
const getVisits = async knex => {
const getVisits = async (knex) => {
const results = await knex
.select('timestamp', 'userIp')
.from('visits')
.orderBy('timestamp', 'desc')
.limit(10);

return results.map(
visit => `Time: ${visit.timestamp}, AddrHash: ${visit.userIp}`
(visit) => `Time: ${visit.timestamp}, AddrHash: ${visit.userIp}`
);
};

Expand Down
10 changes: 5 additions & 5 deletions appengine/cloudsql/test/createTables.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ const getSample = () => {
};
};

const stubConsole = function() {
const stubConsole = function () {
/* eslint-disable no-console */
sinon.stub(console, `error`);
sinon.stub(console, `log`);
};

const restoreConsole = function() {
const restoreConsole = function () {
console.log.restore();
console.error.restore();
};
Expand All @@ -87,7 +87,7 @@ describe('gae_flex_mysql_create_tables', () => {
exampleConfig
);

await new Promise(r => setTimeout(r, 10));
await new Promise((r) => setTimeout(r, 10));
assert.ok(sample.mocks.Knex.calledOnce);
assert.deepStrictEqual(sample.mocks.Knex.firstCall.args, [
{
Expand Down Expand Up @@ -116,7 +116,7 @@ describe('gae_flex_mysql_create_tables', () => {
prompt: sample.mocks.prompt,
});

await new Promise(r => setTimeout(r, 10));
await new Promise((r) => setTimeout(r, 10));
assert.ok(console.error.calledOnce);
assert.ok(console.error.calledWith(error));
assert.ok(sample.mocks.Knex.notCalled);
Expand All @@ -133,7 +133,7 @@ describe('gae_flex_mysql_create_tables', () => {
knex: sample.mocks.Knex,
prompt: sample.mocks.prompt,
});
await new Promise(r => setTimeout(r, 10));
await new Promise((r) => setTimeout(r, 10));
assert.ok(console.error.calledOnce);
assert.ok(
console.error.calledWith(`Failed to create 'visits' table:`, error)
Expand Down
6 changes: 3 additions & 3 deletions appengine/cloudsql/test/server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('gae_flex_mysql_app', () => {
await request(sample.app)
.get('/')
.expect(200)
.expect(response => {
.expect((response) => {
assert.strictEqual(response.text, expectedResult);
});
});
Expand All @@ -113,7 +113,7 @@ describe('gae_flex_mysql_app', () => {
await request(sample.app)
.get('/')
.expect(500)
.expect(response => {
.expect((response) => {
assert.ok(response.text.includes(expectedResult));
});
});
Expand All @@ -127,7 +127,7 @@ describe('gae_flex_mysql_app', () => {
await request(sample.app)
.get('/')
.expect(500)
.expect(response => {
.expect((response) => {
assert.ok(response.text.includes(expectedResult));
});
});
Expand Down
2 changes: 1 addition & 1 deletion appengine/cloudsql_postgresql/createTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ prompt.get(FIELDS, async (err, config) => {

// Create the "visits" table
try {
await knex.schema.createTable('visits', table => {
await knex.schema.createTable('visits', (table) => {
table.increments();
table.timestamp('timestamp');
table.string('userIp');
Expand Down
4 changes: 2 additions & 2 deletions appengine/cloudsql_postgresql/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ const insertVisit = (knex, visit) => {
* @returns {Promise}
*/

const getVisits = async knex => {
const getVisits = async (knex) => {
const results = await knex
.select('timestamp', 'userIp')
.from('visits')
.orderBy('timestamp', 'desc')
.limit(10);

return results.map(
visit => `Time: ${visit.timestamp}, AddrHash: ${visit.userIp}`
(visit) => `Time: ${visit.timestamp}, AddrHash: ${visit.userIp}`
);
};

Expand Down
10 changes: 5 additions & 5 deletions appengine/cloudsql_postgresql/test/createTables.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ const getSample = () => {
};
};

const stubConsole = function() {
const stubConsole = function () {
sinon.stub(console, `error`);
sinon.stub(console, `log`);
};

const restoreConsole = function() {
const restoreConsole = function () {
console.log.restore();
console.error.restore();
};
Expand All @@ -86,7 +86,7 @@ describe('gae_flex_postgres_create_tables', () => {
exampleConfig
);

await new Promise(r => setTimeout(r, 10));
await new Promise((r) => setTimeout(r, 10));
assert.ok(sample.mocks.Knex.calledOnce);
assert.deepStrictEqual(sample.mocks.Knex.firstCall.args, [
{
Expand Down Expand Up @@ -115,7 +115,7 @@ describe('gae_flex_postgres_create_tables', () => {
prompt: sample.mocks.prompt,
});

await new Promise(r => setTimeout(r, 10));
await new Promise((r) => setTimeout(r, 10));
assert.ok(console.error.calledOnce);
assert.ok(console.error.calledWith(error));
assert.ok(sample.mocks.Knex.notCalled);
Expand All @@ -133,7 +133,7 @@ describe('gae_flex_postgres_create_tables', () => {
prompt: sample.mocks.prompt,
});

await new Promise(r => setTimeout(r, 10));
await new Promise((r) => setTimeout(r, 10));
assert.ok(console.error.calledOnce);
assert.ok(
console.error.calledWith(`Failed to create 'visits' table:`, error)
Expand Down
6 changes: 3 additions & 3 deletions appengine/cloudsql_postgresql/test/server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe('gae_flex_postgres_app', () => {
await request(sample.app)
.get('/')
.expect(200)
.expect(response => {
.expect((response) => {
assert.strictEqual(response.text, expectedResult);
});
});
Expand All @@ -111,7 +111,7 @@ describe('gae_flex_postgres_app', () => {
await request(sample.app)
.get('/')
.expect(500)
.expect(response => {
.expect((response) => {
assert.strictEqual(response.text.includes(expectedResult), true);
});
});
Expand All @@ -125,7 +125,7 @@ describe('gae_flex_postgres_app', () => {
await request(sample.app)
.get('/')
.expect(500)
.expect(response => {
.expect((response) => {
assert.strictEqual(response.text.includes(expectedResult), true);
});
});
Expand Down
4 changes: 2 additions & 2 deletions appengine/datastore/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const datastore = new Datastore();
*
* @param {object} visit The visit record to insert.
*/
const insertVisit = visit => {
const insertVisit = (visit) => {
return datastore.save({
key: datastore.key('visit'),
data: visit,
Expand Down Expand Up @@ -71,7 +71,7 @@ app.get('/', async (req, res, next) => {
await insertVisit(visit);
const [entities] = await getVisits();
const visits = entities.map(
entity => `Time: ${entity.timestamp}, AddrHash: ${entity.userIp}`
(entity) => `Time: ${entity.timestamp}, AddrHash: ${entity.userIp}`
);
res
.status(200)
Expand Down
12 changes: 6 additions & 6 deletions appengine/endpoints/test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ const getSample = () => {
};
};

const stubConsole = function() {
const stubConsole = function () {
sinon.stub(console, `error`);
};

const restoreConsole = function() {
const restoreConsole = function () {
console.error.restore();
};

beforeEach(stubConsole);
afterEach(restoreConsole);

it(`sets up the sample`, done => {
it(`sets up the sample`, (done) => {
const sample = getSample();

assert.ok(sample.mocks.express.calledOnce);
Expand All @@ -62,7 +62,7 @@ it(`should echo a message`, async () => {
.post('/echo')
.send({message: 'foo'})
.expect(200)
.expect(response => {
.expect((response) => {
assert.strictEqual(response.body.message, 'foo');
});
});
Expand All @@ -72,7 +72,7 @@ it(`should try to parse encoded info`, async () => {
await request(sample.app)
.get('/auth/info/googlejwt')
.expect(200)
.expect(response => {
.expect((response) => {
assert.deepStrictEqual(response.body, {id: 'anonymous'});
});
});
Expand All @@ -86,7 +86,7 @@ it(`should successfully parse encoded info`, async () => {
Buffer.from(JSON.stringify({id: 'foo'})).toString('base64')
)
.expect(200)
.expect(response => {
.expect((response) => {
assert.deepStrictEqual(response.body, {id: 'foo'});
});
});
5 changes: 1 addition & 4 deletions appengine/hello-world/flexible/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ const express = require('express');
const app = express();

app.get('/', (req, res) => {
res
.status(200)
.send('Hello, world!')
.end();
res.status(200).send('Hello, world!').end();
});

// Start the server
Expand Down
12 changes: 4 additions & 8 deletions appengine/hello-world/flexible/test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ const request = require('supertest');

describe('gae_flex_quickstart', () => {
describe('GET /', () => {
it('should get 200', done => {
request(app)
.get('/')
.expect(200, done);
it('should get 200', (done) => {
request(app).get('/').expect(200, done);
});

it('should get Hello World', done => {
request(app)
.get('/')
.expect('Hello, world!', done);
it('should get Hello World', (done) => {
request(app).get('/').expect('Hello, world!', done);
});
});
});
5 changes: 1 addition & 4 deletions appengine/hello-world/standard/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ const express = require('express');
const app = express();

app.get('/', (req, res) => {
res
.status(200)
.send('Hello, world!')
.end();
res.status(200).send('Hello, world!').end();
});

// Start the server
Expand Down
12 changes: 4 additions & 8 deletions appengine/hello-world/standard/test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ const request = require('supertest');

describe('gae_node_request_example', () => {
describe('GET /', () => {
it('should get 200', done => {
request(app)
.get('/')
.expect(200, done);
it('should get 200', (done) => {
request(app).get('/').expect(200, done);
});

it('should get Hello World', done => {
request(app)
.get('/')
.expect('Hello, world!', done);
it('should get Hello World', (done) => {
request(app).get('/').expect('Hello, world!', done);
});
});
});
Loading