lint: Disallow utils index imports

This keeps leading to issues due to circular imports.
Import from specific files instead, index just reexports
This commit is contained in:
Vendicated 2022-11-07 23:34:14 +01:00
parent 955573d31b
commit f7d9be9140
No known key found for this signature in database
GPG key ID: EC781ADFB93EFFA3
22 changed files with 217 additions and 30 deletions

View file

@ -18,20 +18,19 @@
export * as Api from "./api";
export * as Plugins from "./plugins";
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
export * as Util from "./utils";
export * as QuickCss from "./utils/quickCss";
export * as Updater from "./utils/updater";
export * as Webpack from "./webpack";
export { PlainSettings, Settings };
import "./utils/quickCss";
import "./webpack/patchWebpack";
import { popNotice, showNotice } from "./api/Notices";
import { PlainSettings, Settings } from "./api/settings";
import { patches, PMLogger, startAllPlugins } from "./plugins";
export { PlainSettings, Settings };
import "./webpack/patchWebpack";
import "./utils/quickCss";
import { checkForUpdates, UpdateLogger } from "./utils/updater";
import { onceReady } from "./webpack";
import { Router } from "./webpack/common";

View file

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { LazyComponent } from "../utils";
import Logger from "../utils/logger";
import { LazyComponent } from "../utils/misc";
import { Margins, React } from "../webpack/common";
import { ErrorCard } from "./ErrorCard";

View file

@ -18,8 +18,8 @@
import monacoHtml from "~fileContent/monacoWin.html";
import { IpcEvents } from "../utils";
import { debounce } from "../utils/debounce";
import IpcEvents from "../utils/IpcEvents";
import { Queue } from "../utils/Queue";
import { find } from "../webpack/webpack";

View file

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { makeCodeblock } from "../utils";
import { debounce } from "../utils/debounce";
import { makeCodeblock } from "../utils/misc";
import { Button, Clipboard, Forms, Margins, Parser, React, Switch, TextInput } from "../webpack/common";
import { search } from "../webpack/webpack";
import { CheckedTextInput } from "./CheckedTextInput";

View file

@ -21,8 +21,9 @@ import { Constructor } from "type-fest";
import { generateId } from "../../api/Commands";
import { useSettings } from "../../api/settings";
import { LazyComponent, lazyWebpack, proxyLazy } from "../../utils";
import { LazyComponent, lazyWebpack } from "../../utils/misc";
import { ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize } from "../../utils/modal";
import { proxyLazy } from "../../utils/proxyLazy";
import { OptionType, Plugin } from "../../utils/types";
import { filters, findByCode } from "../../webpack";
import { Button, FluxDispatcher, Forms, React, Text, Tooltip, UserStore, UserUtils } from "../../webpack/common";

View file

@ -21,9 +21,10 @@ import Plugins from "~plugins";
import { showNotice } from "../../api/Notices";
import { Settings, useSettings } from "../../api/settings";
import { startDependenciesRecursive, startPlugin, stopPlugin } from "../../plugins";
import { Logger, Modals } from "../../utils";
import { ChangeList } from "../../utils/ChangeList";
import Logger from "../../utils/logger";
import { classes, LazyComponent, lazyWebpack } from "../../utils/misc";
import { openModalLazy } from "../../utils/modal";
import { Plugin } from "../../utils/types";
import { filters, findByCode } from "../../webpack";
import { Alerts, Button, Forms, Margins, Parser, React, Select, Switch, Text, TextInput, Toasts, Tooltip } from "../../webpack/common";
@ -88,7 +89,7 @@ function PluginCard({ plugin, disabled, onRestartNeeded, onMouseEnter, onMouseLe
}
function openModal() {
Modals.openModalLazy(async () => {
openModalLazy(async () => {
return modalProps => {
return <PluginModal {...modalProps} plugin={plugin} onRestartNeeded={() => onRestartNeeded(plugin.name)} />;
};

View file

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { lazyWebpack } from "../utils";
import { Devs } from "../utils/constants";
import { lazyWebpack } from "../utils/misc";
import definePlugin, { OptionType } from "../utils/types";
import { Settings } from "../Vencord";
import { filters } from "../webpack";

View file

@ -17,8 +17,8 @@
*/
import { DataStore } from "../api";
import { lazyWebpack } from "../utils";
import { Devs } from "../utils/constants";
import { lazyWebpack } from "../utils/misc";
import definePlugin from "../utils/types";
import { filters } from "../webpack";

View file

@ -17,8 +17,8 @@
*/
import { addClickListener, removeClickListener } from "../api/MessageEvents";
import { lazyWebpack } from "../utils";
import { Devs } from "../utils/constants";
import { lazyWebpack } from "../utils/misc";
import definePlugin from "../utils/types";
import { filters } from "../webpack";
import { UserStore } from "../webpack/common";

View file

@ -17,9 +17,9 @@
*/
import { addPreEditListener, addPreSendListener, removePreEditListener, removePreSendListener } from "../api/MessageEvents";
import { lazyWebpack } from "../utils";
import { Devs } from "../utils/constants";
import { ApngDisposeOp, getGifEncoder, importApngJs } from "../utils/dependencies";
import { lazyWebpack } from "../utils/misc";
import definePlugin, { OptionType } from "../utils/types";
import { Settings } from "../Vencord";
import { filters } from "../webpack";

View file

@ -17,9 +17,9 @@
*/
import { ApplicationCommandInputType, ApplicationCommandOptionType, Argument, CommandContext, findOption } from "../api/Commands";
import { lazyWebpack, makeLazy } from "../utils";
import { Devs } from "../utils/constants";
import { getGifEncoder } from "../utils/dependencies";
import { lazyWebpack, makeLazy } from "../utils/misc";
import definePlugin from "../utils/types";
import { filters } from "../webpack";

View file

@ -22,8 +22,8 @@ import { classes, lazyWebpack, useAwaiter } from "../../../utils/misc";
import { Settings } from "../../../Vencord";
import { filters } from "../../../webpack";
import { UserStore } from "../../../webpack/common";
import { fetchPronouns, formatPronouns } from "../pronoundbUtils";
import { PronounMapping } from "../types";
import { fetchPronouns, formatPronouns } from "../utils";
const styles: Record<string, string> = lazyWebpack(filters.byProps("timestampInline"));

View file

@ -16,11 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { useAwaiter } from "../../../utils";
import { useAwaiter } from "../../../utils/misc";
import { Settings } from "../../../Vencord";
import { UserStore } from "../../../webpack/common";
import { fetchPronouns, formatPronouns } from "../pronoundbUtils";
import { PronounMapping, UserProfileProps } from "../types";
import { fetchPronouns, formatPronouns } from "../utils";
export default function PronounsProfileWrapper(props: UserProfileProps, pronounsComponent: JSX.Element) {
// Don't bother fetching bot or system users

View file

@ -17,8 +17,8 @@
*/
import { ApplicationCommandInputType, sendBotMessage } from "../api/Commands";
import { lazyWebpack } from "../utils";
import { Devs } from "../utils/constants";
import { lazyWebpack } from "../utils/misc";
import definePlugin from "../utils/types";
import { filters } from "../webpack";
import { FluxDispatcher } from "../webpack/common";

View file

@ -18,7 +18,8 @@
import ErrorBoundary from "../../components/ErrorBoundary";
import { Flex } from "../../components/Flex";
import { classes, debounce, LazyComponent, lazyWebpack } from "../../utils";
import { debounce } from "../../utils/debounce";
import { classes, LazyComponent, lazyWebpack } from "../../utils/misc";
import { ContextMenu, FluxDispatcher, Forms, Menu, React, Tooltip } from "../../webpack/common";
import { filters, find } from "../../webpack/webpack";
import { SpotifyStore, Track } from "./SpotifyStore";

View file

@ -18,7 +18,9 @@
import cssText from "~fileContent/styles.css";
import { IpcEvents, lazyWebpack, proxyLazy } from "../../utils";
import IpcEvents from "../../utils/IpcEvents";
import { lazyWebpack } from "../../utils/misc";
import { proxyLazy } from "../../utils/proxyLazy";
import { filters } from "../../webpack";
import { Flux, FluxDispatcher } from "../../webpack/common";

View file

@ -18,9 +18,9 @@
import ErrorBoundary from "../../components/ErrorBoundary";
import { Flex } from "../../components/Flex";
import { lazyWebpack } from "../../utils";
import { filters } from "../../webpack";
import { lazyWebpack } from "../../utils/misc";
import { Forms, React } from "../../webpack/common";
import { filters } from "../../webpack/webpack";
interface AppStartPerformance {
prefix: string;

View file

@ -17,8 +17,8 @@
*/
import { LazyComponent } from "../../utils";
import { Devs } from "../../utils/constants";
import { LazyComponent } from "../../utils/misc";
import definePlugin from "../../utils/types";
export default definePlugin({