import-js / import-js/eslint-plugin-import

import/default failing on import of json file

Open
#429 5 comments 0 reactions 0 assignees View on GitHub
accepted enhancement help wanted semver-minor
Dominant language
JavaScript
Stars
5.9k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

Code:

``` javascript
import data from './data'
```

Relevant config:

``` javascript
"import/default": 2,
```

Error:

```
error No default export found in module
```

I'm not 100% certain, but I believe that node will allow importing of `json` files when the new module syntax is implemented. So this appears to be an error.

Contributor guide

Open the contributing guide

Research direction

Start with the import/default rule and reproduce the reported `import data from './data'` case using the shown `"import/default": 2` configuration and a JSON file. Check how the rule identifies module exports and how JSON imports are expected to behave. Done means the expected JSON import behavior is established and covered by a regression test without an erroneous default-export error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.