Skip to content

Commit c601676

Browse files
authored
ci: Remove husky and prettier in favor of eslint (#2550)
1 parent d706dff commit c601676

12 files changed

+371
-434
lines changed

.husky/pre-commit

-1
This file was deleted.

.prettierrc

-6
This file was deleted.

eslint.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = tseslint.config({
1414
jsdoc,
1515
},
1616
"rules": {
17-
"indent": ["error", 2],
17+
"indent": ["error", 2, { "SwitchCase": 1 }],
1818
"linebreak-style": ["error", "unix"],
1919
"no-trailing-spaces": 2,
2020
"eol-last": 2,

package-lock.json

-45
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-12
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474
"gulp-rename": "2.0.0",
7575
"gulp-uglify": "3.0.2",
7676
"gulp-watch": "5.0.1",
77-
"husky": "9.1.7",
7877
"jasmine": "5.6.0",
7978
"jasmine-reporters": "2.5.2",
8079
"jasmine-spec-reporter": "7.0.0",
@@ -87,7 +86,6 @@
8786
"metro-react-native-babel-preset": "0.77.0",
8887
"mongodb-runner": "5.8.0",
8988
"parse-server": "7.3.0",
90-
"prettier": "3.5.2",
9189
"puppeteer": "24.6.0",
9290
"regenerator-runtime": "0.14.1",
9391
"semantic-release": "24.2.3",
@@ -117,20 +115,11 @@
117115
"integration": "cross-env TESTING=1 jasmine --config=jasmine.json",
118116
"docs": "jsdoc -c ./jsdoc-conf.json ./src",
119117
"madge:circular": "madge ./src --extensions js,ts --circular",
120-
"prepare": "husky && npm run build",
121-
"pre-commit": "lint-staged",
118+
"prepare": "npm run build",
122119
"release_docs": "./release_docs.sh",
123120
"gulp": "gulp",
124-
"prettier": "prettier --write '{src,integration,types}/{**/*,*}.{js,ts}' && npm run lint:fix",
125121
"cross-env": "cross-env"
126122
},
127-
"lint-staged": {
128-
"{src,integration}/{**/*,*}.{js,ts}": [
129-
"prettier --write",
130-
"eslint --fix --cache",
131-
"git add"
132-
]
133-
},
134123
"engines": {
135124
"node": "18 || 19 || 20 || 22"
136125
},

src/EventuallyQueue.ts

+22-22
Original file line numberDiff line numberDiff line change
@@ -246,33 +246,33 @@ const EventuallyQueue = {
246246
return this.remove(queueObject.queueId);
247247
}
248248
switch (queueObject.action) {
249-
case 'save':
250-
// Queued update was overwritten by other request. Do not save
251-
if (
252-
typeof object.updatedAt !== 'undefined' &&
249+
case 'save':
250+
// Queued update was overwritten by other request. Do not save
251+
if (
252+
typeof object.updatedAt !== 'undefined' &&
253253
object.updatedAt > new Date(queueObject.object.createdAt as Date)
254-
) {
255-
return this.remove(queueObject.queueId);
256-
}
257-
try {
258-
await object.save(queueObject.object, queueObject.serverOptions);
259-
await this.remove(queueObject.queueId);
260-
} catch (e) {
261-
if (e.code !== ParseError.CONNECTION_FAILED) {
254+
) {
255+
return this.remove(queueObject.queueId);
256+
}
257+
try {
258+
await object.save(queueObject.object, queueObject.serverOptions);
262259
await this.remove(queueObject.queueId);
260+
} catch (e) {
261+
if (e.code !== ParseError.CONNECTION_FAILED) {
262+
await this.remove(queueObject.queueId);
263+
}
263264
}
264-
}
265-
break;
266-
case 'destroy':
267-
try {
268-
await object.destroy(queueObject.serverOptions);
269-
await this.remove(queueObject.queueId);
270-
} catch (e) {
271-
if (e.code !== ParseError.CONNECTION_FAILED) {
265+
break;
266+
case 'destroy':
267+
try {
268+
await object.destroy(queueObject.serverOptions);
272269
await this.remove(queueObject.queueId);
270+
} catch (e) {
271+
if (e.code !== ParseError.CONNECTION_FAILED) {
272+
await this.remove(queueObject.queueId);
273+
}
273274
}
274-
}
275-
break;
275+
break;
276276
}
277277
},
278278

src/LiveQueryClient.ts

+72-72
Original file line numberDiff line numberDiff line change
@@ -378,88 +378,88 @@ class LiveQueryClient {
378378
installationId: data.installationId,
379379
};
380380
switch (data.op) {
381-
case OP_EVENTS.CONNECTED:
382-
if (this.state === CLIENT_STATE.RECONNECTING) {
383-
this.resubscribe();
384-
}
385-
this.emit(CLIENT_EMMITER_TYPES.OPEN);
386-
this.id = data.clientId;
387-
this.connectPromise.resolve();
388-
this.state = CLIENT_STATE.CONNECTED;
389-
break;
390-
case OP_EVENTS.SUBSCRIBED:
391-
if (subscription) {
392-
this.attempts = 1;
393-
subscription.subscribed = true;
394-
subscription.subscribePromise.resolve();
395-
setTimeout(() => subscription.emit(SUBSCRIPTION_EMMITER_TYPES.OPEN, response), 200);
396-
}
397-
break;
398-
case OP_EVENTS.ERROR: {
399-
const parseError = new ParseError(data.code, data.error);
400-
if (!this.id) {
401-
this.connectPromise.reject(parseError);
402-
this.state = CLIENT_STATE.DISCONNECTED;
403-
}
404-
if (data.requestId) {
381+
case OP_EVENTS.CONNECTED:
382+
if (this.state === CLIENT_STATE.RECONNECTING) {
383+
this.resubscribe();
384+
}
385+
this.emit(CLIENT_EMMITER_TYPES.OPEN);
386+
this.id = data.clientId;
387+
this.connectPromise.resolve();
388+
this.state = CLIENT_STATE.CONNECTED;
389+
break;
390+
case OP_EVENTS.SUBSCRIBED:
405391
if (subscription) {
406-
subscription.subscribePromise.reject(parseError);
407-
setTimeout(() => subscription.emit(SUBSCRIPTION_EMMITER_TYPES.ERROR, data.error), 200);
392+
this.attempts = 1;
393+
subscription.subscribed = true;
394+
subscription.subscribePromise.resolve();
395+
setTimeout(() => subscription.emit(SUBSCRIPTION_EMMITER_TYPES.OPEN, response), 200);
408396
}
409-
} else {
410-
this.emit(CLIENT_EMMITER_TYPES.ERROR, data.error);
411-
}
412-
if (data.error === 'Additional properties not allowed') {
413-
this.additionalProperties = false;
414-
}
415-
if (data.reconnect) {
416-
this._handleReconnect();
417-
}
418-
break;
419-
}
420-
case OP_EVENTS.UNSUBSCRIBED: {
421-
if (subscription) {
422-
this.subscriptions.delete(data.requestId);
423-
subscription.subscribed = false;
424-
subscription.unsubscribePromise.resolve();
425-
}
426-
break;
427-
}
428-
default: {
429-
// create, update, enter, leave, delete cases
430-
if (!subscription) {
431397
break;
432-
}
433-
let override = false;
434-
if (data.original) {
435-
override = true;
436-
delete data.original.__type;
437-
// Check for removed fields
438-
for (const field in data.original) {
439-
if (!(field in data.object)) {
440-
data.object[field] = undefined;
398+
case OP_EVENTS.ERROR: {
399+
const parseError = new ParseError(data.code, data.error);
400+
if (!this.id) {
401+
this.connectPromise.reject(parseError);
402+
this.state = CLIENT_STATE.DISCONNECTED;
403+
}
404+
if (data.requestId) {
405+
if (subscription) {
406+
subscription.subscribePromise.reject(parseError);
407+
setTimeout(() => subscription.emit(SUBSCRIPTION_EMMITER_TYPES.ERROR, data.error), 200);
441408
}
409+
} else {
410+
this.emit(CLIENT_EMMITER_TYPES.ERROR, data.error);
411+
}
412+
if (data.error === 'Additional properties not allowed') {
413+
this.additionalProperties = false;
442414
}
443-
data.original = ParseObject.fromJSON(data.original, false);
415+
if (data.reconnect) {
416+
this._handleReconnect();
417+
}
418+
break;
444419
}
445-
delete data.object.__type;
446-
const parseObject = ParseObject.fromJSON(
447-
data.object,
448-
!(subscription.query && subscription.query._select) ? override : false
449-
);
450-
451-
if (data.original) {
452-
subscription.emit(data.op, parseObject, data.original, response);
453-
} else {
454-
subscription.emit(data.op, parseObject, response);
420+
case OP_EVENTS.UNSUBSCRIBED: {
421+
if (subscription) {
422+
this.subscriptions.delete(data.requestId);
423+
subscription.subscribed = false;
424+
subscription.unsubscribePromise.resolve();
425+
}
426+
break;
455427
}
428+
default: {
429+
// create, update, enter, leave, delete cases
430+
if (!subscription) {
431+
break;
432+
}
433+
let override = false;
434+
if (data.original) {
435+
override = true;
436+
delete data.original.__type;
437+
// Check for removed fields
438+
for (const field in data.original) {
439+
if (!(field in data.object)) {
440+
data.object[field] = undefined;
441+
}
442+
}
443+
data.original = ParseObject.fromJSON(data.original, false);
444+
}
445+
delete data.object.__type;
446+
const parseObject = ParseObject.fromJSON(
447+
data.object,
448+
!(subscription.query && subscription.query._select) ? override : false
449+
);
450+
451+
if (data.original) {
452+
subscription.emit(data.op, parseObject, data.original, response);
453+
} else {
454+
subscription.emit(data.op, parseObject, response);
455+
}
456456

457-
const localDatastore = CoreManager.getLocalDatastore();
458-
if (override && localDatastore.isEnabled) {
459-
localDatastore._updateObjectIfPinned(parseObject).then(() => {});
457+
const localDatastore = CoreManager.getLocalDatastore();
458+
if (override && localDatastore.isEnabled) {
459+
localDatastore._updateObjectIfPinned(parseObject).then(() => {});
460+
}
460461
}
461462
}
462-
}
463463
}
464464

465465
_handleWebSocketClose() {

0 commit comments

Comments
 (0)