如何在 eslint 中为 date-fns 设置导入多次规则?

How to set up imported multiple times rule for date-fns in eslint?

我正在使用这样的 date-fns 函数导入:

import addHours from 'date-fns/addHours';
import addDays from 'date-fns/addDays';

但我也从 eslint 收到一个错误: node_modules/date-fns/typings.d.ts' imported multiple times.eslintimport/no-duplicates

怎么了?不是多次导入,我是从不同级别导入的。

如何在不禁用多重导入规则的情况下修复它?

这是 date-fns 库的已知问题

这是问题所在

  1. [Typescript] I can't import the translation (locale) of the terms in typescript.

  2. Is there any good way to import locale and other function within one line?