import-js/eslint-plugin-import

Proposal: Warn on importing from a filename for which a directory also exists

Open

#919 geöffnet am 22. Aug. 2017

Auf GitHub ansehen
 (1 Kommentar) (1 Reaktion) (0 zugewiesene Personen)JavaScript (1.540 Forks)batch import
acceptedhelp wantedrule proposal

Repository-Metriken

Stars
 (4.946 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 138T 22h) (3 gemergte PRs in 30 T)

Beschreibung

For example, let's say I have the following files:

| something/
|-- index.js
| something.js
| main.js

Inside main.js, I have the following code:

import { helpfulFunction } from './something';

// do something with helpfulFunction()

This is a little dangerous, because did I mean ./something or ./something/? I don't think code should be split up like this—in this case, I would take the contents of something.js and move them to something/index.js and just import from there. A warning would be helpful to track down cases like this.

Contributor Guide