Skip to content

Commit fa51327

Browse files
committed
consistent-type-imports
1 parent 6354760 commit fa51327

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

module.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,16 @@ TypeScriptはインポートしたものが型だけの場合に、出力から
425425

426426
インポートだけではなく、\ ``export type { A, B } from "./modules";``\ といった、インポートして即エクスポートする文においては、\ ``export``\ にも利用できます。
427427

428-
現在リリースされているtypescript-eslintにおいても、\ ``import type``\ を使う方が推奨値としてデフォルト設定されています\ [#]_\
428+
現在リリースされているtypescript-eslintの4.0以降においても、\ ``import type``\ を使うことを強制するルールが追加されました\ [#]_\ 。TypeScript 3.7以前ではすべてがエラーになってしまうため、デフォルトでは有効化されていません。
429+
430+
.. code-block:: json
431+
:caption: eslintrc.json
432+
433+
{
434+
"rules": {
435+
"@typescript-eslint/consistent-type-imports": "error"
436+
}
437+
}
429438
430439
.. [#] 他に迷惑な有名なライブラリとしては、Pythonのthisがあります。\ ``import this``\ をするとPythonの設計思想を表す詩が表示されます。
431440
.. [#] https://github.com/typescript-eslint/typescript-eslint/blob/v4.1.1/packages/eslint-plugin/docs/rules/consistent-type-imports.md

0 commit comments

Comments
 (0)