// @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', }], }, }, )