erikras / erikras/react-redux-universal-hot-example

eslint-plugin-import v0.12+: Webpack resolver, lint jsnext:main

Open
#704 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.1k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

FYI: I just published v0.12.0 of the `import` plugin for ESLint. With it (and the newest Webpack/Node resolvers) comes the ability to read the `jsnext:main` field of `node_modules` that provide it, and lint against the exports thereof.

Redux, amongst other packages, currently supports this field.

Just letting you know in case you want to try it out. 😅 I noticed the `package.json` is pegged to `^0.8.0`.

You may also be interested in leveraging the [Webpack resolver](https://www.npmjs.com/package/eslint-import-resolver-webpack), which can read a Webpack config for things like `resolve.moduleDirectories`, `resolve.root`, `resolve.extensions`, `externals`, and knows how to ignore inline loaders.

Would turn your existing import plugin settings in the `.eslintrc` from

``` json
"settings": {
"import/parser": "babel-eslint",
"import/resolve": {
"moduleDirectory": ["node_modules", "src"]
}
},
```

to

``` json
"settings": {
"import/parser": "babel-eslint",
"import/resolver": {
"webpack": { "config": "webpack/prod.config.js" }
}
},
```

assuming I understand your project correctly.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.