mirror of
https://github.com/formax68/memoChron.git
synced 2026-07-22 05:45:44 +00:00
refactor(08-02): fix no-case-declarations and no-useless-escape (DIR-09)
- pathUtils.ts:47 — wrap case PathType.FILE_URL body in { ... } block scope
(the let normalized declaration leaked across cases without braces)
- viewRenderers.ts:370 — drop unnecessary backslash inside regex character
class: [-\/] -> [-/] (slash does not need escaping inside [...])
Nullish-coalescing audit: grep -rnE '\b(null|undefined|"")\s*\?\?' src/
returned only the documentation-comment hit at SettingsTab.ts:262. No
executable violations.
This commit is contained in:
parent
e69c2fa194
commit
acf46265b9
2 changed files with 5 additions and 3 deletions
|
|
@ -44,7 +44,7 @@ export function detectPathType(path: string): PathType {
|
|||
|
||||
export function normalizeFilePath(path: string, type: PathType): string {
|
||||
switch (type) {
|
||||
case PathType.FILE_URL:
|
||||
case PathType.FILE_URL: {
|
||||
// Remove file:// or file:/// prefix and decode URI components
|
||||
// Windows often uses file:///C:/path, Unix uses file:///path
|
||||
let normalized = decodeURIComponent(path.replace(/^file:\/\/\/?/, ""));
|
||||
|
|
@ -54,7 +54,9 @@ export function normalizeFilePath(path: string, type: PathType): string {
|
|||
normalized = "/" + normalized;
|
||||
}
|
||||
return normalized;
|
||||
|
||||
}
|
||||
|
||||
|
||||
case PathType.VAULT_RELATIVE:
|
||||
// Normalize path for Obsidian
|
||||
return normalizePath(path);
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ export function parseMonthYear(input: string): Date | null {
|
|||
];
|
||||
|
||||
// Try YYYY-MM or YYYY/MM format
|
||||
const numericMatch = input.match(/^(\d{4})[-\/](\d{1,2})$/);
|
||||
const numericMatch = input.match(/^(\d{4})[-/](\d{1,2})$/);
|
||||
if (numericMatch) {
|
||||
const year = parseInt(numericMatch[1]);
|
||||
const month = parseInt(numericMatch[2]) - 1; // Month is 0-indexed
|
||||
|
|
|
|||
Loading…
Reference in a new issue