Skip to content

Commit 7bebb5f

Browse files
[DISC-120] Update to prettier and corresponding eslint plugin
* chore(deps): update dependency prettier to v3 * Update prettier config to use auto end of line setting * Linting and prettifying * Prettier fixes and running format * Prettier fix * Fix by consolidating updates to prettier and eslint plugin --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Wolfdragon24 <[email protected]>
1 parent a586bb2 commit 7bebb5f

File tree

8 files changed

+147
-99
lines changed

8 files changed

+147
-99
lines changed

commands/wordle.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ module.exports = {
190190
for (let j = 0; j < 6; j++) {
191191
const imageNums = getAnswer(answer, guesses[j]);
192192
for (let i = 0; i < 5; i++) {
193-
// eslint-disable-next-line no-undef
194193
const imageNumber = imageNums[i];
195194
square = square_arr[imageNumber];
196195

eslint.config.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,12 @@ export default [...compat.extends("eslint:recommended", "prettier"), {
8787
"no-var": "error",
8888
"object-curly-spacing": ["error", "always"],
8989
"prefer-const": "error",
90-
"prettier/prettier": "error",
90+
"prettier/prettier": [
91+
"error",
92+
{
93+
"endOfLine": "auto",
94+
}
95+
],
9196
semi: ["error", "always"],
9297
"space-before-blocks": "error",
9398
"space-in-parens": "error",

events/createvc.js

Lines changed: 63 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -4,80 +4,74 @@ const fs = require("fs");
44
// The function has 2 parts to it. The first part is that which deletes all the channels from the saved file that are deleted in the channel.
55
// In the second part, we delete all the temporary channels that have no user in it.
66

7-
/* eslint-disable */
8-
97
module.exports = {
108
name: "ready",
119
once: true,
1210
execute(client) {
13-
const timer = setInterval(function () {
14-
// const temp_data = [];
15-
// Reading data from the file
16-
fs.readFile("./data/createvc.json", "utf-8", (err, jsonString) => {
17-
if (err) {
18-
console.log("Error reading file from disk:", err);
19-
return;
20-
} else {
21-
// Converting the data to a dictionary
22-
const data = JSON.parse(jsonString);
23-
24-
// Deleting all the channels, that should have been deleted
25-
const b = data.channels.filter((e) => e.delete == true);
26-
b.forEach((f) =>
27-
data.channels.splice(
28-
data.channels.findIndex((e) => e.delete === f.delete),
29-
1,
30-
),
31-
);
32-
33-
fs.writeFileSync(
34-
"./data/createvc.json",
35-
JSON.stringify({ users: data.users, channels: data.channels }, null, 4),
36-
);
11+
const timer = setInterval(
12+
function () {
13+
// Reading data from the file
14+
fs.readFile("./data/createvc.json", "utf-8", (err, jsonString) => {
15+
if (err) {
16+
console.log("Error reading file from disk:", err);
17+
return;
18+
} else {
19+
deleteExistentChannels(client, jsonString);
20+
}
21+
});
22+
// Write back to the file
23+
},
24+
60 * 60 * 1000,
25+
);
26+
},
27+
};
3728

38-
// console.log(data);
29+
function deleteExistentChannels(client, jsonString) {
30+
// Converting the data to a dictionary
31+
const data = JSON.parse(jsonString);
3932

40-
data.channels.forEach((item) => {
41-
// item here is the channel id
42-
if (item.delete == false) {
43-
client.channels
44-
.fetch(item.channel_id)
45-
.then((channel) => {
46-
channel
47-
.fetch()
48-
.then((channel) => {
49-
if (channel.members.size == 0) {
50-
// console.log(channel.name);
51-
// console.log(channel.members.size);
33+
// Deleting all the channels, that should have been deleted
34+
const b = data.channels.filter((e) => e.delete == true);
35+
b.forEach((f) =>
36+
data.channels.splice(
37+
data.channels.findIndex((e) => e.delete === f.delete),
38+
1,
39+
),
40+
);
5241

53-
item.delete = true;
54-
fs.writeFileSync(
55-
"./data/createvc.json",
56-
JSON.stringify(
57-
{
58-
users: data.users,
59-
channels: data.channels,
60-
},
61-
null,
62-
4,
63-
),
64-
);
65-
channel
66-
.delete()
67-
.then(console.log)
68-
.catch(console.error);
69-
}
70-
})
71-
.catch(console.error);
72-
})
73-
.catch(console.error);
74-
}
75-
});
42+
fs.writeFileSync(
43+
"./data/createvc.json",
44+
JSON.stringify({ users: data.users, channels: data.channels }, null, 4),
45+
);
7646

77-
// console.log(data.channels);
78-
}
79-
});
80-
// Write back to the file
81-
}, 60 * 60 * 1000);
82-
},
83-
};
47+
data.channels.forEach((item) => {
48+
// item here is the channel id
49+
if (item.delete == false) {
50+
client.channels
51+
.fetch(item.channel_id)
52+
.then((channel) => {
53+
channel
54+
.fetch()
55+
.then((vcChannel) => {
56+
if (vcChannel.members.size == 0) {
57+
item.delete = true;
58+
fs.writeFileSync(
59+
"./data/createvc.json",
60+
JSON.stringify(
61+
{
62+
users: data.users,
63+
channels: data.channels,
64+
},
65+
null,
66+
4,
67+
),
68+
);
69+
vcChannel.delete().then(console.log).catch(console.error);
70+
}
71+
})
72+
.catch(console.error);
73+
})
74+
.catch(console.error);
75+
}
76+
});
77+
}

events/faq_ready.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// @ts-check
22
const { DBFaq } = require("../lib/database/faq");
3-
/* eslint-disable */
43

54
module.exports = {
65
name: "ready",

events/reactrole_read.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const { DBReactRole } = require("../lib/database/dbreactrole");
2-
/* eslint-disable */
32

43
module.exports = {
54
name: "ready",

events/schedulepost_ready.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const { DBSchedulePost } = require("../lib/database/dbschedulepost");
2-
/* eslint-disable */
32

43
module.exports = {
54
name: "ready",

package-lock.json

Lines changed: 74 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"format": "prettier -w './**/*.js'",
8-
"format:check": "prettier --check './**/*.js'",
7+
"format": "prettier -w ./**/*.js",
8+
"format:check": "prettier --check ./**/*.js",
99
"lint": "eslint",
1010
"lint:fix": "eslint --fix",
1111
"test": "echo \"Error: no test specified\" && exit 1",
@@ -58,9 +58,9 @@
5858
"@eslint/js": "^9.5.0",
5959
"eslint": "^9.5.0",
6060
"eslint-config-prettier": "9.1.0",
61-
"eslint-plugin-prettier": "4.2.1",
61+
"eslint-plugin-prettier": "^5.0.0",
6262
"globals": "^15.5.0",
6363
"node-pre-gyp": "0.12.0",
64-
"prettier": "2.7.1"
64+
"prettier": "3.3.2"
6565
}
6666
}

0 commit comments

Comments
 (0)