Skip to content

Commit de0372f

Browse files
authored
Merge pull request #1 from NYTDiscordBot/danceparty/remove-clashing-lint-rules
[danceparty] remove clashing prettier rules
2 parents be41eb4 + 2affe07 commit de0372f

5 files changed

Lines changed: 13 additions & 6 deletions

File tree

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"root": true,
33
"parser": "@typescript-eslint/parser",
44
"plugins": ["@typescript-eslint"],
5-
"extends": ["prettier", "plugin:prettier/recommended"]
5+
"extends": ["prettier"]
66
}

__tests__/discord-client.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe("DiscordClient", () => {
5151

5252
describe("isValidChannel", () => {
5353
test("returns true if the channel is not empty", () => {
54-
const input = "channel name";
54+
const input = "123456789012345678";
5555
const output = true;
5656
expect(discordClient.isValidChannel(input)).toEqual(output);
5757
});

config/jest.setup.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = async () => {
2+
const CHANNEL_CHANGELOG = "123456789012345678";
3+
const CHANNEL_MAIN = "876543210987654321";
4+
process.env = Object.assign(process.env, {
5+
CHANGELOG_CHANNEL: CHANNEL_CHANGELOG,
6+
CHANNEL: CHANNEL_MAIN,
7+
});
8+
};

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
22
preset: "ts-jest",
33
testEnvironment: "node",
4-
setupFiles: ["dotenv/config"],
4+
globalSetup: "./config/jest.setup.js",
55
};

src/DiscordClient.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ class DiscordClient extends Client {
3434
};
3535

3636
isValidChannel = (channelName: string): boolean => {
37-
// since they are environment variables, we can only really check that
38-
// they are not empty
39-
return channelName.length > 0;
37+
// channel ids seem to always be 18 length
38+
return channelName.length === 18;
4039
};
4140
}
4241

0 commit comments

Comments
 (0)