Skip to content

Commit 1f30ebe

Browse files
authored
style: Fix pre-commit hook and enable Prettier for TypeScript (#2141)
1 parent a9d98b4 commit 1f30ebe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1256
-1126
lines changed

.husky/pre-commit

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm run pre-commit

.prettierrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ semi: true
22
trailingComma: "es5"
33
singleQuote: true
44
arrowParens: "avoid"
5-
printWidth: 100
5+
printWidth: 100
6+
parser: "typescript"

integration/test/ParseDistTest.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,21 @@ for (const fileName of ['parse.js', 'parse.min.js']) {
5252
request.continue();
5353
});
5454
page.on('requestfailed', request => {
55-
if (request.failure().errorText === 'net::ERR_ABORTED' && !request.url().includes('favicon.ico')) {
55+
if (
56+
request.failure().errorText === 'net::ERR_ABORTED' &&
57+
!request.url().includes('favicon.ico')
58+
) {
5659
abortedCount += 1;
5760
promise.resolve();
5861
}
5962
});
6063
await page.evaluate(async () => {
6164
const parseLogo =
62-
'https://raw.githubusercontent.com/parse-community/parse-server/master/.github/parse-server-logo.png';
65+
'https://raw.githubusercontent.com/parse-community/parse-server/master/.github/parse-server-logo.png';
6366
const file = new Parse.File('parse-server-logo', { uri: parseLogo });
6467
file.save().then(() => {});
6568

66-
return new Promise((resolve) => {
69+
return new Promise(resolve => {
6770
const intervalId = setInterval(() => {
6871
if (file._requestTask && typeof file._requestTask.abort === 'function') {
6972
file.cancel();

integration/test/ParseEventuallyQueueTest.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ describe('Parse EventuallyQueue', () => {
193193
it('can saveEventually', async () => {
194194
const parseServer = await reconfigureServer();
195195
const object = new TestObject({ hash: 'saveSecret' });
196-
await new Promise((resolve) => parseServer.server.close(resolve));
196+
await new Promise(resolve => parseServer.server.close(resolve));
197197
await object.saveEventually();
198198

199199
const length = await Parse.EventuallyQueue.length();
@@ -225,7 +225,7 @@ describe('Parse EventuallyQueue', () => {
225225
const object = new TestObject({ hash: 'saveSecret' });
226226
object.setACL(acl);
227227

228-
await new Promise((resolve) => parseServer.server.close(resolve));
228+
await new Promise(resolve => parseServer.server.close(resolve));
229229
await object.saveEventually();
230230

231231
const length = await Parse.EventuallyQueue.length();
@@ -250,7 +250,7 @@ describe('Parse EventuallyQueue', () => {
250250
const parseServer = await reconfigureServer();
251251
const object = new TestObject({ hash: 'deleteSecret' });
252252
await object.save();
253-
await new Promise((resolve) => parseServer.server.close(resolve));
253+
await new Promise(resolve => parseServer.server.close(resolve));
254254
await object.destroyEventually();
255255
const length = await Parse.EventuallyQueue.length();
256256

integration/test/ParseLiveQueryTest.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ describe('Parse LiveQuery', () => {
2020
it('can subscribe to query', async () => {
2121
const object = new TestObject();
2222
await object.save();
23-
const installationId = await Parse.CoreManager.getInstallationController().currentInstallationId();
23+
const installationId =
24+
await Parse.CoreManager.getInstallationController().currentInstallationId();
2425

2526
const query = new Parse.Query(TestObject);
2627
query.equalTo('objectId', object.id);
@@ -39,7 +40,8 @@ describe('Parse LiveQuery', () => {
3940
it('can subscribe to query with client', async () => {
4041
const object = new TestObject();
4142
await object.save();
42-
const installationId = await Parse.CoreManager.getInstallationController().currentInstallationId();
43+
const installationId =
44+
await Parse.CoreManager.getInstallationController().currentInstallationId();
4345

4446
const query = new Parse.Query(TestObject);
4547
query.equalTo('objectId', object.id);
@@ -389,7 +391,8 @@ describe('Parse LiveQuery', () => {
389391
Parse.CoreManager.setEventEmitter(CustomEmitter);
390392
const object = new TestObject();
391393
await object.save();
392-
const installationId = await Parse.CoreManager.getInstallationController().currentInstallationId();
394+
const installationId =
395+
await Parse.CoreManager.getInstallationController().currentInstallationId();
393396

394397
const query = new Parse.Query(TestObject);
395398
query.equalTo('objectId', object.id);

integration/test/ParseQueryTest.js

-1
Original file line numberDiff line numberDiff line change
@@ -2415,5 +2415,4 @@ describe('Parse Query', () => {
24152415
const explain = await query.find();
24162416
assert.equal(explain.command.comment, comment);
24172417
});
2418-
24192418
});

integration/test/ParseReactNativeTest.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('Parse React Native', () => {
3232

3333
it('can log in a user', async () => {
3434
// Handle Storage Controller
35-
await Parse.User.signUp('asdf', 'zxcv')
35+
await Parse.User.signUp('asdf', 'zxcv');
3636
const user = await Parse.User.logIn('asdf', 'zxcv');
3737
expect(user.get('username')).toBe('asdf');
3838
expect(user.existed()).toBe(true);
@@ -86,7 +86,8 @@ describe('Parse React Native', () => {
8686
// Handle WebSocket Controller
8787
const object = new Parse.Object('TestObject');
8888
await object.save();
89-
const installationId = await Parse.CoreManager.getInstallationController().currentInstallationId();
89+
const installationId =
90+
await Parse.CoreManager.getInstallationController().currentInstallationId();
9091

9192
const query = new Parse.Query('TestObject');
9293
query.equalTo('objectId', object.id);

integration/test/ParseServerTest.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,18 @@ describe('ParseServer', () => {
66
it('can reconfigure server', async () => {
77
const parseServer = await reconfigureServer({ serverURL: 'www.google.com' });
88
assert.strictEqual(parseServer.config.serverURL, 'www.google.com');
9-
await new Promise((resolve) => parseServer.server.close(resolve));
9+
await new Promise(resolve => parseServer.server.close(resolve));
1010
await reconfigureServer();
1111
});
1212

1313
it('can shutdown', async () => {
1414
const parseServer = await reconfigureServer();
1515
const object = new TestObject({ foo: 'bar' });
1616
await parseServer.handleShutdown();
17-
await new Promise((resolve) => parseServer.server.close(resolve));
18-
await expectAsync(object.save()).toBeRejectedWithError('XMLHttpRequest failed: "Unable to connect to the Parse API"');
17+
await new Promise(resolve => parseServer.server.close(resolve));
18+
await expectAsync(object.save()).toBeRejectedWithError(
19+
'XMLHttpRequest failed: "Unable to connect to the Parse API"'
20+
);
1921
await reconfigureServer({});
2022
await object.save();
2123
assert(object.id);

integration/test/ParseUserTest.js

+13-8
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ describe('Parse User', () => {
113113

114114
it('can login users with installationId', async () => {
115115
Parse.User.enableUnsafeCurrentUser();
116-
const currentInstallationId = await Parse.CoreManager.getInstallationController().currentInstallationId();
116+
const currentInstallationId =
117+
await Parse.CoreManager.getInstallationController().currentInstallationId();
117118
const installationId = '12345678';
118119
const user = new Parse.User();
119120
user.set('username', 'parse');
@@ -149,7 +150,8 @@ describe('Parse User', () => {
149150
});
150151

151152
it('can get current installation', async () => {
152-
const currentInstallationId = await Parse.CoreManager.getInstallationController().currentInstallationId();
153+
const currentInstallationId =
154+
await Parse.CoreManager.getInstallationController().currentInstallationId();
153155
const installation = await Parse.Installation.currentInstallation();
154156
expect(installation.installationId).toBe(currentInstallationId);
155157
expect(installation.deviceType).toBe(Parse.Installation.DEVICE_TYPES.WEB);
@@ -180,7 +182,8 @@ describe('Parse User', () => {
180182
});
181183

182184
it('can save new installation when deleted', async () => {
183-
const currentInstallationId = await Parse.CoreManager.getInstallationController().currentInstallationId();
185+
const currentInstallationId =
186+
await Parse.CoreManager.getInstallationController().currentInstallationId();
184187
const installation = await Parse.Installation.currentInstallation();
185188
expect(installation.installationId).toBe(currentInstallationId);
186189
expect(installation.deviceType).toBe(Parse.Installation.DEVICE_TYPES.WEB);
@@ -196,7 +199,8 @@ describe('Parse User', () => {
196199
});
197200

198201
it('can fetch installation when deleted', async () => {
199-
const currentInstallationId = await Parse.CoreManager.getInstallationController().currentInstallationId();
202+
const currentInstallationId =
203+
await Parse.CoreManager.getInstallationController().currentInstallationId();
200204
const installation = await Parse.Installation.currentInstallation();
201205
expect(installation.installationId).toBe(currentInstallationId);
202206
expect(installation.deviceType).toBe(Parse.Installation.DEVICE_TYPES.WEB);
@@ -227,9 +231,7 @@ describe('Parse User', () => {
227231

228232
await Parse.User.logOut();
229233
assert(!Parse.User.current());
230-
await expectAsync(Parse.User.loginAs('garbage')).toBeRejectedWithError(
231-
'user not found'
232-
);
234+
await expectAsync(Parse.User.loginAs('garbage')).toBeRejectedWithError('user not found');
233235
});
234236

235237
it('can become a user', done => {
@@ -1128,7 +1130,10 @@ describe('Parse User', () => {
11281130
preventLoginWithUnverifiedEmail: true,
11291131
});
11301132
await Parse.User.signUp('asd123', 'xyz123');
1131-
const res = await Parse.User.verifyPassword('asd123', 'xyz123', { useMasterKey: true, ignoreEmailVerification: true });
1133+
const res = await Parse.User.verifyPassword('asd123', 'xyz123', {
1134+
useMasterKey: true,
1135+
ignoreEmailVerification: true,
1136+
});
11321137
expect(typeof res).toBe('object');
11331138
expect(res.username).toBe('asd123');
11341139
});

0 commit comments

Comments
 (0)