From c065156a8883d81e58f3603e468289344f8a20a5 Mon Sep 17 00:00:00 2001 From: Crawl Date: Sat, 29 Feb 2020 14:35:57 +0100 Subject: [PATCH] chore: consistency/prettier (#3852) * chore: consistency/prettier * chore: rebase * chore: rebase * chore: include typings * fix: include typings file in prettier lint-staged --- .eslintrc.json | 87 +- .github/CONTRIBUTING.md | 1 + .github/ISSUE_TEMPLATE/bug_report.md | 8 +- .github/ISSUE_TEMPLATE/feature_request.md | 3 +- .github/PULL_REQUEST_TEMPLATE.md | 5 +- .tern-project | 8 +- README.md | 42 +- docs/examples/attachments.md | 70 +- docs/examples/embed.js | 4 +- docs/examples/moderation.md | 68 +- docs/general/faq.md | 6 +- docs/general/updating.md | 78 +- docs/general/welcome.md | 32 +- docs/topics/partials.md | 2 +- docs/topics/voice.md | 28 +- docs/topics/web.md | 7 + jsdoc.json | 2 +- package.json | 16 +- src/client/BaseClient.js | 2 +- src/client/Client.js | 74 +- src/client/WebhookClient.js | 2 +- src/client/actions/Action.js | 65 +- src/client/actions/ChannelDelete.js | 2 +- src/client/actions/GuildIntegrationsUpdate.js | 1 - src/client/actions/GuildMemberRemove.js | 1 - src/client/actions/GuildRoleCreate.js | 1 - src/client/actions/GuildRoleDelete.js | 1 - src/client/actions/GuildRoleUpdate.js | 1 - src/client/actions/GuildUpdate.js | 1 - src/client/actions/MessageCreate.js | 1 - src/client/actions/MessageDelete.js | 1 - src/client/actions/MessageDeleteBulk.js | 13 +- src/client/actions/MessageReactionRemove.js | 1 - src/client/actions/VoiceStateUpdate.js | 9 +- src/client/actions/WebhooksUpdate.js | 1 - src/client/voice/ClientVoiceManager.js | 7 +- src/client/voice/VoiceBroadcast.js | 7 +- src/client/voice/VoiceConnection.js | 72 +- .../voice/dispatcher/StreamDispatcher.js | 38 +- src/client/voice/networking/VoiceUDPClient.js | 4 +- src/client/voice/networking/VoiceWebSocket.js | 7 +- src/client/voice/player/BasePlayer.js | 14 +- .../voice/player/BroadcastAudioPlayer.js | 4 +- src/client/voice/receiver/PacketHandler.js | 8 +- src/client/voice/util/PlayInterface.js | 4 +- src/client/voice/util/Silence.js | 2 +- src/client/voice/util/VolumeInterface.js | 13 +- src/client/websocket/WebSocketManager.js | 10 +- src/client/websocket/WebSocketShard.js | 26 +- .../websocket/handlers/CHANNEL_UPDATE.js | 1 - src/client/websocket/handlers/GUILD_CREATE.js | 12 +- .../websocket/handlers/GUILD_MEMBERS_CHUNK.js | 2 +- .../websocket/handlers/GUILD_MEMBER_ADD.js | 10 +- src/client/websocket/handlers/TYPING_START.js | 12 +- src/errors/Messages.js | 16 +- src/managers/BaseManager.js | 6 +- src/managers/ChannelManager.js | 10 +- src/managers/GuildChannelManager.js | 2 +- src/managers/GuildEmojiManager.js | 21 +- src/managers/GuildEmojiRoleManager.js | 8 +- src/managers/GuildManager.js | 74 +- src/managers/GuildMemberManager.js | 41 +- src/managers/GuildMemberRoleManager.js | 20 +- src/managers/MessageManager.js | 140 +- src/managers/PresenceManager.js | 26 +- src/managers/ReactionManager.js | 40 +- src/managers/ReactionUserManager.js | 13 +- src/managers/RoleManager.js | 21 +- src/managers/UserManager.js | 2 +- src/rest/APIRequest.js | 15 +- src/rest/APIRouter.js | 24 +- src/rest/DiscordAPIError.js | 2 +- src/rest/RESTManager.js | 18 +- src/rest/RequestHandler.js | 14 +- src/sharding/Shard.js | 16 +- src/sharding/ShardClientUtil.js | 41 +- src/sharding/ShardingManager.js | 39 +- src/structures/APIMessage.js | 22 +- src/structures/Base.js | 4 +- src/structures/Channel.js | 7 +- src/structures/ClientApplication.js | 30 +- src/structures/ClientPresence.js | 48 +- src/structures/ClientUser.js | 6 +- src/structures/Emoji.js | 3 +- src/structures/Guild.js | 277 +- src/structures/GuildAuditLogs.js | 174 +- src/structures/GuildChannel.js | 137 +- src/structures/GuildEmoji.js | 32 +- src/structures/GuildMember.js | 32 +- src/structures/Integration.js | 15 +- src/structures/Invite.js | 10 +- src/structures/Message.js | 136 +- src/structures/MessageEmbed.js | 138 +- src/structures/MessageMentions.js | 4 +- src/structures/MessageReaction.js | 7 +- src/structures/PermissionOverwrites.js | 19 +- src/structures/Presence.js | 51 +- src/structures/ReactionCollector.js | 3 +- src/structures/ReactionEmoji.js | 2 +- src/structures/Role.js | 82 +- src/structures/Team.js | 4 +- src/structures/TextChannel.js | 14 +- src/structures/User.js | 34 +- src/structures/VoiceChannel.js | 4 +- src/structures/VoiceState.js | 12 +- src/structures/Webhook.js | 54 +- src/structures/interfaces/Collector.js | 2 +- src/structures/interfaces/TextBasedChannel.js | 50 +- src/util/Collection.js | 2 +- src/util/Constants.js | 105 +- src/util/DataResolver.js | 6 +- src/util/Snowflake.js | 12 +- src/util/Structures.js | 2 +- src/util/Util.js | 148 +- test/disableMentions.js | 47 +- test/escapeMarkdown.test.js | 147 +- test/random.js | 121 +- test/sendtest.js | 81 +- test/shard.js | 14 +- test/tester1000.js | 9 +- test/voice.js | 36 +- test/webhooktest.js | 95 +- test/webpack.html | 47 +- tsconfig.json | 32 +- tslint.json | 54 +- typings/index.d.ts | 5828 +++++++++-------- webpack.config.js | 6 +- 127 files changed, 5198 insertions(+), 4513 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 549500347..f524f5f7d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,5 +1,6 @@ { - "extends": "eslint:recommended", + "extends": ["eslint:recommended", "plugin:prettier/recommended"], + "plugins": ["import"], "parserOptions": { "ecmaVersion": 2019 }, @@ -7,42 +8,58 @@ "es6": true, "node": true }, - "overrides": [ - { "files": ["*.browser.js"], "env": { "browser": true } } - ], + "overrides": [{ "files": ["*.browser.js"], "env": { "browser": true } }], "rules": { + "import/order": [ + "error", + { + "groups": ["builtin", "external", "internal", "index", "sibling", "parent"], + "alphabetize": { + "order": "asc" + } + } + ], + "prettier/prettier": [ + 2, + { + "printWidth": 120, + "singleQuote": true, + "quoteProps": "as-needed", + "trailingComma": "all", + "endOfLine": "lf" + } + ], "strict": ["error", "global"], "no-await-in-loop": "warn", "no-compare-neg-zero": "error", - "no-extra-parens": ["warn", "all", { - "nestedBinaryExpressions": false - }], "no-template-curly-in-string": "error", "no-unsafe-negation": "error", - "valid-jsdoc": ["error", { - "requireReturn": false, - "requireReturnDescription": false, - "prefer": { - "return": "returns", - "arg": "param" - }, - "preferType": { - "String": "string", - "Number": "number", - "Boolean": "boolean", - "Symbol": "symbol", - "object": "Object", - "function": "Function", - "array": "Array", - "date": "Date", - "error": "Error", - "null": "void" + "valid-jsdoc": [ + "error", + { + "requireReturn": false, + "requireReturnDescription": false, + "prefer": { + "return": "returns", + "arg": "param" + }, + "preferType": { + "String": "string", + "Number": "number", + "Boolean": "boolean", + "Symbol": "symbol", + "object": "Object", + "function": "Function", + "array": "Array", + "date": "Date", + "error": "Error", + "null": "void" + } } - }], + ], "accessor-pairs": "warn", "array-callback-return": "error", - "complexity": "warn", "consistent-return": "error", "curly": ["error", "multi-line", "consistent"], "dot-location": ["error", "property"], @@ -100,7 +117,6 @@ "func-names": "error", "func-name-matching": "error", "func-style": ["error", "declaration", { "allowArrowFunctions": true }], - "indent": ["error", 2, { "SwitchCase": 1 }], "key-spacing": "error", "keyword-spacing": "error", "max-depth": "error", @@ -112,7 +128,6 @@ "no-array-constructor": "error", "no-inline-comments": "error", "no-lonely-if": "error", - "no-mixed-operators": "error", "no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1, "maxBOF": 0 }], "no-new-object": "error", "no-spaced-func": "error", @@ -122,18 +137,20 @@ "nonblock-statement-body-position": "error", "object-curly-spacing": ["error", "always"], "operator-assignment": "error", - "operator-linebreak": ["error", "after"], "padded-blocks": ["error", "never"], "quote-props": ["error", "as-needed"], "quotes": ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": true }], "semi-spacing": "error", "semi": "error", "space-before-blocks": "error", - "space-before-function-paren": ["error", { - "anonymous": "never", - "named": "never", - "asyncArrow": "always" - }], + "space-before-function-paren": [ + "error", + { + "anonymous": "never", + "named": "never", + "asyncArrow": "always" + } + ], "space-in-parens": "error", "space-infix-ops": "error", "space-unary-ops": "error", diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index fd6de7242..84ecd2d46 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -7,6 +7,7 @@ pull request. We use ESLint to enforce a consistent coding style, so having that is a great boon to your development process. ## Setup + To get ready to work on the codebase, please do the following: 1. Fork & clone the repository, and make sure you're on the **master** branch diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index d5061af2b..caa9425b7 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,12 +1,11 @@ --- + name: Bug report about: Report incorrect or unexpected behaviour of discord.js title: '' labels: 's: unverified, type: bug' assignees: '' - --- -