/
githubmirror
/
eslint-plugin
Обзор
Документация
Войти
/
githubmirror
/
eslint-plugin
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
0.1.2
lib/rules/hardcodedConfigPath.ts
38 строк
881 B
saberzero1
Fixed plugin not working with flat config
01 июл 2025, 23:35
01 июл 2025, 23:35
8da1e0b
Код
Авторство
О чём код?
import { TSESTree, TSESLint, 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.", }, schema: [], }, defaultOptions: [], create: (context) => { return { Literal(node: TSESTree.Literal) { if ( typeof node.value === "string" && node.value.includes(".obsidian") ) { context.report({ node, messageId: "configPath", }); } }, }; }, });