Skip to content

Commit

Permalink
Merge pull request #2824 from pygeek/absolute-imports
Browse files Browse the repository at this point in the history
Refactor imports to use `@/` alias.
  • Loading branch information
anoek authored Sep 11, 2024
2 parents bc5f2c8 + 3a1dc4d commit fdd9d01
Show file tree
Hide file tree
Showing 303 changed files with 1,757 additions and 1,771 deletions.
42 changes: 21 additions & 21 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,27 @@ BACKEND = BACKEND.toUpperCase();
//BACKEND = 'PRODUCTION';
//BACKEND = 'LOCAL';

const spawn = require("child_process").spawn;
const fs = require("fs");
const gulp = require("gulp");
const path = require("path");
const execSync = require("child_process").execSync;
const livereload = require("gulp-livereload");
const stylus = require("gulp-stylus");
const sourcemaps = require("gulp-sourcemaps");
const rename = require("gulp-rename");
const pump = require("pump");
const autoprefixer = require("autoprefixer");
const postcss = require("gulp-postcss");
const cssnano = require("cssnano");
const inline_svg = require("postcss-inline-svg");
const gulpEslint = require("gulp-eslint-new");
const html_minifier = require("html-minifier").minify;
import { spawn, execSync } from "child_process";
import fs from "fs";
import gulp from "gulp";
import path from "path";
import livereload from "gulp-livereload";
import stylus from "gulp-stylus";
import sourcemaps from "gulp-sourcemaps";
import rename from "gulp-rename";
import pump from "pump";
import autoprefixer from "autoprefixer";
import postcss from "gulp-postcss";
import cssnano from "cssnano";
import inline_svg from "postcss-inline-svg";
import gulpEslint from "gulp-eslint-new";
import html_minifier from "html-minifier";

import express from "express";
import body_parser from "body-parser";
import http from "http";
import proxy from "express-http-proxy";
import url from "url";

let ts_sources = ["src/**/*.ts", "src/**/*.tsx", "!src/**/*.test.ts", "!src/**/*.test.tsx"];

Expand Down Expand Up @@ -187,11 +192,6 @@ function dev_server(done) {
process.exit(1);
}

let express = require("express");
let body_parser = require("body-parser");
let http = require("http");
var proxy = require("express-http-proxy");
let url = require("url");
let dev_server = express();
dev_server.use(body_parser.json());
dev_server.use(body_parser.text());
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"url": "https://github.com/online-go/online-go.com/issues",
"license": "AGPL-3.0",
"private": true,
"type": "module",
"engine": {
"npm": ">=8.5.0"
},
Expand Down
2 changes: 1 addition & 1 deletion prettier.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
trailingComma: "all",
tabWidth: 4,
printWidth: 100,
Expand Down
16 changes: 8 additions & 8 deletions src/components/ACLModal/ACLModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
*/

import * as React from "react";
import { _ } from "translate";
import { post, get, del } from "requests";
import { openModal, Modal } from "Modal";
import { Player } from "Player";
import { PlayerAutocomplete, PlayerAutocompleteRef } from "PlayerAutocomplete";
import { GroupAutocomplete } from "GroupAutocomplete";
import { errorAlerter } from "misc";
import { PlayerCacheEntry } from "src/lib/player_cache";
import { _ } from "@/lib/translate";
import { post, get, del } from "@/lib/requests";
import { openModal, Modal } from "@/components/Modal";
import { Player } from "@/components/Player";
import { PlayerAutocomplete, PlayerAutocompleteRef } from "@/components/PlayerAutocomplete";
import { GroupAutocomplete } from "@/components/GroupAutocomplete";
import { errorAlerter } from "@/lib/misc";
import { PlayerCacheEntry } from "@/lib/player_cache";

interface Events {}

Expand Down
4 changes: 2 additions & 2 deletions src/components/AIReviewStream/AIReviewStream.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/

import * as React from "react";
import { ai_socket } from "sockets";
import { ai_socket } from "@/lib/sockets";
import { MoveTree, GobanSocketEvents } from "goban";
import { IdType } from "src/lib/types";
import { IdType } from "@/lib/types";

const analysis_requests_made: { [id: string]: boolean } = {};

Expand Down
8 changes: 4 additions & 4 deletions src/components/AccountWarning/AccountWarning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
// So the word "warning" kind of means "message" now.

import * as React from "react";
import { _, pgettext } from "translate";
import { get, patch } from "requests";
import { useMainGoban, useUser } from "hooks";
import { AutoTranslate } from "AutoTranslate";
import { _, pgettext } from "@/lib/translate";
import { get, patch } from "@/lib/requests";
import { useMainGoban, useUser } from "@/lib/hooks";
import { AutoTranslate } from "@/components/AutoTranslate";
import { useLocation } from "react-router";
import { CANNED_MESSAGES } from "./CannedMessages";

Expand Down
2 changes: 1 addition & 1 deletion src/components/AccountWarning/CannedMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import { _, interpolate } from "translate";
import { _, interpolate } from "@/lib/translate";

// These are the "canned messages" that Community Moderators can vote for.

Expand Down
2 changes: 1 addition & 1 deletion src/components/Achievements/AchievementList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import * as React from "react";
//import * as preferences from "preferences";
//import * as preferences from "@/lib/preferences";

interface AchievementEntry {
name: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/

import * as React from "react";
import { _ } from "translate";
import { GameList } from "GameList";
import { PlayerCacheEntry } from "src/lib/player_cache";
import { _ } from "@/lib/translate";
import { GameList } from "@/components/GameList";
import { PlayerCacheEntry } from "@/lib/player_cache";

interface UserType {
id: number;
Expand Down
10 changes: 5 additions & 5 deletions src/components/Announcements/ActiveAnnouncements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

import * as React from "react";
import { Link } from "react-router-dom";
import { interpolate, _ } from "translate";
import { Card, PopupMenu, PopupMenuItem } from "material";
import { interpolate, _ } from "@/lib/translate";
import { Card, PopupMenu, PopupMenuItem } from "@/components/material";

import {
active_announcements,
Expand All @@ -28,10 +28,10 @@ import {
} from "./Announcements";
import { getBlocks, setAnnouncementBlock } from "../BlockPlayer";

import * as data from "data";
import * as preferences from "preferences";
import * as data from "@/lib/data";
import * as preferences from "@/lib/preferences";

import { alert } from "swal_config";
import { alert } from "@/lib/swal_config";

// Holds the expirations dates of cleared announcements
const hard_cleared_announcements: { [id: number]: number } = data.get(
Expand Down
16 changes: 8 additions & 8 deletions src/components/Announcements/Announcements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

import * as React from "react";
import { Link } from "react-router-dom";
import { get } from "requests";
import { UIPush } from "UIPush";
import { TypedEventEmitter } from "TypedEventEmitter";
import { errorLogger } from "misc";
import * as moment from "moment";
import ITC from "ITC";
import * as data from "data";
import { get } from "@/lib/requests";
import { UIPush } from "@/components/UIPush";
import { TypedEventEmitter } from "@/lib/TypedEventEmitter";
import { errorLogger } from "@/lib/misc";
import moment from "moment";
import ITC from "@/lib/ITC";
import * as data from "@/lib/data";
import { getBlocks } from "../BlockPlayer";
import * as preferences from "preferences";
import * as preferences from "@/lib/preferences";

interface Events {
announcement: any;
Expand Down
6 changes: 3 additions & 3 deletions src/components/Announcements/TournamentIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

import * as React from "react";
import { Link } from "react-router-dom";
import * as data from "data";
import * as moment from "moment";
import { usePreference } from "preferences";
import * as data from "@/lib/data";
import moment from "moment";
import { usePreference } from "@/lib/preferences";

export function TournamentIndicator(): JSX.Element | null {
const [tournament, setTournament] = React.useState<any>(null);
Expand Down
12 changes: 6 additions & 6 deletions src/components/AnnulQueueModal/AnnulQueueModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
*/

import * as React from "react";
import { _ } from "translate";
import { MiniGoban } from "MiniGoban";
import { _ } from "@/lib/translate";
import { MiniGoban } from "@/components/MiniGoban";
import { GobanRenderer } from "goban";
import { AIReview, GameTimings, ChatMode, GameChat, GobanContext } from "Game";
import { Player } from "Player";
import { Resizable } from "Resizable";
import { post, put } from "requests";
import { AIReview, GameTimings, ChatMode, GameChat, GobanContext } from "@/views/Game";
import { Player } from "@/components/Player";
import { Resizable } from "@/components/Resizable";
import { post, put } from "@/lib/requests";

// Define the AnnulQueueModalProps interface
interface AnnulQueueModalProps {
Expand Down
6 changes: 3 additions & 3 deletions src/components/AutoTranslate/AutoTranslate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/

import * as React from "react";
import { post } from "requests";
import { current_language, pgettext } from "translate";
import { Markdown } from "Markdown";
import { post } from "@/lib/requests";
import { current_language, pgettext } from "@/lib/translate";
import { Markdown } from "@/components/Markdown";

interface AutoTranslateProps {
source: string | null | undefined;
Expand Down
10 changes: 5 additions & 5 deletions src/components/AutomatchSettings/AutomatchSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
*/

import * as React from "react";
import { _ } from "translate";
import { Modal, openModal } from "Modal";
import { dup } from "misc";
import * as data from "data";
import { AutomatchPreferencesBase, AutomatchTimeControlSystem, Size, Speed } from "src/lib/types";
import { _ } from "@/lib/translate";
import { Modal, openModal } from "@/components/Modal";
import { dup } from "@/lib/misc";
import * as data from "@/lib/data";
import { AutomatchPreferencesBase, AutomatchTimeControlSystem, Size, Speed } from "@/lib/types";
import { AutomatchCondition, RuleSet } from "goban";

interface Events {}
Expand Down
10 changes: 5 additions & 5 deletions src/components/BanModal/BanModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

import * as React from "react";
import Datetime from "react-datetime";
import { put } from "requests";
import { _ } from "translate";
import { errorAlerter } from "misc";
import { Modal } from "Modal";
import * as player_cache from "player_cache";
import { put } from "@/lib/requests";
import { _ } from "@/lib/translate";
import { errorAlerter } from "@/lib/misc";
import { Modal } from "@/components/Modal";
import * as player_cache from "@/lib/player_cache";

interface Events {}

Expand Down
12 changes: 6 additions & 6 deletions src/components/BlockPlayer/BlockPlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import { put } from "requests";
import * as data from "data";
import { errorAlerter, errorLogger } from "misc";
import ITC from "ITC";
import cached from "cached";
import * as player_cache from "player_cache";
import { put } from "@/lib/requests";
import * as data from "@/lib/data";
import { errorAlerter, errorLogger } from "@/lib/misc";
import ITC from "@/lib/ITC";
import cached from "@/lib/cached";
import * as player_cache from "@/lib/player_cache";

export class BlockState {
blocked: number; // player id
Expand Down
4 changes: 2 additions & 2 deletions src/components/BlockPlayer/BlockPlayerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*/

import * as React from "react";
import { _ } from "translate";
import { PopOver, popover } from "popover";
import { _ } from "@/lib/translate";
import { PopOver, popover } from "@/lib/popover";
import {
BlockState,
getBlocks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
*/

import * as React from "react";
import { pgettext, _ } from "translate";
import { pgettext, _ } from "@/lib/translate";

import { timeControlDescription, usedForCheating } from "TimeControl";
import { rulesText, yesno } from "misc";
import { timeControlDescription, usedForCheating } from "@/components/TimeControl";
import { rulesText, yesno } from "@/lib/misc";

type Challenge = socket_api.seekgraph_global.Challenge;

Expand Down
4 changes: 2 additions & 2 deletions src/components/ChallengeLinkButton/ChallengeLinkButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

import * as React from "react";

import { pgettext } from "translate";
import { pgettext } from "@/lib/translate";

import { popover } from "popover";
import { popover } from "@/lib/popover";

type ChallengeLinkButtonProps = {
uuid: string;
Expand Down
Loading

0 comments on commit fdd9d01

Please sign in to comment.