Title: [Chore]: enable @typescript-eslint/no-floating-promises · Issue #5459 · coder/code-server · GitHub
Open Graph Title: [Chore]: enable @typescript-eslint/no-floating-promises · Issue #5459 · coder/code-server
X Title: [Chore]: enable @typescript-eslint/no-floating-promises · Issue #5459 · coder/code-server
Description: What is your suggestion? To enable a new ESLint rule: @typescript-eslint/no-floating-promises Why do you want this feature? We believe it would have prevented issues like #5442 and any future issues related to floating promises. Are ther...
Open Graph Description: What is your suggestion? To enable a new ESLint rule: @typescript-eslint/no-floating-promises Why do you want this feature? We believe it would have prevented issues like #5442 and any future issue...
X Description: What is your suggestion? To enable a new ESLint rule: @typescript-eslint/no-floating-promises Why do you want this feature? We believe it would have prevented issues like #5442 and any future issue...
Opengraph URL: https://github.com/coder/code-server/issues/5459
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Chore]: enable @typescript-eslint/no-floating-promises ","articleBody":"## What is your suggestion?\r\n\r\nTo enable a new ESLint rule: [`@typescript-eslint/no-floating-promises`](https://typescript-eslint.io/rules/no-floating-promises)\r\n\r\n## Why do you want this feature?\r\n\r\nWe believe it would have prevented issues like https://github.com/coder/code-server/pull/5442 and any future issues related to floating promises.\r\n\r\n## Are there any workarounds to get this functionality today?\r\n\r\nManually checking code myself to see if we have any floating promises.\r\n\r\n## Are you interested in submitting a PR for this?\r\n\r\nYes, but it might take some work. I did some initial investigation. See below:\r\n\r\n\r\n\u003cdetails>\r\n\u003csummary>Expand to see\u003c/summary>\r\n\r\nTo add this rule, we need to:\r\n1. adjust our `.eslintrc.yaml` file\r\n\r\n```diff\r\ndiff --git a/.eslintrc.yaml b/.eslintrc.yaml\r\nindex 1bbbbd09..9388ad15 100644\r\n--- a/.eslintrc.yaml\r\n+++ b/.eslintrc.yaml\r\n@@ -8,10 +8,12 @@ env:\r\n parserOptions:\r\n ecmaVersion: 2018\r\n sourceType: module\r\n+ project: './tsconfig.json'\r\n \r\n extends:\r\n - eslint:recommended\r\n - plugin:@typescript-eslint/recommended\r\n+ # - plugin:@typescript-eslint/recommended-requiring-type-checking\r\n - plugin:import/recommended\r\n - plugin:import/typescript\r\n - plugin:prettier/recommended\r\n@@ -32,6 +34,7 @@ rules:\r\n \"@typescript-eslint/explicit-module-boundary-types\": off\r\n \"@typescript-eslint/no-explicit-any\": off\r\n \"@typescript-eslint/no-extra-semi\": off\r\n+ \"@typescript-eslint/no-floating-promises\": 2\r\n eqeqeq: error\r\n import/order:\r\n [error, { alphabetize: { order: \"asc\" }, groups: [[\"builtin\", \"external\", \"internal\"], \"parent\", \"sibling\"] }]\r\n@@ -41,3 +44,5 @@ settings:\r\n import/resolver:\r\n typescript:\r\n alwaysTryTypes: true\r\n+\r\n+ignorePatterns: \"/test\"\r\n\\ No newline at end of file\r\n```\r\n2. remove `--max-warnings=0` from `lint.sh` \r\n3. fix all 16 errors \r\n\r\nBecause of an issue in ESLint -- https://github.com/eslint/eslint/issues/15010 -- it's not possible to both ignore files from being linted without `eslint` counting them as warnings in CLI output. \r\n\r\nBUT that assumes we don't want to lint test files. If we do, we need to add the `\"./test/tsconfig.json\"` to `project`.\r\n\r\nHere are all 32 errors found by the linter (including test files):\r\n\r\n```shell\r\nyarn run v1.22.18\r\n$ ./ci/dev/lint.sh\r\n\r\n/Users/jp/dev/coder/code-server/ci/dev/watch.ts\r\n 0:0 error Parsing error: \"parserOptions.project\" has been set for @typescript-eslint/parser.\r\nThe file does not match your project config: ci/dev/watch.ts.\r\nThe file must be included in at least one of the projects provided\r\n\r\n/Users/jp/dev/coder/code-server/src/node/heart.ts\r\n 64:7 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n\r\n/Users/jp/dev/coder/code-server/src/node/main.ts\r\n 191:7 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n\r\n/Users/jp/dev/coder/code-server/src/node/routes/index.ts\r\n 61:7 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n 175:5 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n\r\n/Users/jp/dev/coder/code-server/src/node/routes/vscode.ts\r\n 125:5 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n\r\n/Users/jp/dev/coder/code-server/src/node/socket.ts\r\n 25:7 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n 50:9 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n 60:13 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n\r\n/Users/jp/dev/coder/code-server/src/node/update.ts\r\n 45:7 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n\r\n/Users/jp/dev/coder/code-server/src/node/wrapper.ts\r\n 118:7 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n 166:9 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n 228:7 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n 233:7 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n 250:11 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n 272:5 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n\r\n/Users/jp/dev/coder/code-server/test/e2e/extensions/test-extension/extension.ts\r\n 7:9 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n 9:9 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n\r\n/Users/jp/dev/coder/code-server/test/unit/common/emitter.test.ts\r\n 52:5 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n 55:5 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n\r\n/Users/jp/dev/coder/code-server/test/unit/helpers.test.ts\r\n 16:5 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n\r\n/Users/jp/dev/coder/code-server/test/unit/node/app.test.ts\r\n 54:5 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n 73:5 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n 92:7 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n 95:5 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n 107:5 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n 119:5 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n 137:5 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n\r\n/Users/jp/dev/coder/code-server/test/unit/node/cli.test.ts\r\n 740:5 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n\r\n/Users/jp/dev/coder/code-server/test/unit/node/socket.test.ts\r\n 40:9 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n\r\n/Users/jp/dev/coder/code-server/test/unit/node/test-plugin/.eslintrc.js\r\n 0:0 error Parsing error: \"parserOptions.project\" has been set for @typescript-eslint/parser.\r\nThe file does not match your project config: test/unit/node/test-plugin/.eslintrc.js.\r\nThe file must be included in at least one of the projects provided\r\n\r\n/Users/jp/dev/coder/code-server/test/unit/node/util.test.ts\r\n 154:5 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises\r\n\r\n✖ 32 problems (32 errors, 0 warnings)\r\n\r\ninfo Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\r\n```\r\n\r\n\u003c/details>\r\n","author":{"url":"https://github.com/jsjoeio","@type":"Person","name":"jsjoeio"},"datePublished":"2022-08-15T20:14:42Z","url":"https://github.com/coder/code-server/issues/5459"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:64a7d777-eb29-e1a9-c425-1a73e445375c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9150:2E9831:91AA67:C075F3:6B01B3DD |
| html-safe-nonce | 2b887582d549c846c7dd1bf82efe8ee18345e7a07a281916839b009dca0588bf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MTUwOjJFOTgzMTo5MUFBNjc6QzA3NUYzOjZCMDFCM0REIiwidmlzaXRvcl9pZCI6IjM3OTM4MjI5NjMxNDU0ODczMjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 202aecdc4617ab210ef6241c4a8b8a66e3c91384ff7b49671e4e6a6becd78408 |
| hovercard-subject-tag | issue:1339450717 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/code-server/5459/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d6868def1e29611d3a4863562f0dfac50d55a74777829639146c44d929dd88ac/coder/code-server/issues/5459 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d6868def1e29611d3a4863562f0dfac50d55a74777829639146c44d929dd88ac/coder/code-server/issues/5459 |
| og:image:alt | What is your suggestion? To enable a new ESLint rule: @typescript-eslint/no-floating-promises Why do you want this feature? We believe it would have prevented issues like #5442 and any future issue... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jsjoeio |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/coder/code-server git https://github.com/coder/code-server.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 172953845 |
| octolytics-dimension-repository_nwo | coder/code-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 172953845 |
| octolytics-dimension-repository_network_root_nwo | coder/code-server |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width