Commit Graph

63 Commits (d0c1a8e69ca7697074d0045c30cf58e4f6ed0a3a)

Author SHA1 Message Date
Kerry 209b65243a
Enable "jsx-a11y/alt-text" and "jsx-a11y/label-has-associated-control" lint rules (#10361)
* enable "jsx-a11y/alt-text" lint rule

* enable "jsx-a11y/label-has-associated-control"
2023-03-14 21:25:11 +00:00
Michael Telatynski af1ec76149
Fix jest/no-conditional-expect lint and enable it (#10307) 2023-03-07 13:58:10 +00:00
Michael Weimann 5398db21ad
Add ESLint Jest (#10261) 2023-03-01 16:23:35 +01:00
Michael Telatynski 35d222bac6
Add @typescript-eslint/no-base-to-string (#10091) 2023-02-07 10:08:10 +00:00
Michael Telatynski 030b7e90bf
Enable `@typescript-eslint/explicit-function-return-type` in /src (#9788)
* Enable `@typescript-eslint/explicit-member-accessibility` on /src

* Prettier

* Enable `@typescript-eslint/explicit-function-return-type` in /src

* Fix types

* tsc strict fixes

* Delint

* Fix test

* Fix bad merge
2023-01-12 13:25:14 +00:00
Michael Telatynski f1e8e7f140
Enable `@typescript-eslint/explicit-member-accessibility` on /src (#9785)
* Enable `@typescript-eslint/explicit-member-accessibility` on /src

* Prettier
2022-12-16 12:29:59 +00:00
Michael Weimann 526645c791
Apply prettier formatting 2022-12-12 12:24:14 +01:00
Michael Weimann 1cac306093
Add prettier 2022-12-12 12:20:54 +01:00
Michael Weimann 0277aea0cf
Update eslint-plugin-matrix-org to 0.8.0 2022-12-09 14:31:56 +01:00
Robin 0d6a550c33
Prepare for Element Call integration (#9224)
* Improve accessibility and testability of Tooltip

Adding a role to Tooltip was motivated by React Testing Library's
reliance on accessibility-related attributes to locate elements.

* Make the ReadyWatchingStore constructor safer

The ReadyWatchingStore constructor previously had a chance to
immediately call onReady, which was dangerous because it was potentially
calling the derived class's onReady at a point when the derived class
hadn't even finished construction yet. In normal usage, I guess this
never was a problem, but it was causing some of the tests I was writing
to crash. This is solved by separating out the onReady call into a start
method.

* Rename 1:1 call components to 'LegacyCall'

to reflect the fact that they're slated for removal, and to not clash
with the new Call code.

* Refactor VideoChannelStore into Call and CallStore

Call is an abstract class that currently only has a Jitsi
implementation, but this will make it easy to later add an Element Call
implementation.

* Remove WidgetReady, ClientReady, and ForceHangupCall hacks

These are no longer used by the new Jitsi call implementation, and can
be removed.

* yarn i18n

* Delete call map entries instead of inserting nulls

* Allow multiple active calls and consolidate call listeners

* Fix a race condition when creating a video room

* Un-hardcode the media device fallback labels

* Apply misc code review fixes

* yarn i18n

* Disconnect from calls more politely on logout

* Fix some strict mode errors

* Fix another updateRoom race condition
2022-08-30 15:13:39 -04:00
Travis Ralston 150c530850
Disable no-non-null assertions lint rule (#8699)
This *allows* us to use `variable!.prop` to ensure `variable` is not null/undefined.
2022-05-30 00:21:55 -06:00
Kerry 2c19d286ed
Eslint - require copyright header rule (#8514)
* bump eslint plugin to 0.5.2

Signed-off-by: Kerry Archibald <kerrya@element.io>

* add rule

Signed-off-by: Kerry Archibald <kerrya@element.io>

* add missing copyright headers

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix comment order

Signed-off-by: Kerry Archibald <kerrya@element.io>
2022-05-06 09:09:28 +00:00
David Baker b8013fc52a
Add a Cypress Test 🌲 (#8295)
* A first, maybe working cypress test

Plus cypress plugins to manage synapses in docker containers

* Fix yaml

* This file is important

* try & find where it's put the artifact

* Download artifact to a directory

* pics or it didn't happen

* Add conditional, otherwise no artifacts on failure...

* Try increasing timeout

also actually give the test a name

* Try in chrome

* Get docker logs to see why it's failing

also document the chrome setting

* Try changing mode on homeserver.yaml

* debug

* More debugging

* more file permissions debugging

* ARGH

* more debug

* sigh

* Eugh, that's not how arguments work

* Add the option to really allow open registration

and remove debug logging / comment fixes

* failure to yaml

* Upload docker logs as artifacts

and temporarily remove contional to test

* Put the conditional back

* Upgrade types in end to end tests

to be compatible with fs-extra types

* Try reducing timeout a bit

also make password more... sensible

* Hex is not octal

* Remove file mode

Seems to be unnecessary since the signing key is perfectly fine

* Give the log files extensions

* Rename workflow file now it also does tests

* Add cypress scripts

* copyright headers

* Use ? operator

Co-authored-by: Travis Ralston <travisr@matrix.org>

* Use develop synapse image

* Tidy up any remaining synapses after each spec run

Also:
 * Move the synapseStart / synapseStop functions out to the top level
   so they can be reused
 * Add a tsconfig file
 * Give the containers names

* Don't upload video on test pass

We don't upload it anyway so tell cypress not to so it can not
bother encoding them

* Enable linting on cypress files

and fix existing lint errors

* Type check cypress files

and make it pass the type checks, specifically:
 * Upgrade sinon fake timers to a version that has the right types
 * Set module resolution
 * Type check cypress files separately

* Rename workflow file again

Probably better to just call it an element web build

* Don't plus + characters in container name

* Fix yaml

* Stream logs to file

* Add note to end to end tester to sya what's been ported

* Put docker rm in finally block

Co-authored-by: Travis Ralston <travisr@matrix.org>
2022-04-14 10:41:58 +01:00
Travis Ralston fce36ec826
Delete groups (legacy communities system) (#8027)
* Remove deprecated feature_communities_v2_prototypes

* Update _components

* i18n

* delint

* Cut out a bit more dead code

* Carve into legacy components

* Carve into mostly the room list code

* Carve into instances of "groupId"

* Carve out more of what comes up with "groups"

* Carve out some settings

* ignore related groups state

* Remove instances of spacesEnabled

* Fix some obvious issues

* Remove now-unused css

* Fix variable naming for legacy components

* Update i18n

* Misc cleanup from manual review

* Update snapshot for changed flag

* Appease linters

* rethemedex

* Remove now-unused AddressPickerDialog

* Make ConfirmUserActionDialog's member a required prop

* Remove useless override from RightPanelStore

* Remove extraneous CSS

* Update i18n

* Demo: "Communities are now Spaces" landing page

* Restore linkify for group IDs

* Demo: Dialog on click for communities->spaces notice

* i18n for demos

* i18n post-merge

* Update copy

* Appease the linter

* Post-merge cleanup

* Re-add spaces_learn_more_url to the new SdkConfig place

* Round 1 of post-merge fixes

* i18n

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
2022-03-22 23:07:37 +00:00
Kerry d98a73b003
Revert "replace all require(.svg) with esm import" (#7969)
* Revert "replace all require(svgs) with esm import (#7948)"

This reverts commit 61cd463a3b.

* add .default to svg icon inline requires

Signed-off-by: Kerry Archibald <kerrya@element.io>

* add shameful eslint ignore

Signed-off-by: Kerry Archibald <kerrya@element.io>

* format eslintrc

Signed-off-by: Kerry Archibald <kerrya@element.io>

* add missed MFileBody change

Signed-off-by: Kerry Archibald <kerrya@element.io>

* one more broken svg

Signed-off-by: Kerry Archibald <kerrya@element.io>

* and ignore it

Signed-off-by: Kerry Archibald <kerrya@element.io>
2022-03-03 17:51:38 +00:00
Michael Telatynski f25e6813bb
Mandate use of js-sdk/src/matrix import over js-sdk/src (#7933) 2022-03-01 20:42:05 +00:00
Kerry 26e1570dd6
a11y - fix iframes without title (#7614)
* iframe title in AppTile

Signed-off-by: Kerry Archibald <kerrya@element.io>

* iframe title in hostSignupDialog

Signed-off-by: Kerry Archibald <kerrya@element.io>

* iframe title in MFileBody

* iframe titles in modal widget and int man

Signed-off-by: Kerry Archibald <kerrya@element.io>

* enable jsx-a11y/iframe-has-title rule

Signed-off-by: Kerry Archibald <kerrya@element.io>
2022-01-24 14:07:54 +00:00
Kerry fed53a268b
A11y - fix anchors-as-buttons (#7444)
* add link_inline accessiblebutton variant

* valid anchors in SecurityRoomSettingsTab

Signed-off-by: Kerry Archibald <kerrya@element.io>

* new room intro link button

Signed-off-by: Kerry Archibald <kerrya@element.io>

* replace anchor with button in rerequest encryption keys message

Signed-off-by: Kerry Archibald <kerrya@element.io>

* inline button in UrlPreviewSettings

Signed-off-by: Kerry Archibald <kerrya@element.io>

* ButtonResetDefault mixin

Signed-off-by: Kerry Archibald <kerrya@element.io>

* inline link buttons in TextForEvent

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix anchors in InviteDialog

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix anchors in DevToolsDialog

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix anchors in login/registration/reset pword flows

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix types after fixing anchors in devtools

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix anchors in MemberEventListSummary

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix anchors in ReactionsRow and RoomUpgrade

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix anchors in ReplyChain

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix more anchors

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix anchors in auth comps

* stylelint fixes

Signed-off-by: Kerry Archibald <kerrya@element.io>

* remove ignore of jsx-a11y rule that is not added yet

Signed-off-by: Kerry Archibald <kerrya@element.io>

* devtools style important explainer

Signed-off-by: Kerry Archibald <kerrya@element.io>

* translate button alt in devtools dialog

Signed-off-by: Kerry Archibald <kerrya@element.io>

* AccessibleButton is reactionsrow

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix viewsourcevent button placement, use AccessibleButton

Signed-off-by: Kerry Archibald <kerrya@element.io>

* use AccessibleButton in EventTile

Signed-off-by: Kerry Archibald <kerrya@element.io>

* unignore jsx-a11y/anchor-is-valid

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix lint issue in test jsx

Signed-off-by: Kerry Archibald <kerrya@element.io>

* update coment

Signed-off-by: Kerry Archibald <kerrya@element.io>
2022-01-07 10:40:53 +01:00
Kerry aaf14aacd2
A11y fix role-has-required-aria-props (#7455)
* remove jsx a11y direct use in eslintrc

Signed-off-by: Kerry Archibald <kerrya@element.io>

* remove debug

Signed-off-by: Kerry Archibald <kerrya@element.io>

* split aria-selected out from restProps in Autocomplete

Signed-off-by: Kerry Archibald <kerrya@element.io>

* update Dropdown to aria 1.1 aria-owns -> aria-controls

Signed-off-by: Kerry Archibald <kerrya@element.io>

* unignore jsx-a11y/role-has-required-aria-props rule

Signed-off-by: Kerry Archibald <kerrya@element.io>

* remove debug

Signed-off-by: Kerry Archibald <kerrya@element.io>
2022-01-04 08:46:21 +00:00
Kerry 846fbfa2a0
Add jsx-a11y eslint plugin (#7434)
* add matrix-org a11y eslint plgin

Signed-off-by: Kerry Archibald <kerrya@element.io>

* add eslint a11y, enable and fix anchor-has-content rule

Signed-off-by: Kerry Archibald <kerrya@element.io>

* enable and fix jsx-a11y/no-redundant-roles

Signed-off-by: Kerry Archibald <kerrya@element.io>

* remove debug

Signed-off-by: Kerry Archibald <kerrya@element.io>

* i18n

Signed-off-by: Kerry Archibald <kerrya@element.io>

* use jsx-a11y via matrix-org-eslint

Signed-off-by: Kerry Archibald <kerrya@element.io>
2022-01-03 18:51:58 +01:00
Aaron Raimist 77dbb84673
Remove import rules from .eslintrc.js
Signed-off-by: Aaron Raimist <aaron@raim.ist>
2021-10-27 21:46:26 -05:00
Aaron Raimist 027b3660bb
Manual fixes
Signed-off-by: Aaron Raimist <aaron@raim.ist>
2021-10-22 17:49:12 -05:00
Aaron Raimist 860c0596e1
Add rule to group imports by external and internal
Signed-off-by: Aaron Raimist <aaron@raim.ist>
2021-10-22 17:21:46 -05:00
Germain Souquet 237212b082 Add ESLint shared settings to detect React version 2021-08-25 09:36:35 +01:00
J. Ryan Stinnett 2baace7658 Apply restricted property rules to all files 2021-06-30 14:27:10 +01:00
J. Ryan Stinnett a9f35e8c69 Lint MXC APIs to centralise access
This adds linting rules to ensure that MXC APIs are only accessed via the
`Media` helper so they can be customised easily when desired.

Fixes https://github.com/vector-im/element-web/issues/16933
2021-06-30 14:19:39 +01:00
J. Ryan Stinnett 07f057f381 Keep indent rule enabled 2021-06-29 15:30:38 +01:00
J. Ryan Stinnett fe123fc605 Rework lint comments 2021-06-29 13:35:43 +01:00
J. Ryan Stinnett 2be40ad08a Use unquoted keys 2021-06-29 13:19:42 +01:00
J. Ryan Stinnett a4f8ca4f8a Switch to newer Babel specific config 2021-06-29 13:18:58 +01:00
J. Ryan Stinnett 71116bfa27 Migrate to `eslint-plugin-matrix-org`
This migrates to the new plugin form of our custom ESLint configs. As part of
this, some packages are de-duplicated, configs streamlined, etc.
2021-06-29 12:51:13 +01:00
David Baker 31604c13c0 Lint the typescript tests
Turns out we hadn't told eslint to lint .ts in tests/

Also fix all the lint errors, including removing a use of assert that
had randomly crept in.
2021-06-04 16:52:50 +01:00
Germain Souquet f156c2db15 prevent reflow in app when accessing window dimensions 2021-05-25 10:28:43 +01:00
Šimon Brandner 46bfbbadf9
Enable indent rule and fix indent
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-04-27 17:23:27 +02:00
J. Ryan Stinnett d78bc98521 Resolve linting errors after upgrades 2021-01-27 12:42:39 +00:00
Michael Telatynski 9ba33c7f80 Fix eslint ts override tsx matching and delint 2020-08-29 01:11:08 +01:00
J. Ryan Stinnett 50bc7fc62f Remove redundant lint dependencies
These are no longer needed with the new standard lint repo.
2020-07-29 12:00:42 +01:00
Jorik Schellekens be5db851ca Revert unsafe rename and use boolean coercion 2020-07-21 10:29:05 +01:00
Jorik Schellekens 7699aafcaf Use new eslint package- fix lint issues in ts and js 2020-06-23 17:01:19 +01:00
Travis Ralston 457e63f24e Fix reference to js-sdk lint config 2020-01-15 10:25:36 -07:00
Travis Ralston 20a615396b Implementation of new potential skinning mechanism
With a switch to Only One Webpack™ we need a way to help developers generate the component index without a concurrent watch task. The best way to do this is to have developers import their components, but how do they do that when we support skins? The answer in this commit is to change skinning.

Skinning now expects to receive your list of overrides instead of the react-sdk+branded components. For Riot this means we send over *only* the Vector components and not Vector+react-sdk. 

Components can then be annotated with the `replaceComponent` decorator to have them be skinnable. The decorator must take a string with the dot path of the component because we can't reliably calculate it ourselves, sadly. 

The decorator does a call to `getComponent` which is where the important part of the branded components not including the react-sdk is important: if the branded app includes the react-sdk then the decorator gets executed before the skin has finished loading, leading to all kinds of fun errors. This is also why the skinner lazily loads the react-sdk components to avoid importing them too early, breaking the app.

The decorator will end up receiving null for a component because of the getComponent loop mentioned: the require() call is still in progress when the decorator is called, therefore we can't error out. All usages of getComponent() within the app are safe to not need such an error (the return won't be null, and developers shouldn't use getComponent() after this commit anyways).

The AuthPage, being a prominent component, has been converted to demonstrate this working. Changes to riot-web are required to have this work.

The reskindex script has also been altered to reflect these skinning changes - it no longer should set the react-sdk as a parent. The eventual end goal is to get rid of `getComponent()` entirely as it'll be easily replaced by imports.
2019-12-12 19:48:45 -07:00
Michael Telatynski df02eb8e92 Add UserInfo panel (consolidation of MemberInfo & GroupMemberInfo) Labs
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2019-10-07 16:52:50 +01:00
Bruno Windels f51d25c394 declare LANGUAGES_FILE as global in eslint config 2019-02-18 16:36:11 +01:00
Bruno Windels 87ddb8a453
Merge pull request #2575 from matrix-org/bwindels/customtags
Bring back custom tags, also badges on communities
2019-02-07 11:37:17 +00:00
Bruno Windels b9b83605b6 leave my regex along, lint 2019-02-05 19:31:14 +00:00
David Baker 32dbbbe7b1 Remove the arrow-paren lint rule
It's now in the base lint rules file: https://github.com/matrix-org/matrix-js-sdk/pull/834
2019-02-05 13:13:20 +00:00
Travis Ralston a488304410 Appease the linter
Appease the linter round 2

Appease the linter round 3

Appease the linter round 4

Appease the linter round 5
2019-01-21 18:41:49 -07:00
J. Ryan Stinnett b036e59021 Enable ESLint rule to require defined components in JSX
Signed-off-by: J. Ryan Stinnett <jryans@gmail.com>
2018-12-18 17:01:37 +00:00
Matthew Hodgson 4439a04689 fix lint 2018-05-20 23:43:42 +01:00
Matthew Hodgson ebfcea8b78
Merge pull request #1872 from matrix-org/matthew/lint-changes
relax lint for jsx-curly-spacing and arrow-parens
2018-05-02 23:33:04 +01:00