在 ES2015 导入方面,IntelliJ 格式化和 TSLint 已成定局
IntelliJ formatting and TSLint are in clinche when it comes to ES2015 imports
我在 IntelliJ 中有一个 TypeScript 文件。该文件由 TSLint 观察。不幸的是,我们通常在 IntelliJ 中使用 "ctrl + alt + L" 格式。这当前更改了 ES2015 导入:
import {component} from 'library';
至
import {component} from "library";
请注意,库周围的“”已替换为“”。
但是,TSLint 不喜欢第二种形式,建议将“”替换为''。这会造成无限循环 :)
如何告诉 IntelliJ 使用“”而不是“”格式化导入?
对于2016.3.x,在Preferences | Editor | Code Style | TypeScript
、Other/Generated Code/Quote Marks
中选择"Single quote"
对于 2017.1,您需要将 Preferences | Editor | Code Style | TypeScript | Punctuation
更改为 Use <single> quotes <always>
我在 IntelliJ 中有一个 TypeScript 文件。该文件由 TSLint 观察。不幸的是,我们通常在 IntelliJ 中使用 "ctrl + alt + L" 格式。这当前更改了 ES2015 导入:
import {component} from 'library';
至
import {component} from "library";
请注意,库周围的“”已替换为“”。
但是,TSLint 不喜欢第二种形式,建议将“”替换为''。这会造成无限循环 :)
如何告诉 IntelliJ 使用“”而不是“”格式化导入?
对于2016.3.x,在Preferences | Editor | Code Style | TypeScript
、Other/Generated Code/Quote Marks
对于 2017.1,您需要将 Preferences | Editor | Code Style | TypeScript | Punctuation
更改为 Use <single> quotes <always>