-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #116 from benmosher/webpack-resolver
Webpack resolver!
- Loading branch information
Showing
44 changed files
with
844 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ rules: | |
curly: [2, "multi-line"] | ||
comma-dangle: [2, always-multiline] | ||
eqeqeq: [2, "allow-null"] | ||
no-shadow: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# files | ||
src/ | ||
reports/ | ||
resolvers/ | ||
|
||
# config | ||
.eslintrc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
env: | ||
es6: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# eslint-import-resolver-node | ||
|
||
[![npm](https://img.shields.io/npm/v/eslint-import-resolver-node.svg)](https://www.npmjs.com/package/eslint-import-resolver-node) | ||
|
||
Default Node-style module resolution plugin for [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import). | ||
|
||
Published separately to allow pegging to a specific version in case of breaking | ||
changes. | ||
|
||
Config is passed directly through to [`resolve`](https://www.npmjs.com/package/resolve#resolve-sync-id-opts) as options: | ||
|
||
```yaml | ||
settings: | ||
import/resolver: | ||
node: | ||
extensions: | ||
# if unset, default is just '.js', but it must be re-added explicitly if set | ||
- .js | ||
- .jsx | ||
- .es6 | ||
- .coffee | ||
|
||
paths: | ||
# an array of absolute paths which will also be searched | ||
# think NODE_PATH | ||
- /usr/local/share/global_modules | ||
|
||
# this is technically for identifying `node_modules` alternate names | ||
moduleDirectory: | ||
|
||
- node_modules # defaults to 'node_modules', but... | ||
- bower_components | ||
|
||
- project/src # can add a path segment here that will act like | ||
# a source root, for in-project aliasing (i.e. | ||
# `import MyStore from 'stores/my-store'`) | ||
``` | ||
|
||
or to use the default options: | ||
|
||
```yaml | ||
settings: | ||
import/resolver: node | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var resolve = require('resolve') | ||
, path = require('path') | ||
, assign = require('object-assign') | ||
|
||
exports.resolveImport = function resolveImport(source, file, config) { | ||
if (resolve.isCore(source)) return null | ||
|
||
return resolve.sync(source, opts(path.dirname(file), config)) | ||
} | ||
|
||
function opts(basedir, config) { | ||
return assign( {} | ||
, config | ||
, { basedir: basedir } | ||
) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "eslint-import-resolver-node", | ||
"version": "0.1.0", | ||
"description": "Node default behavior import resolution plugin for eslint-plugin-import.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/benmosher/eslint-plugin-import" | ||
}, | ||
"keywords": [ | ||
"eslint", | ||
"eslintplugin", | ||
"esnext", | ||
"modules", | ||
"eslint-plugin-import" | ||
], | ||
"author": "Ben Mosher ([email protected])", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/benmosher/eslint-plugin-import/issues" | ||
}, | ||
"homepage": "https://github.com/benmosher/eslint-plugin-import", | ||
"dependencies": { | ||
"object-assign": "^4.0.1", | ||
"resolve": "^1.1.6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "presets": ["es2015"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test/ | ||
.babelrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# eslint-import-resolver-webpack | ||
|
||
[![npm](https://img.shields.io/npm/v/eslint-import-resolver-webpack.svg)](https://www.npmjs.com/package/eslint-import-resolver-webpack) | ||
|
||
Webpack-literate module resolution plugin for [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import). | ||
|
||
Published separately to allow pegging to a specific version in case of breaking | ||
changes. | ||
|
||
Will look for `webpack.config.js` as a sibling of the first ancestral `package.json`, | ||
or a `config` parameter may be provided with another filename/path relative to the | ||
`package.json`. | ||
|
||
```yaml | ||
--- | ||
settings: | ||
import/resolver: webpack # take all defaults | ||
``` | ||
or with explicit config file name: | ||
```yaml | ||
--- | ||
settings: | ||
import/resolver: | ||
webpack: { config: 'webpack.dev.config.js' } | ||
``` |
Oops, something went wrong.