【问题标题】:am4themes_animated ESlint error for importam4themes_animated ESlint 导入错误
【发布时间】:2022-01-12 16:57:41
【问题描述】:

我在我的 Angular 项目中使用 am4themes_animated,并且正在转向 eslint 而不是 tslint。

import am4themes_animated from '@amcharts/amcharts4/themes/animated';

但是,ESlint 给出以下错误。

Identifier 'am4themes_animated' is not in camel case camelcase

我曾尝试使用像 import am4themes_animated as am4themesAnimated from '@amcharts/amcharts4/themes/animated'; 这样的别名,但它不允许这样做。

这可能是一个非常新手的问题,但如果有人可以提供帮助,我将不胜感激。谢谢。 (这里是我的第一个问题,边走边学,如有错误请见谅)

更新:

import * as am4themesAnimated 不起作用,因为我需要将常量作为这样的参数传递:am4core.useTheme(am4themes_animated);

【问题讨论】:

  • 你可以试试import * as am4themesAnimated from '@amcharts/amcharts4/themes/animated';
  • 您好,尝试了您的方法,但不起作用。 am4themes_animated 将在此处作为参数(类型为 ITheme)传递:am4core.useTheme(am4themes_animated);

标签: angular typescript eslint typescript-eslint


【解决方案1】:

仅通过参考 am4Charts Themes 文档即可解决问题。 我们基本上可以为我们导入的主题命名任何我们想要的名称。

【讨论】:

  • 回答需要您实现的示例代码的支持信息。
猜你喜欢
  • 2021-02-08
  • 2016-06-20
  • 2020-06-29
  • 2017-07-04
  • 2022-12-03
  • 2023-02-25
  • 1970-01-01
  • 2019-01-05
  • 1970-01-01
相关资源
最近更新 更多