mirror of
https://github.com/kdnk/obsidian-automatic-linker.git
synced 2026-07-22 05:37:46 +00:00
chore: fix lint
This commit is contained in:
parent
32797e180f
commit
c997fd075a
9 changed files with 317 additions and 98 deletions
|
|
@ -1,29 +1,40 @@
|
|||
import eslint from '@eslint/js';
|
||||
import tseslint from 'typescript-eslint';
|
||||
import globals from 'globals';
|
||||
import eslint from "@eslint/js";
|
||||
import tseslint from "typescript-eslint";
|
||||
import globals from "globals";
|
||||
|
||||
export default tseslint.config(
|
||||
eslint.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.node,
|
||||
...globals.browser,
|
||||
},
|
||||
parserOptions: {
|
||||
sourceType: 'module',
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'no-unused-vars': 'off',
|
||||
'@typescript-eslint/no-unused-vars': ['error', { args: 'none' }],
|
||||
'@typescript-eslint/ban-ts-comment': 'off',
|
||||
'no-prototype-builtins': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
ignores: ['node_modules/', 'main.js', 'src/main.js'],
|
||||
}
|
||||
eslint.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.node,
|
||||
...globals.browser,
|
||||
},
|
||||
parserOptions: {
|
||||
sourceType: "module",
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
"no-unused-vars": "off",
|
||||
"@typescript-eslint/ban-ts-comment": "off",
|
||||
"no-prototype-builtins": "off",
|
||||
"@typescript-eslint/no-empty-function": "off",
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
args: "all",
|
||||
argsIgnorePattern: "^_",
|
||||
caughtErrors: "all",
|
||||
caughtErrorsIgnorePattern: "^_",
|
||||
destructuredArrayIgnorePattern: "^_",
|
||||
varsIgnorePattern: "^_",
|
||||
ignoreRestSiblings: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
ignores: ["node_modules/", "main.js", "src/main.js"],
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@
|
|||
"test": "VITE_CJS_IGNORE_WARNING=true vitest run",
|
||||
"test:watch": "VITE_CJS_IGNORE_WARNING=true vitest",
|
||||
"tsc:watch": "tsc -noEmit -skipLibCheck --watch",
|
||||
"lint": "eslint ."
|
||||
"lint": "eslint .",
|
||||
"lint:watch": "nodemon --watch src --ext js,ts --exec \"npm run lint\""
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
|
@ -24,6 +25,7 @@
|
|||
"esbuild": "0.17.3",
|
||||
"eslint": "^9.17.0",
|
||||
"globals": "^16.5.0",
|
||||
"nodemon": "^3.1.11",
|
||||
"obsidian": "latest",
|
||||
"obsidian-typings": "^2.15.0",
|
||||
"prettier": "^3.5.1",
|
||||
|
|
|
|||
191
pnpm-lock.yaml
191
pnpm-lock.yaml
|
|
@ -45,6 +45,9 @@ importers:
|
|||
globals:
|
||||
specifier: ^16.5.0
|
||||
version: 16.5.0
|
||||
nodemon:
|
||||
specifier: ^3.1.11
|
||||
version: 3.1.11
|
||||
obsidian:
|
||||
specifier: latest
|
||||
version: 1.8.7(@codemirror/state@6.5.0)(@codemirror/view@6.36.7)
|
||||
|
|
@ -1115,6 +1118,10 @@ packages:
|
|||
resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
anymatch@3.1.3:
|
||||
resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
argparse@2.0.1:
|
||||
resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==}
|
||||
|
||||
|
|
@ -1128,6 +1135,10 @@ packages:
|
|||
balanced-match@1.0.2:
|
||||
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
|
||||
|
||||
binary-extensions@2.3.0:
|
||||
resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
boolean@3.2.0:
|
||||
resolution: {integrity: sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==}
|
||||
deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
|
||||
|
|
@ -1138,6 +1149,10 @@ packages:
|
|||
brace-expansion@2.0.2:
|
||||
resolution: {integrity: sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==}
|
||||
|
||||
braces@3.0.3:
|
||||
resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
buffer-crc32@0.2.13:
|
||||
resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==}
|
||||
|
||||
|
|
@ -1189,6 +1204,10 @@ packages:
|
|||
chevrotain@11.0.3:
|
||||
resolution: {integrity: sha512-ci2iJH6LeIkvP9eJW6gpueU8cnZhv85ELY8w8WiFtNjMHA5ad6pQLaJo9mEly/9qUyCpvqX8/POVUTf18/HFdw==}
|
||||
|
||||
chokidar@3.6.0:
|
||||
resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==}
|
||||
engines: {node: '>= 8.10.0'}
|
||||
|
||||
clone-response@1.0.3:
|
||||
resolution: {integrity: sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==}
|
||||
|
||||
|
|
@ -1579,6 +1598,10 @@ packages:
|
|||
resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==}
|
||||
engines: {node: '>=16.0.0'}
|
||||
|
||||
fill-range@7.1.1:
|
||||
resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
find-up@5.0.0:
|
||||
resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==}
|
||||
engines: {node: '>=10'}
|
||||
|
|
@ -1614,6 +1637,10 @@ packages:
|
|||
resolution: {integrity: sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
glob-parent@5.1.2:
|
||||
resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==}
|
||||
engines: {node: '>= 6'}
|
||||
|
||||
glob-parent@6.0.2:
|
||||
resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
|
|
@ -1652,6 +1679,10 @@ packages:
|
|||
hachure-fill@0.5.2:
|
||||
resolution: {integrity: sha512-3GKBOn+m2LX9iq+JC1064cSFprJY4jL1jCXTcpnfER5HYE2l/4EfWSGzkPa/ZDBmYI0ZOEj5VHV/eKnPGkHuOg==}
|
||||
|
||||
has-flag@3.0.0:
|
||||
resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==}
|
||||
engines: {node: '>=4'}
|
||||
|
||||
has-flag@4.0.0:
|
||||
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
|
||||
engines: {node: '>=8'}
|
||||
|
|
@ -1681,6 +1712,9 @@ packages:
|
|||
resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
ignore-by-default@1.0.1:
|
||||
resolution: {integrity: sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==}
|
||||
|
||||
ignore@5.3.2:
|
||||
resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==}
|
||||
engines: {node: '>= 4'}
|
||||
|
|
@ -1704,6 +1738,10 @@ packages:
|
|||
resolution: {integrity: sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
is-binary-path@2.1.0:
|
||||
resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
is-extglob@2.1.1:
|
||||
resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
|
@ -1712,6 +1750,10 @@ packages:
|
|||
resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
is-number@7.0.0:
|
||||
resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==}
|
||||
engines: {node: '>=0.12.0'}
|
||||
|
||||
isexe@2.0.0:
|
||||
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
|
||||
|
||||
|
|
@ -1839,6 +1881,15 @@ packages:
|
|||
natural-compare@1.4.0:
|
||||
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
|
||||
|
||||
nodemon@3.1.11:
|
||||
resolution: {integrity: sha512-is96t8F/1//UHAjNPHpbsNY46ELPpftGUoSVNXwUfMk/qdjSylYrWSu1XavVTBOn526kFiOR733ATgNBCQyH0g==}
|
||||
engines: {node: '>=10'}
|
||||
hasBin: true
|
||||
|
||||
normalize-path@3.0.0:
|
||||
resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
normalize-url@6.1.0:
|
||||
resolution: {integrity: sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==}
|
||||
engines: {node: '>=10'}
|
||||
|
|
@ -1914,6 +1965,10 @@ packages:
|
|||
picocolors@1.1.1:
|
||||
resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
|
||||
|
||||
picomatch@2.3.1:
|
||||
resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
|
||||
engines: {node: '>=8.6'}
|
||||
|
||||
picomatch@4.0.2:
|
||||
resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==}
|
||||
engines: {node: '>=12'}
|
||||
|
|
@ -1954,6 +2009,9 @@ packages:
|
|||
resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==}
|
||||
engines: {node: '>=0.4.0'}
|
||||
|
||||
pstree.remy@1.1.8:
|
||||
resolution: {integrity: sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==}
|
||||
|
||||
pump@3.0.2:
|
||||
resolution: {integrity: sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==}
|
||||
|
||||
|
|
@ -1975,6 +2033,10 @@ packages:
|
|||
resolution: {integrity: sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
readdirp@3.6.0:
|
||||
resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==}
|
||||
engines: {node: '>=8.10.0'}
|
||||
|
||||
resolve-alpn@1.2.1:
|
||||
resolution: {integrity: sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==}
|
||||
|
||||
|
|
@ -2052,6 +2114,10 @@ packages:
|
|||
siginfo@2.0.0:
|
||||
resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==}
|
||||
|
||||
simple-update-notifier@2.0.0:
|
||||
resolution: {integrity: sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
source-map-js@1.2.1:
|
||||
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
|
@ -2079,6 +2145,10 @@ packages:
|
|||
resolution: {integrity: sha512-MvjXzkz/BOfyVDkG0oFOtBxHX2u3gKbMHIF/dXblZsgD3BWOFLmHovIpZY7BykJdAjcqRCBi1WYBNdEC9yI7vg==}
|
||||
engines: {node: '>= 8.0'}
|
||||
|
||||
supports-color@5.5.0:
|
||||
resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==}
|
||||
engines: {node: '>=4'}
|
||||
|
||||
supports-color@7.2.0:
|
||||
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
|
||||
engines: {node: '>=8'}
|
||||
|
|
@ -2112,6 +2182,14 @@ packages:
|
|||
resolution: {integrity: sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==}
|
||||
engines: {node: '>=14.0.0'}
|
||||
|
||||
to-regex-range@5.0.1:
|
||||
resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==}
|
||||
engines: {node: '>=8.0'}
|
||||
|
||||
touch@3.1.1:
|
||||
resolution: {integrity: sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==}
|
||||
hasBin: true
|
||||
|
||||
ts-api-utils@2.1.0:
|
||||
resolution: {integrity: sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==}
|
||||
engines: {node: '>=18.12'}
|
||||
|
|
@ -2148,6 +2226,9 @@ packages:
|
|||
ufo@1.6.1:
|
||||
resolution: {integrity: sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==}
|
||||
|
||||
undefsafe@2.0.5:
|
||||
resolution: {integrity: sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==}
|
||||
|
||||
undici-types@6.21.0:
|
||||
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
|
||||
|
||||
|
|
@ -2338,7 +2419,7 @@ snapshots:
|
|||
|
||||
'@electron/get@2.0.3':
|
||||
dependencies:
|
||||
debug: 4.4.0
|
||||
debug: 4.4.0(supports-color@5.5.0)
|
||||
env-paths: 2.2.1
|
||||
fs-extra: 8.1.0
|
||||
got: 11.8.6
|
||||
|
|
@ -2506,7 +2587,7 @@ snapshots:
|
|||
'@eslint/config-array@0.21.1':
|
||||
dependencies:
|
||||
'@eslint/object-schema': 2.1.7
|
||||
debug: 4.4.0
|
||||
debug: 4.4.0(supports-color@5.5.0)
|
||||
minimatch: 3.1.2
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
|
@ -2522,7 +2603,7 @@ snapshots:
|
|||
'@eslint/eslintrc@3.3.3':
|
||||
dependencies:
|
||||
ajv: 6.12.6
|
||||
debug: 4.4.0
|
||||
debug: 4.4.0(supports-color@5.5.0)
|
||||
espree: 10.4.0
|
||||
globals: 14.0.0
|
||||
ignore: 5.3.2
|
||||
|
|
@ -2560,7 +2641,7 @@ snapshots:
|
|||
'@antfu/install-pkg': 1.1.0
|
||||
'@antfu/utils': 8.1.1
|
||||
'@iconify/types': 2.0.0
|
||||
debug: 4.4.0
|
||||
debug: 4.4.0(supports-color@5.5.0)
|
||||
globals: 15.15.0
|
||||
kolorist: 1.8.0
|
||||
local-pkg: 1.1.1
|
||||
|
|
@ -3081,7 +3162,7 @@ snapshots:
|
|||
'@typescript-eslint/types': 8.50.0
|
||||
'@typescript-eslint/typescript-estree': 8.50.0(typescript@5.9.3)
|
||||
'@typescript-eslint/visitor-keys': 8.50.0
|
||||
debug: 4.4.0
|
||||
debug: 4.4.0(supports-color@5.5.0)
|
||||
eslint: 9.39.2
|
||||
typescript: 5.9.3
|
||||
transitivePeerDependencies:
|
||||
|
|
@ -3091,7 +3172,7 @@ snapshots:
|
|||
dependencies:
|
||||
'@typescript-eslint/tsconfig-utils': 8.50.0(typescript@5.9.3)
|
||||
'@typescript-eslint/types': 8.50.0
|
||||
debug: 4.4.0
|
||||
debug: 4.4.0(supports-color@5.5.0)
|
||||
typescript: 5.9.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
|
@ -3110,7 +3191,7 @@ snapshots:
|
|||
'@typescript-eslint/types': 8.50.0
|
||||
'@typescript-eslint/typescript-estree': 8.50.0(typescript@5.9.3)
|
||||
'@typescript-eslint/utils': 8.50.0(eslint@9.39.2)(typescript@5.9.3)
|
||||
debug: 4.4.0
|
||||
debug: 4.4.0(supports-color@5.5.0)
|
||||
eslint: 9.39.2
|
||||
ts-api-utils: 2.1.0(typescript@5.9.3)
|
||||
typescript: 5.9.3
|
||||
|
|
@ -3125,7 +3206,7 @@ snapshots:
|
|||
'@typescript-eslint/tsconfig-utils': 8.50.0(typescript@5.9.3)
|
||||
'@typescript-eslint/types': 8.50.0
|
||||
'@typescript-eslint/visitor-keys': 8.50.0
|
||||
debug: 4.4.0
|
||||
debug: 4.4.0(supports-color@5.5.0)
|
||||
minimatch: 9.0.5
|
||||
semver: 7.7.1
|
||||
tinyglobby: 0.2.15
|
||||
|
|
@ -3209,6 +3290,11 @@ snapshots:
|
|||
dependencies:
|
||||
color-convert: 2.0.1
|
||||
|
||||
anymatch@3.1.3:
|
||||
dependencies:
|
||||
normalize-path: 3.0.0
|
||||
picomatch: 2.3.1
|
||||
|
||||
argparse@2.0.1: {}
|
||||
|
||||
assertion-error@2.0.1: {}
|
||||
|
|
@ -3217,6 +3303,8 @@ snapshots:
|
|||
|
||||
balanced-match@1.0.2: {}
|
||||
|
||||
binary-extensions@2.3.0: {}
|
||||
|
||||
boolean@3.2.0:
|
||||
optional: true
|
||||
|
||||
|
|
@ -3229,6 +3317,10 @@ snapshots:
|
|||
dependencies:
|
||||
balanced-match: 1.0.2
|
||||
|
||||
braces@3.0.3:
|
||||
dependencies:
|
||||
fill-range: 7.1.1
|
||||
|
||||
buffer-crc32@0.2.13: {}
|
||||
|
||||
builtin-modules@3.3.0: {}
|
||||
|
|
@ -3288,6 +3380,18 @@ snapshots:
|
|||
'@chevrotain/utils': 11.0.3
|
||||
lodash-es: 4.17.21
|
||||
|
||||
chokidar@3.6.0:
|
||||
dependencies:
|
||||
anymatch: 3.1.3
|
||||
braces: 3.0.3
|
||||
glob-parent: 5.1.2
|
||||
is-binary-path: 2.1.0
|
||||
is-glob: 4.0.3
|
||||
normalize-path: 3.0.0
|
||||
readdirp: 3.6.0
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.3
|
||||
|
||||
clone-response@1.0.3:
|
||||
dependencies:
|
||||
mimic-response: 1.0.1
|
||||
|
|
@ -3512,9 +3616,11 @@ snapshots:
|
|||
|
||||
dayjs@1.11.13: {}
|
||||
|
||||
debug@4.4.0:
|
||||
debug@4.4.0(supports-color@5.5.0):
|
||||
dependencies:
|
||||
ms: 2.1.3
|
||||
optionalDependencies:
|
||||
supports-color: 5.5.0
|
||||
|
||||
decompress-response@6.0.0:
|
||||
dependencies:
|
||||
|
|
@ -3669,7 +3775,7 @@ snapshots:
|
|||
ajv: 6.12.6
|
||||
chalk: 4.1.2
|
||||
cross-spawn: 7.0.6
|
||||
debug: 4.4.0
|
||||
debug: 4.4.0(supports-color@5.5.0)
|
||||
escape-string-regexp: 4.0.0
|
||||
eslint-scope: 8.4.0
|
||||
eslint-visitor-keys: 4.2.1
|
||||
|
|
@ -3721,7 +3827,7 @@ snapshots:
|
|||
|
||||
extract-zip@2.0.1:
|
||||
dependencies:
|
||||
debug: 4.4.0
|
||||
debug: 4.4.0(supports-color@5.5.0)
|
||||
get-stream: 5.2.0
|
||||
yauzl: 2.10.0
|
||||
optionalDependencies:
|
||||
|
|
@ -3751,6 +3857,10 @@ snapshots:
|
|||
dependencies:
|
||||
flat-cache: 4.0.1
|
||||
|
||||
fill-range@7.1.1:
|
||||
dependencies:
|
||||
to-regex-range: 5.0.1
|
||||
|
||||
find-up@5.0.0:
|
||||
dependencies:
|
||||
locate-path: 6.0.0
|
||||
|
|
@ -3796,6 +3906,10 @@ snapshots:
|
|||
dependencies:
|
||||
pump: 3.0.2
|
||||
|
||||
glob-parent@5.1.2:
|
||||
dependencies:
|
||||
is-glob: 4.0.3
|
||||
|
||||
glob-parent@6.0.2:
|
||||
dependencies:
|
||||
is-glob: 4.0.3
|
||||
|
|
@ -3842,6 +3956,8 @@ snapshots:
|
|||
|
||||
hachure-fill@0.5.2: {}
|
||||
|
||||
has-flag@3.0.0: {}
|
||||
|
||||
has-flag@4.0.0: {}
|
||||
|
||||
has-property-descriptors@1.0.2:
|
||||
|
|
@ -3870,6 +3986,8 @@ snapshots:
|
|||
dependencies:
|
||||
safer-buffer: 2.1.2
|
||||
|
||||
ignore-by-default@1.0.1: {}
|
||||
|
||||
ignore@5.3.2: {}
|
||||
|
||||
ignore@7.0.5: {}
|
||||
|
|
@ -3885,12 +4003,18 @@ snapshots:
|
|||
|
||||
internmap@2.0.3: {}
|
||||
|
||||
is-binary-path@2.1.0:
|
||||
dependencies:
|
||||
binary-extensions: 2.3.0
|
||||
|
||||
is-extglob@2.1.1: {}
|
||||
|
||||
is-glob@4.0.3:
|
||||
dependencies:
|
||||
is-extglob: 2.1.1
|
||||
|
||||
is-number@7.0.0: {}
|
||||
|
||||
isexe@2.0.0: {}
|
||||
|
||||
ismobilejs@1.1.1: {}
|
||||
|
|
@ -4026,6 +4150,21 @@ snapshots:
|
|||
|
||||
natural-compare@1.4.0: {}
|
||||
|
||||
nodemon@3.1.11:
|
||||
dependencies:
|
||||
chokidar: 3.6.0
|
||||
debug: 4.4.0(supports-color@5.5.0)
|
||||
ignore-by-default: 1.0.1
|
||||
minimatch: 3.1.2
|
||||
pstree.remy: 1.1.8
|
||||
semver: 7.7.1
|
||||
simple-update-notifier: 2.0.0
|
||||
supports-color: 5.5.0
|
||||
touch: 3.1.1
|
||||
undefsafe: 2.0.5
|
||||
|
||||
normalize-path@3.0.0: {}
|
||||
|
||||
normalize-url@6.1.0: {}
|
||||
|
||||
object-inspect@1.13.4: {}
|
||||
|
|
@ -4117,6 +4256,8 @@ snapshots:
|
|||
|
||||
picocolors@1.1.1: {}
|
||||
|
||||
picomatch@2.3.1: {}
|
||||
|
||||
picomatch@4.0.2: {}
|
||||
|
||||
picomatch@4.0.3: {}
|
||||
|
|
@ -4187,6 +4328,8 @@ snapshots:
|
|||
|
||||
progress@2.0.3: {}
|
||||
|
||||
pstree.remy@1.1.8: {}
|
||||
|
||||
pump@3.0.2:
|
||||
dependencies:
|
||||
end-of-stream: 1.4.4
|
||||
|
|
@ -4204,6 +4347,10 @@ snapshots:
|
|||
|
||||
quick-lru@5.1.1: {}
|
||||
|
||||
readdirp@3.6.0:
|
||||
dependencies:
|
||||
picomatch: 2.3.1
|
||||
|
||||
resolve-alpn@1.2.1: {}
|
||||
|
||||
resolve-from@4.0.0: {}
|
||||
|
|
@ -4311,6 +4458,10 @@ snapshots:
|
|||
|
||||
siginfo@2.0.0: {}
|
||||
|
||||
simple-update-notifier@2.0.0:
|
||||
dependencies:
|
||||
semver: 7.7.1
|
||||
|
||||
source-map-js@1.2.1: {}
|
||||
|
||||
sprintf-js@1.1.3:
|
||||
|
|
@ -4328,10 +4479,14 @@ snapshots:
|
|||
|
||||
sumchecker@3.0.1:
|
||||
dependencies:
|
||||
debug: 4.4.0
|
||||
debug: 4.4.0(supports-color@5.5.0)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
supports-color@5.5.0:
|
||||
dependencies:
|
||||
has-flag: 3.0.0
|
||||
|
||||
supports-color@7.2.0:
|
||||
dependencies:
|
||||
has-flag: 4.0.0
|
||||
|
|
@ -4358,6 +4513,12 @@ snapshots:
|
|||
|
||||
tinyspy@3.0.2: {}
|
||||
|
||||
to-regex-range@5.0.1:
|
||||
dependencies:
|
||||
is-number: 7.0.0
|
||||
|
||||
touch@3.1.1: {}
|
||||
|
||||
ts-api-utils@2.1.0(typescript@5.9.3):
|
||||
dependencies:
|
||||
typescript: 5.9.3
|
||||
|
|
@ -4388,6 +4549,8 @@ snapshots:
|
|||
|
||||
ufo@1.6.1: {}
|
||||
|
||||
undefsafe@2.0.5: {}
|
||||
|
||||
undici-types@6.21.0: {}
|
||||
|
||||
universalify@0.1.2: {}
|
||||
|
|
@ -4406,7 +4569,7 @@ snapshots:
|
|||
vite-node@3.1.3(@types/node@22.15.17):
|
||||
dependencies:
|
||||
cac: 6.7.14
|
||||
debug: 4.4.0
|
||||
debug: 4.4.0(supports-color@5.5.0)
|
||||
es-module-lexer: 1.7.0
|
||||
pathe: 2.0.3
|
||||
vite: 6.3.5(@types/node@22.15.17)
|
||||
|
|
@ -4446,7 +4609,7 @@ snapshots:
|
|||
'@vitest/spy': 3.1.3
|
||||
'@vitest/utils': 3.1.3
|
||||
chai: 5.2.0
|
||||
debug: 4.4.0
|
||||
debug: 4.4.0(supports-color@5.5.0)
|
||||
expect-type: 1.2.1
|
||||
magic-string: 0.30.17
|
||||
pathe: 2.0.3
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ export const excludeLinks = (text: string) => {
|
|||
return segment.content;
|
||||
} else {
|
||||
// Replace links in non-code segments, handling aliases
|
||||
return segment.content.replace(regex, (match, link, alias) => {
|
||||
return segment.content.replace(regex, (_match, link, alias) => {
|
||||
// If there's an alias, use it
|
||||
if (alias) {
|
||||
return alias;
|
||||
|
|
|
|||
|
|
@ -34,28 +34,34 @@ 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 ]/
|
||||
WHITESPACE: /[\t\n\r ]/,
|
||||
} as const;
|
||||
|
||||
// Text Analysis Utilities
|
||||
const isWordBoundary = (char: string | undefined): boolean => {
|
||||
if (char === undefined) return true;
|
||||
if (REGEX_PATTERNS.CJK.test(char)) return true;
|
||||
return !REGEX_PATTERNS.WORD_BOUNDARY.test(char) || REGEX_PATTERNS.WHITESPACE.test(char);
|
||||
return (
|
||||
!REGEX_PATTERNS.WORD_BOUNDARY.test(char) ||
|
||||
REGEX_PATTERNS.WHITESPACE.test(char)
|
||||
);
|
||||
};
|
||||
|
||||
const isMonthNote = (candidate: string): boolean =>
|
||||
|
|
@ -63,17 +69,18 @@ const isMonthNote = (candidate: string): boolean =>
|
|||
parseInt(candidate, 10) >= 1 &&
|
||||
parseInt(candidate, 10) <= 12;
|
||||
|
||||
const isProtectedLink = (body: string): boolean =>
|
||||
const isProtectedLink = (body: string): boolean =>
|
||||
REGEX_PATTERNS.PROTECTED_LINK.test(body);
|
||||
|
||||
const isCjkText = (text: string): boolean => REGEX_PATTERNS.CJK.test(text);
|
||||
|
||||
const isCjkCandidate = (candidate: string): boolean =>
|
||||
const isCjkCandidate = (candidate: string): boolean =>
|
||||
REGEX_PATTERNS.CJK_CANDIDATE.test(candidate);
|
||||
|
||||
const isKoreanText = (text: string): boolean => REGEX_PATTERNS.KOREAN.test(text);
|
||||
const isKoreanText = (text: string): boolean =>
|
||||
REGEX_PATTERNS.KOREAN.test(text);
|
||||
|
||||
const isJapaneseText = (text: string): boolean =>
|
||||
const isJapaneseText = (text: string): boolean =>
|
||||
REGEX_PATTERNS.JAPANESE.test(text) && !REGEX_PATTERNS.KOREAN.test(text);
|
||||
|
||||
// Cache for fallback index to avoid rebuilding
|
||||
|
|
@ -168,15 +175,24 @@ const isSelfLink = (
|
|||
const { linkPath } = extractLinkParts(candidateData.canonical);
|
||||
|
||||
// Normalize paths for comparison
|
||||
const normalizedLinkPath = normalizeCanonicalPath(linkPath, settings.baseDir);
|
||||
const normalizedCurrentPath = normalizeCanonicalPath(currentFilePath, settings.baseDir);
|
||||
const normalizedLinkPath = normalizeCanonicalPath(
|
||||
linkPath,
|
||||
settings.baseDir,
|
||||
);
|
||||
const normalizedCurrentPath = normalizeCanonicalPath(
|
||||
currentFilePath,
|
||||
settings.baseDir,
|
||||
);
|
||||
|
||||
// Compare the paths
|
||||
return normalizedLinkPath === normalizedCurrentPath;
|
||||
};
|
||||
|
||||
// Helper function to check if a path should have its alias removed
|
||||
const shouldRemoveAlias = (normalizedPath: string, removeAliasInDirs?: string[]): boolean => {
|
||||
const shouldRemoveAlias = (
|
||||
normalizedPath: string,
|
||||
removeAliasInDirs?: string[],
|
||||
): boolean => {
|
||||
if (!removeAliasInDirs || removeAliasInDirs.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -202,11 +218,16 @@ const createLinkContent = (
|
|||
originalMatchedText: string,
|
||||
settings: ReplaceLinksSettings = {},
|
||||
): { linkPath: string; alias?: string } => {
|
||||
const { linkPath, alias, hasAlias } = extractLinkParts(candidateData.canonical);
|
||||
const { linkPath, alias, hasAlias } = extractLinkParts(
|
||||
candidateData.canonical,
|
||||
);
|
||||
const normalizedPath = normalizeCanonicalPath(linkPath, settings.baseDir);
|
||||
|
||||
// Check if alias should be removed for this directory
|
||||
const removeAlias = shouldRemoveAlias(normalizedPath, settings.removeAliasInDirs);
|
||||
const removeAlias = shouldRemoveAlias(
|
||||
normalizedPath,
|
||||
settings.removeAliasInDirs,
|
||||
);
|
||||
|
||||
if (hasAlias) {
|
||||
// If alias removal is enabled for this directory, return path without alias
|
||||
|
|
@ -225,7 +246,8 @@ const createLinkContent = (
|
|||
}
|
||||
|
||||
// For paths with slashes, use the last segment as the display text
|
||||
const lastSegment = normalizedPath.split("/").pop() || originalMatchedText;
|
||||
const lastSegment =
|
||||
normalizedPath.split("/").pop() || originalMatchedText;
|
||||
|
||||
// If ignoreCase is enabled and originalMatchedText contains a slash,
|
||||
// use the last segment of originalMatchedText to preserve case
|
||||
|
|
@ -245,7 +267,9 @@ const createLinkContent = (
|
|||
|
||||
// No explicit alias, no '/' in normalizedPath
|
||||
if (settings.ignoreCase) {
|
||||
if (originalMatchedText.toLowerCase() === normalizedPath.toLowerCase()) {
|
||||
if (
|
||||
originalMatchedText.toLowerCase() === normalizedPath.toLowerCase()
|
||||
) {
|
||||
return { linkPath: originalMatchedText };
|
||||
} else {
|
||||
return { linkPath: normalizedPath, alias: originalMatchedText };
|
||||
|
|
@ -259,16 +283,6 @@ const createLinkContent = (
|
|||
}
|
||||
};
|
||||
|
||||
const formatFinalLink = (
|
||||
linkContent: string,
|
||||
isInTable: boolean,
|
||||
): string => {
|
||||
if (isInTable && linkContent.includes("|")) {
|
||||
linkContent = linkContent.replace(/\|/g, "\\|");
|
||||
}
|
||||
return `[[${linkContent}]]`;
|
||||
};
|
||||
|
||||
// Default link generator that creates standard Obsidian wikilinks
|
||||
export const defaultLinkGenerator: LinkGenerator = ({
|
||||
linkPath,
|
||||
|
|
@ -289,8 +303,14 @@ export const defaultLinkGenerator: LinkGenerator = ({
|
|||
};
|
||||
|
||||
// Candidate Validation
|
||||
const shouldSkipCandidate = (candidate: string, settings: ReplaceLinksSettings): boolean => {
|
||||
if (settings.ignoreDateFormats && REGEX_PATTERNS.DATE_FORMAT.test(candidate)) {
|
||||
const shouldSkipCandidate = (
|
||||
candidate: string,
|
||||
settings: ReplaceLinksSettings,
|
||||
): boolean => {
|
||||
if (
|
||||
settings.ignoreDateFormats &&
|
||||
REGEX_PATTERNS.DATE_FORMAT.test(candidate)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return isMonthNote(candidate);
|
||||
|
|
@ -299,27 +319,30 @@ const shouldSkipCandidate = (candidate: string, settings: ReplaceLinksSettings):
|
|||
// Markdown Table Detection
|
||||
const isMarkdownTableLine = (line: string): boolean => {
|
||||
const trimmedLine = line.trim();
|
||||
if (!trimmedLine || !trimmedLine.includes('|')) {
|
||||
if (!trimmedLine || !trimmedLine.includes("|")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (trimmedLine.startsWith('|') && trimmedLine.endsWith('|') &&
|
||||
REGEX_PATTERNS.TABLE_SEPARATOR.test(trimmedLine)) {
|
||||
|
||||
if (
|
||||
trimmedLine.startsWith("|") &&
|
||||
trimmedLine.endsWith("|") &&
|
||||
REGEX_PATTERNS.TABLE_SEPARATOR.test(trimmedLine)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return trimmedLine.startsWith('|') && trimmedLine.endsWith('|');
|
||||
|
||||
return trimmedLine.startsWith("|") && trimmedLine.endsWith("|");
|
||||
};
|
||||
|
||||
const isIndexInsideMarkdownTable = (text: string, index: number): boolean => {
|
||||
// Find the start of the line containing the index
|
||||
let lineStart = text.lastIndexOf('\n', index - 1) + 1;
|
||||
if (lineStart === 0 && text[0] !== '\n') {
|
||||
let lineStart = text.lastIndexOf("\n", index - 1) + 1;
|
||||
if (lineStart === 0 && text[0] !== "\n") {
|
||||
lineStart = 0;
|
||||
}
|
||||
|
||||
// Find the end of the line containing the index
|
||||
let lineEnd = text.indexOf('\n', index);
|
||||
let lineEnd = text.indexOf("\n", index);
|
||||
if (lineEnd === -1) {
|
||||
lineEnd = text.length;
|
||||
}
|
||||
|
|
@ -361,7 +384,7 @@ const processFallbackSearch = (
|
|||
filePath: string,
|
||||
currentNamespace: string,
|
||||
linkGenerator: LinkGenerator,
|
||||
settings: ReplaceLinksSettings
|
||||
settings: ReplaceLinksSettings,
|
||||
): { result: string; newIndex: number } | null => {
|
||||
// Early boundary check - if start isn't a word boundary, skip
|
||||
const prevChar = text[startIndex - 1];
|
||||
|
|
@ -379,8 +402,8 @@ const processFallbackSearch = (
|
|||
// Iterate through potential multi-word sequences starting from startIndex
|
||||
const maxSearchLength = Math.min(text.length - startIndex, 100); // Limit search length for performance
|
||||
|
||||
let potentialMatch = '';
|
||||
let searchWord = '';
|
||||
let potentialMatch = "";
|
||||
let searchWord = "";
|
||||
|
||||
for (let length = 1; length <= maxSearchLength; length++) {
|
||||
const endIndex = startIndex + length;
|
||||
|
|
@ -422,7 +445,7 @@ const processFallbackSearch = (
|
|||
|
||||
// Filter candidates based on namespace restrictions
|
||||
const filteredCandidates = longestMatch.candidateList.filter(
|
||||
([, data]) => !(data.scoped && data.namespace !== currentNamespace)
|
||||
([, data]) => !(data.scoped && data.namespace !== currentNamespace),
|
||||
);
|
||||
|
||||
let bestCandidateData: CandidateData | null = null;
|
||||
|
|
@ -446,12 +469,16 @@ const processFallbackSearch = (
|
|||
if (isSelfLink(bestCandidateData, filePath, settings)) {
|
||||
return {
|
||||
result: longestMatch.word,
|
||||
newIndex: startIndex + longestMatch.length
|
||||
newIndex: startIndex + longestMatch.length,
|
||||
};
|
||||
}
|
||||
|
||||
// Create the link
|
||||
const { linkPath, alias } = createLinkContent(bestCandidateData, longestMatch.word, settings);
|
||||
const { linkPath, alias } = createLinkContent(
|
||||
bestCandidateData,
|
||||
longestMatch.word,
|
||||
settings,
|
||||
);
|
||||
const isInTable = isIndexInsideMarkdownTable(text, startIndex);
|
||||
const finalLink = linkGenerator({
|
||||
linkPath,
|
||||
|
|
@ -462,7 +489,7 @@ const processFallbackSearch = (
|
|||
|
||||
return {
|
||||
result: finalLink,
|
||||
newIndex: startIndex + longestMatch.length
|
||||
newIndex: startIndex + longestMatch.length,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -489,7 +516,11 @@ const handleKoreanSpecialCases = (
|
|||
};
|
||||
}
|
||||
|
||||
const { linkPath, alias } = createLinkContent(candidateData, candidate, settings);
|
||||
const { linkPath, alias } = createLinkContent(
|
||||
candidateData,
|
||||
candidate,
|
||||
settings,
|
||||
);
|
||||
const finalLink = linkGenerator({
|
||||
linkPath,
|
||||
sourcePath: filePath,
|
||||
|
|
@ -613,7 +644,7 @@ const processStandardText = (
|
|||
|
||||
outer: while (i < text.length) {
|
||||
// Check for URLs first - only if current character could start a URL
|
||||
if (text[i] === 'h' && text.slice(i, i + 4) === 'http') {
|
||||
if (text[i] === "h" && text.slice(i, i + 4) === "http") {
|
||||
const urlMatch = text.slice(i).match(REGEX_PATTERNS.URL);
|
||||
if (urlMatch) {
|
||||
result += urlMatch[0];
|
||||
|
|
@ -626,13 +657,13 @@ const processStandardText = (
|
|||
let node = trie;
|
||||
let lastCandidate: { candidate: string; length: number } | null = null;
|
||||
let j = i;
|
||||
let candidateBuilder = '';
|
||||
let candidateBuilder = "";
|
||||
|
||||
while (j < text.length) {
|
||||
const ch = text[j];
|
||||
const chLower = settings.ignoreCase ? ch.toLowerCase() : ch;
|
||||
candidateBuilder += ch;
|
||||
|
||||
|
||||
const child = node.children.get(chLower);
|
||||
if (!child) break;
|
||||
|
||||
|
|
@ -755,7 +786,11 @@ const processStandardText = (
|
|||
}
|
||||
|
||||
// Create the link
|
||||
const { linkPath, alias } = createLinkContent(candidateData, originalMatchedText, settings);
|
||||
const { linkPath, alias } = createLinkContent(
|
||||
candidateData,
|
||||
originalMatchedText,
|
||||
settings,
|
||||
);
|
||||
const isInTable = isIndexInsideMarkdownTable(text, i);
|
||||
const finalLink = linkGenerator({
|
||||
linkPath,
|
||||
|
|
@ -773,7 +808,13 @@ const processStandardText = (
|
|||
// Fallback: multi-word lookup using fallback index
|
||||
if (settings.namespaceResolution) {
|
||||
const fallbackResult = processFallbackSearch(
|
||||
text, i, fallbackIndex, filePath, currentNamespace, linkGenerator, settings
|
||||
text,
|
||||
i,
|
||||
fallbackIndex,
|
||||
filePath,
|
||||
currentNamespace,
|
||||
linkGenerator,
|
||||
settings,
|
||||
);
|
||||
if (fallbackResult) {
|
||||
result += fallbackResult.result;
|
||||
|
|
@ -866,7 +907,9 @@ export const replaceLinks = ({
|
|||
// Reset the regex to start from the beginning
|
||||
REGEX_PATTERNS.PROTECTED.lastIndex = 0;
|
||||
|
||||
while ((match = REGEX_PATTERNS.PROTECTED.exec(bodyWithPlaceholders)) !== null) {
|
||||
while (
|
||||
(match = REGEX_PATTERNS.PROTECTED.exec(bodyWithPlaceholders)) !== null
|
||||
) {
|
||||
const mIndex = match.index;
|
||||
const segment = bodyWithPlaceholders.slice(lastIndex, mIndex);
|
||||
resultBody += processTextSegment(segment);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ export function formatGitHubURL(
|
|||
|
||||
const cleanURL = getCleanURL(githubURL, urlInfo);
|
||||
return formatToObsidianLink(urlInfo, cleanURL);
|
||||
} catch (e) {
|
||||
} catch (_e) {
|
||||
// If URL is invalid, return original string
|
||||
return url;
|
||||
}
|
||||
|
|
@ -87,7 +87,7 @@ function formatToObsidianLink(
|
|||
): string {
|
||||
const url = new URL(cleanURL);
|
||||
const isEnterpriseURL = url.hostname !== "github.com";
|
||||
let prefix = isEnterpriseURL ? "ghe" : "github";
|
||||
const prefix = isEnterpriseURL ? "ghe" : "github";
|
||||
|
||||
let wikiLink = `[[${prefix}/${urlInfo.owner}/${urlInfo.repository}`;
|
||||
if (urlInfo.type && urlInfo.id) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ export function formatJiraURL(
|
|||
|
||||
const cleanURL = getCleanURL(jiraURL, urlInfo);
|
||||
return formatToObsidianLink(jiraURL, urlInfo, cleanURL);
|
||||
} catch (e) {
|
||||
} catch (_e) {
|
||||
// If URL is invalid, return original string
|
||||
return url;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ export function formatLinearURL(
|
|||
|
||||
const cleanURL = getCleanURL(urlInfo);
|
||||
return formatToObsidianLink(urlInfo, cleanURL);
|
||||
} catch (e) {
|
||||
} catch (_e) {
|
||||
// If URL is invalid, return original string
|
||||
return url;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export function updateEditor(
|
|||
newText: string,
|
||||
editor: Editor,
|
||||
): DiffMatchPatch.Diff[] {
|
||||
const dmp = new DiffMatchPatch.diff_match_patch(); // eslint-disable-line new-cap
|
||||
const dmp = new DiffMatchPatch.diff_match_patch();
|
||||
const changes = dmp.diff_main(oldText, newText);
|
||||
let curText = "";
|
||||
changes.forEach((change) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue