/
githubmirror
/
eslint-plugin
Обзор
Документация
Войти
/
githubmirror
/
eslint-plugin
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
0.2.9
lib/rules/hardcodedConfigPath.ts
38 строк
1 KB
Michael Naumov
chore: switch tabs to spaces
04 дек 2025, 22:01
04 дек 2025, 22:01
903401e
Код
Авторство
О чём код?
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(/\.obsidian(?![a-zA-Z_-])/) ) { context.report({ node, messageId: "configPath", }); } }, }; }, });