mirror of
https://github.com/nathonius/obsidian-github-link.git
synced 2026-07-22 09:20:25 +00:00
🔨 refactor: #102 Make imports more consistent
This commit is contained in:
parent
f670708c68
commit
a1724f2ca2
16 changed files with 1352 additions and 52 deletions
|
|
@ -5,6 +5,7 @@ import tseslint from "typescript-eslint";
|
|||
import UnusedImportsPlugin from "eslint-plugin-unused-imports";
|
||||
import PrettierConfig from "eslint-config-prettier";
|
||||
import JestPlugin from "eslint-plugin-jest";
|
||||
import * as ImportPlugin from "eslint-plugin-import";
|
||||
|
||||
export default tseslint.config(
|
||||
{
|
||||
|
|
@ -23,6 +24,7 @@ export default tseslint.config(
|
|||
plugins: {
|
||||
"unused-imports": UnusedImportsPlugin,
|
||||
jest: JestPlugin,
|
||||
import: ImportPlugin,
|
||||
},
|
||||
rules: {
|
||||
"@typescript-eslint/restrict-template-expressions": "warn",
|
||||
|
|
@ -47,6 +49,8 @@ export default tseslint.config(
|
|||
argsIgnorePattern: "^_",
|
||||
},
|
||||
],
|
||||
"import/order": "error",
|
||||
"import/no-duplicates": "error",
|
||||
},
|
||||
},
|
||||
PrettierConfig,
|
||||
|
|
|
|||
2
main.ts
2
main.ts
|
|
@ -1,2 +1,2 @@
|
|||
import { GithubLinkPlugin } from "src/plugin";
|
||||
import { GithubLinkPlugin } from "./src/plugin";
|
||||
export default GithubLinkPlugin;
|
||||
|
|
|
|||
1297
package-lock.json
generated
1297
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -26,6 +26,7 @@
|
|||
"esbuild": "0.20.0",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-jest": "^28.2.0",
|
||||
"eslint-plugin-unused-imports": "^3.1.0",
|
||||
"jest": "^29.7.0",
|
||||
|
|
@ -47,4 +48,4 @@
|
|||
"lodash": "^4.17.21",
|
||||
"queue": "^7.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
import type { RequestUrlParam, RequestUrlResponse } from "obsidian";
|
||||
|
||||
import { Notice, requestUrl } from "obsidian";
|
||||
import Queue from "queue";
|
||||
import { PluginSettings, getCache, logger } from "../plugin";
|
||||
import { RequestError, isSuccessResponse, promiseWithResolvers } from "../util";
|
||||
import type {
|
||||
CheckRunListResponse,
|
||||
CodeResponse,
|
||||
|
|
@ -13,12 +19,6 @@ import type {
|
|||
PullListResponse,
|
||||
PullResponse,
|
||||
} from "./response";
|
||||
import type { RequestUrlParam, RequestUrlResponse } from "obsidian";
|
||||
|
||||
import { RequestError, isSuccessResponse, promiseWithResolvers } from "src/util";
|
||||
import { Notice, requestUrl } from "obsidian";
|
||||
import { PluginSettings, getCache, logger } from "src/plugin";
|
||||
import Queue from "queue";
|
||||
import type { CacheEntry } from "./cache";
|
||||
|
||||
type RequestConfig = RequestUrlParam & { headers: Record<string, string> };
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import type { RequestUrlParam, RequestUrlResponse } from "obsidian";
|
||||
import { logger } from "../plugin";
|
||||
import { isSuccessResponse, sanitizeObject } from "../util";
|
||||
import type {
|
||||
IssueListParams,
|
||||
IssueListResponse,
|
||||
|
|
@ -9,8 +11,6 @@ import type {
|
|||
PullResponse,
|
||||
RepoSearchResponse,
|
||||
} from "./response";
|
||||
import { logger } from "src/plugin";
|
||||
import { isSuccessResponse, sanitizeObject } from "src/util";
|
||||
|
||||
interface CacheParams {
|
||||
request: RequestUrlParam;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
import { RequestError, mapObject } from "../util";
|
||||
|
||||
import type { GithubAccount } from "../settings";
|
||||
import { PluginSettings } from "../plugin";
|
||||
import { issueListSortFromQuery, pullListSortFromQuery, searchSortFromQuery, type QueryParams } from "../query/query";
|
||||
import { OldCache } from "./cache";
|
||||
import { GitHubApi } from "./api";
|
||||
import type {
|
||||
CheckRunListResponse,
|
||||
IssueListParams,
|
||||
|
|
@ -12,13 +19,6 @@ import type {
|
|||
PullResponse,
|
||||
TimelineCrossReferencedEvent,
|
||||
} from "./response";
|
||||
import { RequestError, mapObject } from "src/util";
|
||||
import { GitHubApi } from "./api";
|
||||
|
||||
import { OldCache } from "./cache";
|
||||
import type { GithubAccount } from "src/settings";
|
||||
import { PluginSettings } from "src/plugin";
|
||||
import { issueListSortFromQuery, pullListSortFromQuery, searchSortFromQuery, type QueryParams } from "src/query/query";
|
||||
|
||||
const cache = new OldCache();
|
||||
const tokenMatchRegex = /repo:(.+)\//;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import { IssueStatus, getIssueStatus, getPRStatus } from "src/github/response";
|
||||
import { getIssue, getPullRequest } from "../github/github";
|
||||
import { setIssueIcon, setPRIcon, setPRMergeableIcon } from "src/icon";
|
||||
|
||||
import type { ParsedUrl } from "../github/url-parse";
|
||||
import { PluginSettings } from "src/plugin";
|
||||
import type { PullResponse } from "src/github/response";
|
||||
import { RequestError } from "src/util";
|
||||
import { parseUrl } from "../github/url-parse";
|
||||
import { setIcon } from "obsidian";
|
||||
import { IssueStatus, getIssueStatus, getPRStatus } from "../github/response";
|
||||
import { setIssueIcon, setPRIcon, setPRMergeableIcon } from "../icon";
|
||||
|
||||
import { PluginSettings } from "../plugin";
|
||||
import type { PullResponse } from "../github/response";
|
||||
import { RequestError } from "../util";
|
||||
import { parseUrl } from "../github/url-parse";
|
||||
import type { ParsedUrl } from "../github/url-parse";
|
||||
import { getIssue, getPullRequest } from "../github/github";
|
||||
|
||||
interface TagConfig {
|
||||
icon: HTMLSpanElement;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { expect, jest, test } from "@jest/globals";
|
||||
import { GithubLinkPlugin, PluginData, PluginSettings, getCache } from "./plugin";
|
||||
import { beforeEach, describe } from "node:test";
|
||||
import { expect, jest, test } from "@jest/globals";
|
||||
import type { Plugin, RequestUrlResponse } from "obsidian";
|
||||
import { App } from "obsidian";
|
||||
import type { PluginMock } from "../__mocks__/obsidian/Plugin";
|
||||
import * as manifest from "../manifest.json";
|
||||
import type { PluginMock } from "__mocks__/obsidian/Plugin";
|
||||
import { GithubLinkPlugin, PluginData, PluginSettings, getCache } from "./plugin";
|
||||
import type { GithubLinkPluginSettings } from "./settings";
|
||||
import { DEFAULT_SETTINGS } from "./settings";
|
||||
import { CacheEntry, RequestCache } from "./github/cache";
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { Plugin } from "obsidian";
|
||||
import { DEFAULT_SETTINGS, GithubLinkPluginSettingsTab } from "./settings";
|
||||
import { Logger } from "./logger";
|
||||
|
||||
import type { GithubLinkPluginData, GithubLinkPluginSettings } from "./settings";
|
||||
import { InlineRenderer } from "./inline/inline";
|
||||
import { Plugin } from "obsidian";
|
||||
import { createInlineViewPlugin } from "./inline/view-plugin";
|
||||
import { RequestCache } from "./github/cache";
|
||||
import { QueryProcessor } from "./query/processor";
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { parseUrl, repoAPIToBrowserUrl } from "src/github/url-parse";
|
||||
import { parseUrl, repoAPIToBrowserUrl } from "../../github/url-parse";
|
||||
|
||||
import { DateFormat } from "src/util";
|
||||
import { DateFormat } from "../../util";
|
||||
import type { IssueListResponse } from "../../github/response";
|
||||
import type { TableResult } from "../query";
|
||||
import type { IssueListResponse } from "src/github/response";
|
||||
|
||||
export interface ColumnGetter<T> {
|
||||
header: string;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import type { IssueListResponse, IssueSearchResponse } from "src/github/response";
|
||||
import { getSearchResultIssueStatus } from "src/github/response";
|
||||
import type { IssueListResponse, IssueSearchResponse } from "../../github/response";
|
||||
import { getSearchResultIssueStatus } from "../../github/response";
|
||||
import { setIssueIcon } from "../../icon";
|
||||
import { titleCase } from "../../util";
|
||||
import { createTag } from "../../inline/inline";
|
||||
import { getPRForIssue } from "../../github/github";
|
||||
import { CommonIssuePRColumns, type ColumnsMap } from "./base";
|
||||
import { setIssueIcon } from "src/icon";
|
||||
import { titleCase } from "src/util";
|
||||
import { createTag } from "src/inline/inline";
|
||||
import { getPRForIssue } from "src/github/github";
|
||||
|
||||
export const IssueColumns: ColumnsMap = {
|
||||
...CommonIssuePRColumns,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { getSearchResultIssueStatus, IssueStatus } from "src/github/response";
|
||||
import { getSearchResultIssueStatus, IssueStatus } from "../../github/response";
|
||||
import { setPRIcon } from "../../icon";
|
||||
import { titleCase } from "../../util";
|
||||
import { CommonIssuePRColumns, type ColumnsMap } from "./base";
|
||||
import { setPRIcon } from "src/icon";
|
||||
import { titleCase } from "src/util";
|
||||
|
||||
export const PullRequestColumns: ColumnsMap = {
|
||||
...CommonIssuePRColumns,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { setIcon } from "obsidian";
|
||||
import { searchIssues, getIssuesForRepo, getMyIssues, getPullRequestsForRepo } from "src/github/github";
|
||||
import { parseYaml, setIcon } from "obsidian";
|
||||
import { searchIssues, getIssuesForRepo, getMyIssues, getPullRequestsForRepo } from "../github/github";
|
||||
import type {
|
||||
IssueListParams,
|
||||
IssueListResponse,
|
||||
|
|
@ -9,11 +9,10 @@ import type {
|
|||
PaginationMeta,
|
||||
PullListParams,
|
||||
PullListResponse,
|
||||
} from "src/github/response";
|
||||
import { parseYaml } from "obsidian";
|
||||
import { PluginSettings, logger } from "src/plugin";
|
||||
} from "../github/response";
|
||||
import { PluginSettings, logger } from "../plugin";
|
||||
import { getProp, isEqual, titleCase } from "../util";
|
||||
import { ALL_COLUMNS, DEFAULT_COLUMNS } from "./column/defaults";
|
||||
import { getProp, isEqual, titleCase } from "src/util";
|
||||
|
||||
export type TableResult = IssueSearchResponse["items"] | IssueListResponse | PullListResponse;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import type { App } from "obsidian";
|
||||
import { Setting } from "obsidian";
|
||||
import type { GithubAccount } from "./types";
|
||||
import { AuthModal } from "src/auth-modal";
|
||||
import { auth } from "src/github/auth";
|
||||
import type { Verification } from "@octokit/auth-oauth-device/dist-types/types";
|
||||
import { AuthModal } from "../auth-modal";
|
||||
import { auth } from "../github/auth";
|
||||
import type { GithubAccount } from "./types";
|
||||
|
||||
export class AccountSettings {
|
||||
authModal: AuthModal | null = null;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"inlineSourceMap": true,
|
||||
"inlineSources": true,
|
||||
"module": "ESNext",
|
||||
|
|
|
|||
Loading…
Reference in a new issue