import-js/eslint-plugin-import

New rules regarding namespaces used as values

开放

#532 创建于 2016年8月29日

 (8 条评论) (1 个反应) (0 位负责人)JavaScript (1,549 个派生)batch import
acceptedhelp wantedrule proposalsemver-minor

仓库指标

星标
 (5,939 个星标)
PR 合并指标
 (平均合并 138天 22小时) (30 天内合并 3 个 PR)

描述

The following patterns are considered not warnings:

import * as foo from "./foo";

foo.bar();
const baz = foo.baz;
const {property} = foo;

The following patterns are considered warnings:

import * as foo from "./foo";

foo();
const [value] = foo;
func(foo);
func(...foo);
const alias = foo;
const {child} = foo; // foo.child is an exported namespace

Basically, warn if a namespace is used in a way that cannot be validated (aliased, called, destructured as array, passed as argument, etc.). There's no overlap with namespace.allowComputed in the above, but that option could be merged into this one, or these merged into another namespace option.

贡献者指南