Added logging, changed some directory structure

This commit is contained in:
2018-01-13 21:33:40 -05:00
parent f079a5f067
commit 8e72ffb917
73656 changed files with 35284 additions and 53718 deletions

View File

@@ -0,0 +1,45 @@
# Change Log
All notable changes to this resolver will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
This change log adheres to standards from [Keep a CHANGELOG](http://keepachangelog.com).
## Unreleased
## v0.3.1 - 2017-06-23
### Changed
- bumped `debug` dep to match other packages
## v0.3.0 - 2016-12-15
### Changed
- bumped `resolve` to fix issues with Node builtins (thanks [@SkeLLLa] and [@ljharb])
### Fixed
- use `files` in `package.json` to ship only `index.js` ([#531], thanks for noticing [@lukeapage])
## v0.2.3 - 2016-08-20
### Added
- debug logging (use `DEBUG=eslint-plugin-import:resolver:node eslint [...]`)
## v0.2.2 - 2016-07-14
### Fixed
- Node resolver no longer declares the import plugin as a `peerDependency`. See [#437]
for a well-articulated and thoughtful expression of why this doesn't make sense.
Thanks [@jasonkarns] for the issue and the PR to fix it ([#438]).
Also, apologies to the others who expressed this before, but I never understood
what the problem was.😅
## v0.2.1
### Fixed
- find files with `.json` extensions (#333, thanks for noticing @jfmengels)
[#438]: https://github.com/benmosher/eslint-plugin-import/pull/438
[#531]: https://github.com/benmosher/eslint-plugin-import/issues/531
[#437]: https://github.com/benmosher/eslint-plugin-import/issues/437
[@jasonkarns]: https://github.com/jasonkarns
[@lukeapage]: https://github.com/lukeapage
[@SkeLLLa]: https://github.com/SkeLLLa
[@ljharb]: https://github.com/ljharb

View File

@@ -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
```

View File

@@ -0,0 +1,46 @@
var resolve = require('resolve')
, path = require('path')
var log = require('debug')('eslint-plugin-import:resolver:node')
exports.interfaceVersion = 2
exports.resolve = function (source, file, config) {
log('Resolving:', source, 'from:', file)
var resolvedPath
if (resolve.isCore(source)) {
log('resolved to core')
return { found: true, path: null }
}
try {
resolvedPath = resolve.sync(source, opts(file, config))
log('Resolved to:', resolvedPath)
return { found: true, path: resolvedPath }
} catch (err) {
log('resolve threw error:', err)
return { found: false }
}
}
function opts(file, config) {
return Object.assign({
// more closely matches Node (#333)
extensions: ['.js', '.json'],
},
config,
{
// path.resolve will handle paths relative to CWD
basedir: path.dirname(path.resolve(file)),
packageFilter: packageFilter,
})
}
function packageFilter(pkg) {
if (pkg['jsnext:main']) {
pkg['main'] = pkg['jsnext:main']
}
return pkg
}

View File

@@ -0,0 +1,69 @@
{
"_args": [
[
"eslint-import-resolver-node@0.3.1",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "eslint-import-resolver-node@0.3.1",
"_id": "eslint-import-resolver-node@0.3.1",
"_inBundle": false,
"_integrity": "sha512-yUtXS15gIcij68NmXmP9Ni77AQuCN0itXbCc/jWd8C6/yKZaSNXicpC8cgvjnxVdmfsosIXrjpzFq7GcDryb6A==",
"_location": "/react-scripts/eslint-import-resolver-node",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "eslint-import-resolver-node@0.3.1",
"name": "eslint-import-resolver-node",
"escapedName": "eslint-import-resolver-node",
"rawSpec": "0.3.1",
"saveSpec": null,
"fetchSpec": "0.3.1"
},
"_requiredBy": [
"/react-scripts/eslint-plugin-import"
],
"_resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.1.tgz",
"_spec": "0.3.1",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"author": {
"name": "Ben Mosher",
"url": "me@benmosher.com"
},
"bugs": {
"url": "https://github.com/benmosher/eslint-plugin-import/issues"
},
"dependencies": {
"debug": "^2.6.8",
"resolve": "^1.2.0"
},
"description": "Node default behavior import resolution plugin for eslint-plugin-import.",
"devDependencies": {
"chai": "^3.4.1",
"mocha": "^2.3.4",
"nyc": "^7.0.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/benmosher/eslint-plugin-import",
"keywords": [
"eslint",
"eslintplugin",
"esnext",
"modules",
"eslint-plugin-import"
],
"license": "MIT",
"main": "index.js",
"name": "eslint-import-resolver-node",
"repository": {
"type": "git",
"url": "git+https://github.com/benmosher/eslint-plugin-import.git"
},
"scripts": {
"test": "nyc mocha"
},
"version": "0.3.1"
}