【问题标题】:Import sources within a group must be alphabetized (TS)组内的导入源必须按字母顺序排列 (TS)
【发布时间】:2018-07-05 07:49:01
【问题描述】:

我的 ts 文件中有导入源

这里是

import accounting from "accounting";
import { Feature } from "geojson";
import { GeoJsonProperties } from "geojson";
import { GeoJSONGeometry } from "mapbox-gl";
import Helpers from "../../common/helpers";
import { Layer } from "mapbox-gl";
import mapboxgl from "mapbox-gl";
import { Map } from "mapbox-gl";
import { Popup } from "mapbox-gl";
import { __ } from "../../common/translation";

但我的代码有错误

组内的导入源必须按字母顺序排列

我不明白为什么,因为都已经按字母顺序排列了?

我该如何解决这个问题?

【问题讨论】:

  • 你也可以运行tslint --fix --project .,它会按字母顺序重新排序导入。

标签: javascript typescript import codacy


【解决方案1】:

根据this answer

文件路径也用作排序的一部分...

这些是错误中引用的“来源”。您可以使用以下规则在 tslint.json 文件中禁用此功能:

"ordered-imports": false

【讨论】:

    猜你喜欢
    • 2018-11-25
    • 2019-03-12
    • 2019-05-10
    • 2019-08-10
    • 2018-12-08
    • 1970-01-01
    • 1970-01-01
    • 2019-07-31
    • 1970-01-01
    相关资源
    最近更新 更多