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

default rule not being triggered with webpack resolver

Open
#780 0 comments 0 reactions 0 assignees View on GitHub
package: resolver/webpack question
Dominant language
JavaScript
Stars
5.9k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

When the `default` rule is applied, the resolved module with my current webpack setup is always evaluated as `null` [here](https://github.com/benmosher/eslint-plugin-import/blob/master/src/rules/default.js#L22)

```javascript
// src/rules/default.js
var imports = Exports.get(node.source.value, context)
if (imports == null) return
```

Since the imports variable is always `null`, the `default` rule never gets a chance to be evaluated.

For whatever reason, I can't figure out which combination of resolvers / webpack settings to use to get my modules to load correctly in the plugin... Any insight would be greatly appreciated!

Current eslintrc.yml
```yaml
parser: 'babel-eslint'
ecmaFeatures:
modules: true
jsx: true
parserOptions:
ecmaFeatures:
jsx: true
experimentalObjectRestSpread: true
sourceType: 'module'
ecmaVersion: 6
env:
browser: true
es6: true
jest: true
node: true
plugins: [ 'react', 'import' ]

settings:
import/resolver:
webpack:
config: './webpack.dev.js'
...
```

Contributor guide

Open the contributing guide

Research direction

Start with src/rules/default.js at line 22 and inspect how the webpack resolver is configured through the shown eslintrc.yml settings and webpack.dev.js. Reproduce the null result with the documented resolver setup, then verify that the default rule is evaluated with the resolved module instead of being skipped.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, webpack
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.