Skip to content

Commit 99ed28d

Browse files
authored
chore: auto fix code using eslint (#6728)
1 parent 390dc39 commit 99ed28d

8 files changed

Lines changed: 23 additions & 20 deletions

File tree

.github/workflows/prettier.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ jobs:
2626
- name: Run Prettier
2727
run: yarn prettier --write .
2828

29+
- name: Run ESLint
30+
run: npx eslint . --fix
31+
2932
- name: Check for changes
30-
id: check_changes
33+
id: changes
3134
run: |
3235
if git diff --quiet; then
3336
echo "No code format changes detected"
@@ -37,11 +40,11 @@ jobs:
3740
echo "changes=true" >> $GITHUB_OUTPUT
3841
fi
3942
40-
- name: Commit and push changes
41-
if: steps.check_changes.outputs.changes == 'true'
43+
- name: Commit and push eslint changes
44+
if: steps.changes.outputs.changes == 'true'
4245
run: |
4346
git config user.name "${{ github.actor }}"
4447
git config user.email "${{ github.actor }}@users.noreply.github.com"
4548
git add .
46-
git commit -m "chore: format code with Prettier [skip ci]"
49+
git commit -m "chore: format code and fix lint issues [skip ci]"
4750
git push origin ${{ github.ref_name }}

app/containers/MessageComposer/helpers/getMentionRegexp.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('getMentionRegexpUser', function () {
2929
});
3030

3131
test('removing query text on user suggestion autocomplete (special characters in query)', () => {
32-
const message = "Hey @'=test123";
32+
const message = 'Hey @\'=test123';
3333
expect(message.replace(regexp, '')).toBe('Hey @');
3434
});
3535
});

app/containers/UnreadBadge/getUnreadStyle.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { themes } from '../../lib/constants/colors';
33
import { getUnreadStyle } from './getUnreadStyle';
44

5-
const testsForTheme = theme => {
5+
const testsForTheme = (theme) => {
66
const getUnreadStyleUtil = ({ ...props }) => getUnreadStyle({ theme, ...props });
77

88
test('render empty', () => {

app/sagas/createChannel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const handleRequest = function* handleRequest({ data }) {
6161
const db = database.active;
6262
const subCollection = db.get('subscriptions');
6363
yield db.write(async () => {
64-
await subCollection.create(s => {
64+
await subCollection.create((s) => {
6565
s._raw = sanitizedRaw({ id: sub.rid }, subCollection.schema);
6666
Object.assign(s, sub);
6767
});

app/sagas/createDiscussion.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const handleRequest = function* handleRequest({ data }) {
2323
const db = database.active;
2424
const subCollection = db.get('subscriptions');
2525
yield db.write(async () => {
26-
await subCollection.create(s => {
26+
await subCollection.create((s) => {
2727
s._raw = sanitizedRaw({ id: sub.rid }, subCollection.schema);
2828
Object.assign(s, sub);
2929
});

app/sagas/deepLinking.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const waitForNavigation = () => {
4646
if (Navigation.navigationRef.current) {
4747
return Promise.resolve();
4848
}
49-
return new Promise(resolve => {
49+
return new Promise((resolve) => {
5050
const listener = () => {
5151
emitter.off('navigationReady', listener);
5252
resolve();

app/sagas/login.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const showSupportedVersionsWarning = function* showSupportedVersionsWarning(serv
6161

6262
const serversDB = database.servers;
6363
yield serversDB.write(async () => {
64-
await serverRecord.update(r => {
64+
await serverRecord.update((r) => {
6565
r.supportedVersionsWarningAt = new Date();
6666
});
6767
});
@@ -99,7 +99,7 @@ const handleLoginRequest = function* handleLoginRequest({ credentials, logoutOnE
9999
const serverHistoryRecord = serversHistory[0];
100100
// this is updating on every login just to save `updated_at`
101101
// keeping this server as the most recent on autocomplete order
102-
await serverHistoryRecord.update(s => {
102+
await serverHistoryRecord.update((s) => {
103103
s.username = result.username;
104104
});
105105
}
@@ -252,12 +252,12 @@ const handleLoginSuccess = function* handleLoginSuccess({ user }) {
252252
yield serversDB.write(async () => {
253253
try {
254254
const userRecord = await usersCollection.find(user.id);
255-
await userRecord.update(record => {
255+
await userRecord.update((record) => {
256256
record._raw = sanitizedRaw({ id: user.id, ...record._raw }, usersCollection.schema);
257257
Object.assign(record, u);
258258
});
259259
} catch (e) {
260-
await usersCollection.create(record => {
260+
await usersCollection.create((record) => {
261261
record._raw = sanitizedRaw({ id: user.id }, usersCollection.schema);
262262
Object.assign(record, u);
263263
});
@@ -341,7 +341,7 @@ const handleSetUser = function* handleSetUser({ user }) {
341341
yield serversDB.write(async () => {
342342
try {
343343
const record = await userCollections.find(userId);
344-
await record.update(userRecord => {
344+
await record.update((userRecord) => {
345345
if ('avatarETag' in user) {
346346
userRecord.avatarETag = user.avatarETag;
347347
}

app/sagas/rooms.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const updateRooms = function* updateRooms({ server, newRoomsUpdatedAt }) {
1818
const serverRecord = yield serversCollection.find(server);
1919

2020
return serversDB.write(async () => {
21-
await serverRecord.update(record => {
21+
await serverRecord.update((record) => {
2222
record.roomsUpdatedAt = newRoomsUpdatedAt;
2323
});
2424
});
@@ -75,12 +75,12 @@ const handleRoomsRequest = function* handleRoomsRequest({ params }) {
7575

7676
const allRecords = [
7777
...subsToCreate.map(subscription =>
78-
subCollection.prepareCreate(s => {
78+
subCollection.prepareCreate((s) => {
7979
s._raw = sanitizedRaw({ id: subscription.rid }, subCollection.schema);
8080
return Object.assign(s, subscription);
8181
})
8282
),
83-
...subsToUpdate.map(subscription => {
83+
...subsToUpdate.map((subscription) => {
8484
try {
8585
const newSub = subscriptions.find(s => s._id === subscription._id);
8686
if (!newSub) {
@@ -99,7 +99,7 @@ const handleRoomsRequest = function* handleRoomsRequest({ params }) {
9999
return null;
100100
}
101101
}),
102-
...subsToDelete.map(subscription => {
102+
...subsToDelete.map((subscription) => {
103103
try {
104104
return subscription.prepareDestroyPermanently();
105105
} catch (e) {
@@ -108,13 +108,13 @@ const handleRoomsRequest = function* handleRoomsRequest({ params }) {
108108
}
109109
}),
110110
...messagesToCreate.map(message =>
111-
messagesCollection.prepareCreate(m => {
111+
messagesCollection.prepareCreate((m) => {
112112
m._raw = sanitizedRaw({ id: message._id }, messagesCollection.schema);
113113
m.subscription.id = message.rid;
114114
return Object.assign(m, message);
115115
})
116116
),
117-
...messagesToUpdate.map(message => {
117+
...messagesToUpdate.map((message) => {
118118
const newMessage = lastMessages.find(m => m._id === message.id);
119119
return message.prepareUpdate(() => {
120120
try {

0 commit comments

Comments
 (0)