import-js / import-js/eslint-plugin-import
New rules regarding namespaces used as values
- Dominant language
- JavaScript
- Stars
- 5.9k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
The following patterns are considered not warnings:
``` js
import * as foo from "./foo";
foo.bar();
const baz = foo.baz;
const {property} = foo;
```
The following patterns are considered warnings:
``` js
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`](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/namespace.md#allowcomputed) in the above, but that option could be merged into this one, or these merged into another `namespace` option.
Contributor guide
Research direction
Review the existing namespace rule and its namespace.allowComputed option, then compare each listed usage against the requested warning behavior. Decide whether this belongs in a new option or a merged namespace option, and verify that accepted patterns remain non-warnings while unverifiable uses produce warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100