Files
superwork/vscode/eslint.config.mjs
T
cruldra c8620e6e1b ♻️ refactor(vscode): 看板的悬停提示也改走 data-tooltip,插件网页只剩一条提示的路;lint 禁止原生 title
- 看板剩下的原生 title(顶栏按钮、工单卡片、工单详情、会话、Profile 表、改动文件树和 diff、属性表)全部改成 data-tooltip,
  禁用的按钮照样弹;只有图标、原来只靠 title 当名字的(审查勾、生成说明、属性说明的 i 图标、没头像的归属人)补上 aria-label
- 提示框按原文换行:摘修复弹框里「迁移」列的几个文件一行一个
- 代码阅读 Markdown 链接的标题写成 data-tooltip
- eslint 规则:网页 TSX 的 DOM 元素上写 title 报错,iframe 和组件自己的 title 属性不算
2026-09-27 21:39:15 +08:00

37 lines
1.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// @ts-check
import antfu from '@antfu/eslint-config'
export default antfu(
{
ignores: [
// eslint ignore globs here
],
},
{
rules: {
// overrides
},
},
{
// 翻译插件只通过 contract 拿语言插件给的信息(翻译时传进来的 SourceDocument.language),第三方翻译插件也是这样拿
files: ['src/codeReader/translators/**/*.ts'],
ignores: ['**/*.test.ts'],
rules: {
'no-restricted-imports': ['error', {
patterns: [{ group: ['**/languages/*'], message: '翻译插件不直接依赖语言插件:词性、遍历结构等从 SourceDocument.language 取' }],
}],
},
},
{
// webview 的悬停提示只走 components/ui/tooltip.tsx(元素上写 data-tooltip):原生 title 在 macOS 的 VS Code 里鼠标停在元素里面不弹
// (electron/electron#49843),样式也是系统的。只有必须带 title 的元素(iframe 的标题)例外;组件自己的 title 属性(大写开头)不算
files: ['webview-ui/src/**/*.tsx'],
rules: {
'no-restricted-syntax': ['error', 'TSEnumDeclaration[const=true]', 'TSExportAssignment', {
selector: 'JSXOpeningElement[name.name=/^[a-z]/]:not([name.name="iframe"]) > JSXAttribute[name.name="title"]',
message: '悬停提示写 data-tooltip(components/ui/tooltip.tsx 统一弹),不用原生 title;图标按钮的名字写 aria-label',
}],
},
},
)