From c1f03625a9ddffbb566c5101f9b3df7e88617928 Mon Sep 17 00:00:00 2001 From: Sander Bruens Date: Mon, 22 Apr 2024 17:47:16 -0400 Subject: [PATCH] Add a distinct group for `@material/...` imports. --- .eslintrc.json | 8 ++++++++ client/src/www/app/cordova_main.ts | 5 +---- client/src/www/views/contact_view/index.spec.ts | 1 + client/src/www/views/contact_view/index.ts | 8 ++++---- .../views/contact_view/support_form/index.spec.ts | 1 + .../src/www/views/contact_view/support_form/index.ts | 12 ++++++------ .../www/views/contact_view/support_form/stories.ts | 1 - client/src/www/views/servers_view/index.ts | 7 +++---- .../www/views/servers_view/server_list/stories.ts | 2 -- .../www/views/servers_view/server_list_item/index.ts | 1 + .../server_list_item/server_card/index.ts | 4 +--- package.json | 2 +- 12 files changed, 27 insertions(+), 25 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 7af40615b6b..9bf16f894eb 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -68,6 +68,14 @@ "external", "internal" ], + "pathGroups": [ + { + "pattern": "@material/**", + "group": "external", + "position": "before" + } + ], + "pathGroupsExcludedImportTypes": ["@material/**"], "newlines-between": "always", "alphabetize": { "order": "asc", diff --git a/client/src/www/app/cordova_main.ts b/client/src/www/app/cordova_main.ts index e7fbdb73449..730e186252d 100644 --- a/client/src/www/app/cordova_main.ts +++ b/client/src/www/app/cordova_main.ts @@ -18,10 +18,8 @@ import '@babel/polyfill'; import 'web-animations-js/web-animations-next-lite.min.js'; import '@webcomponents/webcomponentsjs/webcomponents-bundle.js'; - import {setRootPath} from '@polymer/polymer/lib/utils/settings.js'; setRootPath(location.pathname.substring(0, location.pathname.lastIndexOf('/') + 1)); - import * as Sentry from '@sentry/browser'; import {AbstractClipboard} from './clipboard'; @@ -29,8 +27,7 @@ import {EnvironmentVariables} from './environment'; import {FakeOutlineTunnel} from './fake_tunnel'; import {main} from './main'; import {OutlinePlatform} from './platform'; -import {Tunnel, TunnelStatus} from './tunnel'; -import {ShadowsocksSessionConfig} from './tunnel'; +import {Tunnel, TunnelStatus,ShadowsocksSessionConfig} from './tunnel'; import {AbstractUpdater} from './updater'; import * as interceptors from './url_interceptor'; import {NoOpVpnInstaller, VpnInstaller} from './vpn_installer'; diff --git a/client/src/www/views/contact_view/index.spec.ts b/client/src/www/views/contact_view/index.spec.ts index 6ad15bccd30..387f72b55ae 100644 --- a/client/src/www/views/contact_view/index.spec.ts +++ b/client/src/www/views/contact_view/index.spec.ts @@ -16,6 +16,7 @@ import {ListItemBase} from '@material/mwc-list/mwc-list-item-base'; import {Select} from '@material/mwc-select'; + import {fixture, html, nextFrame, oneEvent} from '@open-wc/testing'; import {ContactView} from './index'; diff --git a/client/src/www/views/contact_view/index.ts b/client/src/www/views/contact_view/index.ts index 17f14202115..d4a39571489 100644 --- a/client/src/www/views/contact_view/index.ts +++ b/client/src/www/views/contact_view/index.ts @@ -14,18 +14,18 @@ * limitations under the License. */ + +import {SingleSelectedEvent} from '@material/mwc-list/mwc-list'; +import {Radio} from '@material/mwc-radio'; + import {html, css, LitElement, TemplateResult, nothing} from 'lit'; import {customElement, property, state} from 'lit/decorators.js'; import {Ref, createRef, ref} from 'lit/directives/ref.js'; import {unsafeHTML} from 'lit/directives/unsafe-html.js'; import '@material/mwc-circular-progress'; -import '@material/mwc-radio'; import '@material/mwc-select'; import '@material/mwc-formfield'; -import {Radio} from '@material/mwc-radio'; -import {SingleSelectedEvent} from '@material/mwc-list/mwc-list'; -import './support_form'; import {AppType} from './app_type'; import {IssueType, UNSUPPORTED_ISSUE_TYPE_HELPPAGES} from './issue_type'; import {FormValues, SupportForm, ValidFormValues} from './support_form'; diff --git a/client/src/www/views/contact_view/support_form/index.spec.ts b/client/src/www/views/contact_view/support_form/index.spec.ts index 146b344394c..5e7dc615a9e 100644 --- a/client/src/www/views/contact_view/support_form/index.spec.ts +++ b/client/src/www/views/contact_view/support_form/index.spec.ts @@ -15,6 +15,7 @@ */ import {TextField} from '@material/mwc-textfield'; + import {fixture, html, nextFrame, oneEvent, triggerBlurFor, triggerFocusFor} from '@open-wc/testing'; import {FormValues, SupportForm} from './index'; diff --git a/client/src/www/views/contact_view/support_form/index.ts b/client/src/www/views/contact_view/support_form/index.ts index e2cd52e7cc6..240439ccfba 100644 --- a/client/src/www/views/contact_view/support_form/index.ts +++ b/client/src/www/views/contact_view/support_form/index.ts @@ -14,20 +14,20 @@ * limitations under the License. */ +import {SelectedDetail} from '@material/mwc-menu/mwc-menu-base'; +import {TextField} from '@material/mwc-textfield'; +import '@material/mwc-button'; +import '@material/mwc-select'; +import '@material/mwc-textarea'; + import {html, css, LitElement, TemplateResult, nothing, PropertyValues} from 'lit'; import {customElement, property, state} from 'lit/decorators.js'; import {live} from 'lit/directives/live.js'; import {createRef, Ref, ref} from 'lit/directives/ref.js'; -import '@material/mwc-button'; -import '@material/mwc-select'; -import '@material/mwc-textarea'; -import '@material/mwc-textfield'; import {Localizer} from '../../../../../infrastructure/i18n'; import {AppType} from '../app_type'; -import {TextField} from '@material/mwc-textfield'; -import {SelectedDetail} from '@material/mwc-menu/mwc-menu-base'; type FormControl = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement; diff --git a/client/src/www/views/contact_view/support_form/stories.ts b/client/src/www/views/contact_view/support_form/stories.ts index 1d2853c361d..55d2fadc31c 100644 --- a/client/src/www/views/contact_view/support_form/stories.ts +++ b/client/src/www/views/contact_view/support_form/stories.ts @@ -18,7 +18,6 @@ import {html} from 'lit'; -import './index'; import {FormValues} from './index'; import {localize} from '../../../testing/localize'; import {AppType} from '../app_type'; diff --git a/client/src/www/views/servers_view/index.ts b/client/src/www/views/servers_view/index.ts index dd70dc24900..ed17a092c70 100644 --- a/client/src/www/views/servers_view/index.ts +++ b/client/src/www/views/servers_view/index.ts @@ -14,16 +14,15 @@ limitations under the License. */ +import '@material/mwc-button'; + import {css, html, LitElement} from 'lit'; import {customElement, property} from 'lit/decorators.js'; import { DirectiveResult } from 'lit/directive'; import {unsafeHTML, UnsafeHTMLDirective} from 'lit/directives/unsafe-html.js'; -import '@material/mwc-button'; -import './server_connection_indicator'; -import './server_list'; - import {ServerConnectionState as _ServerConnectionState} from './server_connection_indicator'; +import './server_list'; import {ServerListItem as _ServerListItem} from './server_list_item'; import { Localizer } from '../../../../infrastructure/i18n'; diff --git a/client/src/www/views/servers_view/server_list/stories.ts b/client/src/www/views/servers_view/server_list/stories.ts index f13b9c32224..144d48405bb 100644 --- a/client/src/www/views/servers_view/server_list/stories.ts +++ b/client/src/www/views/servers_view/server_list/stories.ts @@ -15,8 +15,6 @@ limitations under the License. */ -import './index'; - import {html} from 'lit'; import {ServerList} from './index'; diff --git a/client/src/www/views/servers_view/server_list_item/index.ts b/client/src/www/views/servers_view/server_list_item/index.ts index 29b2361dc39..ba397799b1c 100644 --- a/client/src/www/views/servers_view/server_list_item/index.ts +++ b/client/src/www/views/servers_view/server_list_item/index.ts @@ -12,6 +12,7 @@ */ import {Menu} from '@material/mwc-menu'; + import {Ref} from 'lit/directives/ref'; import {Localizer} from '../../../../../infrastructure/i18n'; diff --git a/client/src/www/views/servers_view/server_list_item/server_card/index.ts b/client/src/www/views/servers_view/server_list_item/server_card/index.ts index 7cde5a79437..bab2620845b 100644 --- a/client/src/www/views/servers_view/server_list_item/server_card/index.ts +++ b/client/src/www/views/servers_view/server_list_item/server_card/index.ts @@ -13,10 +13,8 @@ import '@material/mwc-button'; import '@material/mwc-icon-button'; -import '@material/mwc-menu'; -import '../../server_connection_indicator'; - import {Menu} from '@material/mwc-menu'; + import {css, html, LitElement} from 'lit'; import {customElement, property} from 'lit/decorators.js'; import {createRef, Ref, ref} from 'lit/directives/ref.js'; diff --git a/package.json b/package.json index 8aae0e741ed..6b862b4937a 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "clean": "npm run clean --workspaces && rm -rf output node_modules third_party/jsign/*.jar && go run github.com/go-task/task/v3/cmd/task clean", "format:all": "prettier --write \"**/*.{cjs,mjs,html,js,json,md,ts}\"", "format": "pretty-quick --staged --pattern \"**/*.{cjs,mjs,html,js,json,md,ts}\"", - "lint:ts": "eslint --ext ts,mjs client/src", + "lint:ts": "eslint --ext ts,mjs client", "lint": "npm run lint:ts", "reset": "npm run clean && npm ci" },