🐛 fix(vscode): React 规则在导入了 react 的 .ts / .js 文件上也启用,自定义钩子和钩子调用照常出卡片

This commit is contained in:
cruldra committed 2026-10-16 20:50:12 +11:00
1 parent 2ccec54747
commit 9f736d92e7
23 files changed
+141 -36

No files matched your search

@@ -24,7 +24,7 @@ const RULES = [sqlalchemyRule, celeryRule, enumRule, dataclassRule]
function views(adapter: LanguageAdapter, languageId: string, translator: Translator, source: string): Promise<BlockView[]> {
return withBlocks(adapter, languageId, source, blocks =>
toBlockViews(blocks, { source, language: adapter, markers: [] }, translator, { rules: RULES, report: () => {} }))
toBlockViews(blocks, { source, language: adapter, markers: [] }, translator, { languageId, rules: RULES, report: () => {} }))
}
const pyViews = (source: string): Promise<BlockView[]> => views(py, 'python', pythonZhTranslator, source)
@@ -16,6 +16,7 @@ const sample = readFixture('rustLang.rs')
function views(source: string, fileName?: string): Promise<BlockView[]> {
return withBlocks(adapter, 'rust', source, blocks =>
toBlockViews(blocks, { source, language: adapter, markers: [], ...(fileName && { fileName }) }, rustZhTranslator, {
languageId: 'rust',
rules: [rustImplRule],
report: () => {},
}))