From 538914def2fecec336c8282fc8d56007952908d5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Apr 2023 14:25:08 +0200 Subject: [PATCH 01/44] Bump addressable from 2.8.1 to 2.8.2 (#24392) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index fbf0faa614..0fac64c927 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -94,7 +94,7 @@ GEM minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.8.1) + addressable (2.8.2) public_suffix (>= 2.0.2, < 6.0) aes_key_wrap (1.1.0) airbrussh (1.4.1) From 0358abe73ad25b9bcfa225caea3eed51cba36e82 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Apr 2023 15:05:12 +0200 Subject: [PATCH 02/44] Bump typescript from 4.9.5 to 5.0.3 (#24398) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index b96f6e3141..eeee8e4200 100644 --- a/package.json +++ b/package.json @@ -200,7 +200,7 @@ "react-test-renderer": "^16.14.0", "stylelint": "^15.3.0", "stylelint-config-standard-scss": "^7.0.1", - "typescript": "^4.9.5", + "typescript": "^5.0.3", "webpack-dev-server": "^3.11.3", "yargs": "^17.7.1" }, diff --git a/yarn.lock b/yarn.lock index aa74dd82c9..e3ba8c8d52 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11390,10 +11390,10 @@ type@^2.0.0: resolved "https://registry.yarnpkg.com/type/-/type-2.0.0.tgz#5f16ff6ef2eb44f260494dae271033b29c09a9c3" integrity sha512-KBt58xCHry4Cejnc2ISQAF7QY+ORngsWfxezO68+12hKV6lQY8P/psIkcbjeHWn7MqcgciWJyCCevFMJdIXpow== -typescript@^4.9.5: - version "4.9.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" - integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== +typescript@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.3.tgz#fe976f0c826a88d0a382007681cbb2da44afdedf" + integrity sha512-xv8mOEDnigb/tN9PSMTwSEqAnUvkoXMQlicOb0IUVDBSQCgBSaAAROUZYy2IcUy5qU6XajK5jjjO7TMWqBTKZA== unbox-primitive@^1.0.2: version "1.0.2" From b80a7b031bdfc79e0498bb784abed9b7749c6f45 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Tue, 4 Apr 2023 10:32:08 -0400 Subject: [PATCH 03/44] Add typechecking in CI (#24405) --- .github/workflows/lint-js.yml | 9 +++++++++ .prettierignore | 2 ++ 2 files changed, 11 insertions(+) diff --git a/.github/workflows/lint-js.yml b/.github/workflows/lint-js.yml index 44929f63db..e0c309c736 100644 --- a/.github/workflows/lint-js.yml +++ b/.github/workflows/lint-js.yml @@ -6,22 +6,28 @@ on: paths: - 'package.json' - 'yarn.lock' + - 'tsconfig.json' - '.nvmrc' - '.prettier*' - '.eslint*' - '**/*.js' - '**/*.jsx' + - '**/*.ts' + - '**/*.tsx' - '.github/workflows/lint-js.yml' pull_request: paths: - 'package.json' - 'yarn.lock' + - 'tsconfig.json' - '.nvmrc' - '.prettier*' - '.eslint*' - '**/*.js' - '**/*.jsx' + - '**/*.ts' + - '**/*.tsx' - '.github/workflows/lint-js.yml' jobs: @@ -43,3 +49,6 @@ jobs: - name: ESLint run: yarn test:lint:js + + - name: Typecheck + run: yarn test:typecheck diff --git a/.prettierignore b/.prettierignore index 2ea4075333..9bdf769112 100644 --- a/.prettierignore +++ b/.prettierignore @@ -70,6 +70,8 @@ app/javascript/styles/mastodon/reset.scss # Ignore Javascript pending https://github.com/mastodon/mastodon/pull/23631 *.js *.jsx +*.ts +*.tsx # Ignore HTML till cleaned and included in CI *.html From a425915ce7d1148e9505c87889936c4c497061dd Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Tue, 4 Apr 2023 10:33:33 -0400 Subject: [PATCH 04/44] HTML string attributes set as booleans (#24408) --- app/javascript/mastodon/features/emoji/emoji.js | 4 ++-- app/javascript/packs/public.jsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/javascript/mastodon/features/emoji/emoji.js b/app/javascript/mastodon/features/emoji/emoji.js index bc3dd8c602..6ae4066242 100644 --- a/app/javascript/mastodon/features/emoji/emoji.js +++ b/app/javascript/mastodon/features/emoji/emoji.js @@ -50,7 +50,7 @@ const emojifyTextNode = (node, customEmojis) => { if (shortname in customEmojis) { const filename = autoPlayGif ? customEmojis[shortname].url : customEmojis[shortname].static_url; replacement = document.createElement('img'); - replacement.setAttribute('draggable', false); + replacement.setAttribute('draggable', 'false'); replacement.setAttribute('class', 'emojione custom-emoji'); replacement.setAttribute('alt', shortname); replacement.setAttribute('title', shortname); @@ -65,7 +65,7 @@ const emojifyTextNode = (node, customEmojis) => { const { filename, shortCode } = unicodeMapping[match]; const title = shortCode ? `:${shortCode}:` : ''; replacement = document.createElement('img'); - replacement.setAttribute('draggable', false); + replacement.setAttribute('draggable', 'false'); replacement.setAttribute('class', 'emojione'); replacement.setAttribute('alt', match); replacement.setAttribute('title', title); diff --git a/app/javascript/packs/public.jsx b/app/javascript/packs/public.jsx index a5e2014f7e..3db6c5c6a0 100644 --- a/app/javascript/packs/public.jsx +++ b/app/javascript/packs/public.jsx @@ -291,10 +291,10 @@ function main() { if (sidebar.classList.contains('visible')) { document.body.style.overflow = null; - toggleButton.setAttribute('aria-expanded', false); + toggleButton.setAttribute('aria-expanded', 'false'); } else { document.body.style.overflow = 'hidden'; - toggleButton.setAttribute('aria-expanded', true); + toggleButton.setAttribute('aria-expanded', 'true'); } toggleButton.classList.toggle('active'); From ec0c104bf25f2689c31bb79f9f447be1a9b3da7f Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Tue, 4 Apr 2023 10:33:44 -0400 Subject: [PATCH 05/44] Ensure tabIndex is number instead of string (#24409) --- .../components/admin/ReportReasonSelector.jsx | 4 ++-- .../mastodon/components/autosuggest_input.jsx | 2 +- .../components/autosuggest_textarea.jsx | 2 +- .../components/column_back_button_slim.jsx | 2 +- .../mastodon/components/dropdown_menu.jsx | 2 +- app/javascript/mastodon/components/gifv.jsx | 4 ++-- .../mastodon/components/icon_button.jsx | 4 ++-- .../intersection_observer_article.jsx | 4 ++-- .../picture_in_picture_placeholder.jsx | 2 +- app/javascript/mastodon/components/poll.jsx | 2 +- app/javascript/mastodon/components/status.jsx | 4 ++-- .../mastodon/components/status_content.jsx | 6 +++--- .../mastodon/features/about/index.jsx | 2 +- .../mastodon/features/audio/index.jsx | 8 ++++---- .../compose/components/language_dropdown.jsx | 2 +- .../features/compose/components/poll_form.jsx | 2 +- .../compose/components/privacy_dropdown.jsx | 2 +- .../features/compose/components/search.jsx | 2 +- .../features/compose/components/upload.jsx | 2 +- .../components/conversation.jsx | 2 +- .../features/filters/select_filter.jsx | 4 ++-- .../features/list_editor/components/search.jsx | 2 +- .../mastodon/features/list_editor/index.jsx | 2 +- .../mastodon/features/list_timeline/index.jsx | 4 ++-- .../components/clear_column_button.jsx | 2 +- .../components/grant_permission_button.jsx | 2 +- .../notifications/components/notification.jsx | 18 +++++++++--------- .../features/report/components/option.jsx | 2 +- .../mastodon/features/status/index.jsx | 2 +- .../features/ui/components/actions_modal.jsx | 2 +- .../features/ui/components/media_modal.jsx | 4 ++-- .../mastodon/features/video/index.jsx | 6 +++--- 32 files changed, 55 insertions(+), 55 deletions(-) diff --git a/app/javascript/mastodon/components/admin/ReportReasonSelector.jsx b/app/javascript/mastodon/components/admin/ReportReasonSelector.jsx index 58a861fde6..cd14dac4e3 100644 --- a/app/javascript/mastodon/components/admin/ReportReasonSelector.jsx +++ b/app/javascript/mastodon/components/admin/ReportReasonSelector.jsx @@ -33,7 +33,7 @@ class Category extends React.PureComponent { const { id, text, disabled, selected, children } = this.props; return ( -
+
{selected && }
@@ -74,7 +74,7 @@ class Rule extends React.PureComponent { const { id, text, disabled, selected } = this.props; return ( -
+
{selected && } {text} diff --git a/app/javascript/mastodon/components/autosuggest_input.jsx b/app/javascript/mastodon/components/autosuggest_input.jsx index f9616c5817..a68e2a01b4 100644 --- a/app/javascript/mastodon/components/autosuggest_input.jsx +++ b/app/javascript/mastodon/components/autosuggest_input.jsx @@ -180,7 +180,7 @@ export default class AutosuggestInput extends ImmutablePureComponent { } return ( -
+
{inner}
); diff --git a/app/javascript/mastodon/components/autosuggest_textarea.jsx b/app/javascript/mastodon/components/autosuggest_textarea.jsx index c044912983..a627bc1ec2 100644 --- a/app/javascript/mastodon/components/autosuggest_textarea.jsx +++ b/app/javascript/mastodon/components/autosuggest_textarea.jsx @@ -186,7 +186,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent { } return ( -
+
{inner}
); diff --git a/app/javascript/mastodon/components/column_back_button_slim.jsx b/app/javascript/mastodon/components/column_back_button_slim.jsx index cc8bfb1515..46ac23736b 100644 --- a/app/javascript/mastodon/components/column_back_button_slim.jsx +++ b/app/javascript/mastodon/components/column_back_button_slim.jsx @@ -8,7 +8,7 @@ export default class ColumnBackButtonSlim extends ColumnBackButton { render () { return (
-
+
diff --git a/app/javascript/mastodon/components/dropdown_menu.jsx b/app/javascript/mastodon/components/dropdown_menu.jsx index c04c513fbe..eaaa72fd83 100644 --- a/app/javascript/mastodon/components/dropdown_menu.jsx +++ b/app/javascript/mastodon/components/dropdown_menu.jsx @@ -119,7 +119,7 @@ class DropdownMenu extends React.PureComponent { return (
  • - + {text}
  • diff --git a/app/javascript/mastodon/components/gifv.jsx b/app/javascript/mastodon/components/gifv.jsx index 9ec201c6cc..1ce7e7c29b 100644 --- a/app/javascript/mastodon/components/gifv.jsx +++ b/app/javascript/mastodon/components/gifv.jsx @@ -46,7 +46,7 @@ export default class GIFV extends React.PureComponent { width={width} height={height} role='button' - tabIndex='0' + tabIndex={0} aria-label={alt} title={alt} lang={lang} @@ -57,7 +57,7 @@ export default class GIFV extends React.PureComponent {