From 0b62af15cd8e1b48c378fea2f4c854e6ca944fb5 Mon Sep 17 00:00:00 2001 From: Kodai Nakamura Date: Sat, 20 Dec 2025 20:57:13 +0900 Subject: [PATCH] chore: fix stylistic issues in multiple files --- src/main.ts | 6 +++--- src/remove-minimal-indent/__tests__/integration.test.ts | 4 ++-- .../__tests__/replace-links.performance.test.ts | 6 +++--- src/replace-links/replace-links.ts | 9 +++------ 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/main.ts b/src/main.ts index 91dcfc0..b32f839 100644 --- a/src/main.ts +++ b/src/main.ts @@ -64,9 +64,9 @@ export default class AutomaticLinkerPlugin extends Plugin { } /** - * Creates a LinkGenerator that uses Obsidian's generateMarkdownLink API. - * Falls back to default wikilink format if the file cannot be resolved. - */ + * Creates a LinkGenerator that uses Obsidian's generateMarkdownLink API. + * Falls back to default wikilink format if the file cannot be resolved. + */ private createLinkGenerator(sourcePath: string): LinkGenerator { return ({ linkPath, diff --git a/src/remove-minimal-indent/__tests__/integration.test.ts b/src/remove-minimal-indent/__tests__/integration.test.ts index 897dec4..fc739fe 100644 --- a/src/remove-minimal-indent/__tests__/integration.test.ts +++ b/src/remove-minimal-indent/__tests__/integration.test.ts @@ -44,13 +44,13 @@ describe("copy selection integration test", () => { it("", () => { const text = ` - - hello + - hello - hello [[world]]` const withoutIndent = removeMinimalIndent(text) const result = excludeLinks(withoutIndent) const expected = ` - hello - - hello world` + - hello world` expect(result).toBe(expected) }) }) diff --git a/src/replace-links/__tests__/replace-links.performance.test.ts b/src/replace-links/__tests__/replace-links.performance.test.ts index 53eddb3..9856a1d 100644 --- a/src/replace-links/__tests__/replace-links.performance.test.ts +++ b/src/replace-links/__tests__/replace-links.performance.test.ts @@ -179,8 +179,8 @@ This is a test document with ${linkWords[0]} and ${linkWords[1]}. \`\`\`javascript function test() { - // This should not be processed: ${linkWords[2]} - return "${linkWords[3]}"; + // This should not be processed: ${linkWords[2]} + return "${linkWords[3]}"; } \`\`\` @@ -194,7 +194,7 @@ Here are some more references to ${linkWords[4]} and ${linkWords[5]}. ${generateLargeBody(10)} Final paragraph mentions ${linkWords[9]} again. - `.trim() + `.trim() const { candidateMap, trie } = buildCandidateTrieForTest({ files, diff --git a/src/replace-links/replace-links.ts b/src/replace-links/replace-links.ts index cd7dca8..e2f83e1 100644 --- a/src/replace-links/replace-links.ts +++ b/src/replace-links/replace-links.ts @@ -34,21 +34,18 @@ export interface ReplaceLinksOptions { // Constants and Regular Expressions const REGEX_PATTERNS = { - PROTECTED: - /(```[\s\S]*?```|`[^`]*`|\[\[[^\]]+\]\]|\[[^\]]+\]\([^)]+\)|\[[^\]]+\]|https?:\/\/[^\s]+)/g, + PROTECTED: /(```[\s\S]*?```|`[^`]*`|\[\[[^\]]+\]\]|\[[^\]]+\]\([^)]+\)|\[[^\]]+\]|https?:\/\/[^\s]+)/g, DATE_FORMAT: /^\d{4}-\d{2}-\d{2}$/, MONTH_NOTE: /^[0-9]{1,2}$/, CJK: /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}]/u, - CJK_CANDIDATE: - /^[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\s\d]+$/u, + CJK_CANDIDATE: /^[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\s\d]+$/u, KOREAN: /^[\p{Script=Hangul}]+$/u, JAPANESE: /^[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\s\d]+$/u, URL: /^(https?:\/\/[^\s]+)/, PROTECTED_LINK: /^\s*(\[\[[^\]]+\]\]|\[[^\]]+\]\([^)]+\))\s*$/, KOREAN_SUFFIX: /^(이다\.?)/, KOREAN_PARTICLES: /^(는|은)/, - JAPANESE_PARTICLES: - /^(가|는|을|에|서|와|로부터|까지|보다|로|의|나|도|또한)/, + JAPANESE_PARTICLES: /^(가|는|을|에|서|와|로부터|까지|보다|로|의|나|도|또한)/, TABLE_SEPARATOR: /^[|:\s-]+$/, WORD_BOUNDARY: /[\p{L}\p{N}_/-]/u, WHITESPACE: /[\t\n\r ]/,