import-js/eslint-plugin-import

New rules regarding namespaces used as values

Aberta

#532 aberto em 29 de ago. de 2016

 (8 comentários) (1 reação) (0 responsável)JavaScript (1.548 forks)batch import
acceptedhelp wantedrule proposalsemver-minor

Métricas do repositório

Stars
 (5.940 estrelas)
Métricas de merge de PR
 (Mesclagem média 138d 22h) (3 fundiu PRs em 30d)

Description

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.

Guia do colaborador