/
githubmirror
/
eslint-plugin
Обзор
Документация
Войти
/
githubmirror
/
eslint-plugin
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
0.3.0
lib/rules/hardcodedConfigPath.ts
38 строк
1 KB
Johannes Theiner
hardcodedConfigPath: don't detect urls
12 май 2026, 12:08
12 май 2026, 12:08
07391ad
Код
Авторство
О чём код?
import { TSESTree, ESLintUtils } from "@typescript-eslint/utils"; const ruleCreator = ESLintUtils.RuleCreator( (name) => `https://github.com/obsidianmd/eslint-plugin/blob/master/docs/rules/${name}.md`, ); export default ruleCreator({ name: "hardcoded-config-path", meta: { docs: { description: "test", url: "https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines#Commands", }, type: "problem" as const, messages: { configPath: "Obsidian's configuration folder is not necessarily `.obsidian`, it can be configured by the user. Use `Vault#configDir` to get the current value", }, schema: [], }, defaultOptions: [], create: (context) => { return { Literal(node: TSESTree.Literal) { if ( typeof node.value === "string" && node.value.match(/(?<![a-zA-Z0-9])\.obsidian(?![a-zA-Z_-])/) ) { context.report({ node, messageId: "configPath", }); } }, }; }, });