import-js/eslint-plugin-import

[no-restricted-paths] Add options to ignore type imports

Open

#1,899 建立於 2020年9月14日

在 GitHub 查看
 (7 留言) (9 反應) (0 負責人)JavaScript (4,946 star) (1,540 fork)batch import
enhancementhelp wantedtypescript

描述

Can an option be added to the no-restricted-paths rule to ignore TypeScript's type imports?

// Allow this.
import type { T } from 'some/restricted/path';

// While still disallowing this.
import { foo } from 'some/restricted/path';

My proposal is to add an option at the top level of the config called something along the lines of allowedImportKinds which can be set to any number of the following options: "type" or "value". Additionally, this option could be available in each "zone" so that individual zones can override this behavior (but this may not be needed).

I haven't touched this project's code base before but I can probably whip up a PR for this.

貢獻者指南

[no-restricted-paths] Add options to ignore type imports · import-js/eslint-plugin-import#1899 | Good First Issue