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

Check for importing named exports from CJS module

Open
#928 8 comments 2 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
JavaScript
Stars
5.9k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

With the new node.js 8.5 ESM support importing CJS modules as if they had named exports is not supported. (Unlike Babel)

Eg:

```js
// bad
import { get } from 'lodash';

//good
import _ from 'lodash';
const get = _.get;

//good
import { get } from 'lodash-es';
```

Contributor guide

Open the contributing guide

Research direction

The issue provides JavaScript import examples and names Node.js 8.5, CommonJS, ESM, Babel, lodash, and lodash-es, but no repository file or test. Start by locating the existing rule or tests for named imports from CommonJS modules. Done means the lodash-style import is flagged while default-import property access and named imports from lodash-es remain allowed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
tooling
Issue type
Feature
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.