- 看板剩下的原生 title(顶栏按钮、工单卡片、工单详情、会话、Profile 表、改动文件树和 diff、属性表)全部改成 data-tooltip, 禁用的按钮照样弹;只有图标、原来只靠 title 当名字的(审查勾、生成说明、属性说明的 i 图标、没头像的归属人)补上 aria-label - 提示框按原文换行:摘修复弹框里「迁移」列的几个文件一行一个 - 代码阅读 Markdown 链接的标题写成 data-tooltip - eslint 规则:网页 TSX 的 DOM 元素上写 title 报错,iframe 和组件自己的 title 属性不算
37 lines
1.4 KiB
JavaScript
37 lines
1.4 KiB
JavaScript
// @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',
|
||
}],
|
||
},
|
||
},
|
||
)
|