mirror of
https://github.com/logancyang/obsidian-copilot.git
synced 2026-07-22 07:50:24 +00:00
chore(eslint): enable @typescript-eslint/unbound-method (#2439)
Enabled in the TS-only override block. Disabled for test files since jest assertion patterns (`expect(mock.method).toHaveBeenCalled()`) reference methods unbound by design and have no clean workaround. Fixed the single real source violation in colorOpacityPlugin by calling addUtilities through the plugin API object instead of destructuring it. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e3c5e24f1b
commit
020e24507c
2 changed files with 17 additions and 3 deletions
|
|
@ -92,7 +92,6 @@ export default [
|
|||
"@typescript-eslint/no-unsafe-call": "off", // 679 violations
|
||||
|
||||
// --- Medium: promise / method ergonomics ---
|
||||
"@typescript-eslint/unbound-method": "off", // 68 violations
|
||||
// Enabled in the TS-only block below.
|
||||
|
||||
// no-deprecated: defer — surface the warnings, but don't fail CI yet
|
||||
|
|
@ -173,6 +172,7 @@ export default [
|
|||
],
|
||||
"@typescript-eslint/no-floating-promises": "error",
|
||||
"@typescript-eslint/no-unsafe-return": "error",
|
||||
"@typescript-eslint/unbound-method": "error",
|
||||
// TypeScript handles undefined-identifier detection (and does so cross-realm
|
||||
// correctly); per typescript-eslint's own guidance, disable no-undef on TS.
|
||||
"no-undef": "off",
|
||||
|
|
@ -223,4 +223,17 @@ export default [
|
|||
"obsidianmd/rule-custom-message": "off",
|
||||
},
|
||||
},
|
||||
|
||||
// Jest assertions like `expect(mock.method).toHaveBeenCalled()` reference
|
||||
// methods unbound by design. The rule has no clean workaround for jest
|
||||
// patterns (binding changes the reference identity and breaks the assertion),
|
||||
// so disable it in tests. Scoped to .ts/.tsx because the @typescript-eslint
|
||||
// plugin is only registered for those files. Placed last so it overrides the
|
||||
// TS-only block above.
|
||||
{
|
||||
files: ["**/*.test.{ts,tsx}"],
|
||||
rules: {
|
||||
"@typescript-eslint/unbound-method": "off",
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -86,7 +86,8 @@ const processColorObject =
|
|||
* bg-modifier-error/50
|
||||
* text-background-modifier-success/30
|
||||
*/
|
||||
export const colorOpacityPlugin = plugin(function (this: void, { addUtilities, theme, e }) {
|
||||
export const colorOpacityPlugin = plugin(function (this: void, api) {
|
||||
const { theme, e } = api;
|
||||
const opacityUtilities: Record<string, any> = {};
|
||||
|
||||
// 处理所有颜色相关的主题配置
|
||||
|
|
@ -104,5 +105,5 @@ export const colorOpacityPlugin = plugin(function (this: void, { addUtilities, t
|
|||
processThemeColors("borderColor", "");
|
||||
processThemeColors("colors");
|
||||
|
||||
addUtilities(opacityUtilities);
|
||||
api.addUtilities(opacityUtilities);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue