eslint-plugin-import
Advanced tools
Comparing version 0.7.7 to 0.7.8
@@ -9,2 +9,4 @@ 'use strict'; | ||
var CASE_INSENSITIVE = fs.existsSync(path.join(__dirname, 'reSOLVE.js')); | ||
// http://stackoverflow.com/a/27382838 | ||
@@ -19,4 +21,7 @@ function fileExistsWithCaseSync(_x) { | ||
// shortcut exit | ||
if (!fs.existsSync(filepath)) return false; | ||
var dir = path.dirname(filepath); | ||
if (dir === '/' || dir === '.') return true; | ||
if (dir === '/' || dir === '.' || /^[A-Z]:\\$/.test(dir)) return true; | ||
var filenames = fs.readdirSync(dir); | ||
@@ -32,2 +37,10 @@ if (filenames.indexOf(path.basename(filepath)) === -1) { | ||
function fileExists(filepath) { | ||
if (CASE_INSENSITIVE) { | ||
return fileExistsWithCaseSync(filepath); | ||
} else { | ||
return fs.existsSync(filepath); | ||
} | ||
} | ||
function opts(basedir, settings) { | ||
@@ -45,6 +58,8 @@ // pulls all items from 'import/resolve' | ||
module.exports = function (p, context) { | ||
// resolve just returns the core module id, which won't appear to exist | ||
if (resolve.isCore(p)) return p; | ||
try { | ||
var file = resolve.sync(p, opts(path.dirname(context.getFilename()), context.settings)); | ||
if (!fileExistsWithCaseSync(file)) return null; | ||
if (!fileExists(file)) return null; | ||
return file; | ||
@@ -64,3 +79,3 @@ } catch (err) { | ||
var file = resolve.sync(p, opts(path.dirname(r), settings)); | ||
if (!fileExistsWithCaseSync(file)) return null; | ||
if (!fileExists(file)) return null; | ||
return file; | ||
@@ -67,0 +82,0 @@ } catch (err) { |
@@ -5,12 +5,20 @@ /** | ||
*/ | ||
'use strict'; | ||
var resolve = require('../core/resolve'); | ||
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default']; | ||
module.exports = function (context) { | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
var _coreResolve = require('../core/resolve'); | ||
var _coreResolve2 = _interopRequireDefault(_coreResolve); | ||
exports['default'] = function (context) { | ||
function checkSource(node) { | ||
if (node.source == null) return; | ||
if (resolve(node.source.value, context) == null) { | ||
if ((0, _coreResolve2['default'])(node.source.value, context) == null) { | ||
context.report(node.source, 'Unable to resolve path to module \'' + node.source.value + '\'.'); | ||
@@ -25,2 +33,4 @@ } | ||
}; | ||
}; | ||
}; | ||
module.exports = exports['default']; |
{ | ||
"name": "eslint-plugin-import", | ||
"version": "0.7.7", | ||
"version": "0.7.8", | ||
"description": "Import with sanity.", | ||
@@ -11,5 +11,7 @@ "main": "lib/index.js", | ||
"watch": "babel -d lib/ src/ --watch & mocha --recursive --reporter dot --compilers js:babel/register --watch tests/src/", | ||
"test": "eslint ./src && istanbul cover --dir reports/coverage _mocha tests/src/ -- --recursive --reporter dot --compilers js:babel/register", | ||
"cover": "eslint ./src && istanbul cover --dir reports/coverage _mocha tests/src/ -- --recursive --reporter dot --compilers js:babel/register", | ||
"test": "mocha --timeout 5000 --recursive --reporter dot --compilers js:babel/register tests/src/", | ||
"compile": "babel -d lib/ src/", | ||
"prepublish": "npm run compile" | ||
"prepublish": "npm run compile", | ||
"pretest": "eslint ./src" | ||
}, | ||
@@ -39,4 +41,3 @@ "repository": { | ||
"chai": "^2.2.0", | ||
"eslint": ">=0.16.0", | ||
"eslint-tester": ">=0.6.0", | ||
"eslint": "^1.1.0", | ||
"istanbul": "^0.3.17", | ||
@@ -46,3 +47,3 @@ "mocha": "^2.2.1" | ||
"peerDependencies": { | ||
"eslint": ">=0.16.0 || ~1.0.0-rc-0" | ||
"eslint": ">=0.16.0" | ||
}, | ||
@@ -49,0 +50,0 @@ "dependencies": { |
eslint-plugin-import | ||
--- | ||
[![build status](https://travis-ci.org/benmosher/eslint-plugin-import.svg)](https://travis-ci.org/benmosher/eslint-plugin-import) | ||
[![build status](https://travis-ci.org/benmosher/eslint-plugin-import.svg?branch=master)](https://travis-ci.org/benmosher/eslint-plugin-import) | ||
[![win32 build status](https://ci.appveyor.com/api/projects/status/3mw2fifalmjlqf56/branch/master?svg=true)](https://ci.appveyor.com/project/benmosher/eslint-plugin-import/branch/master) | ||
[![npm](https://img.shields.io/npm/v/eslint-plugin-import.svg)](https://www.npmjs.com/package/eslint-plugin-import) | ||
@@ -5,0 +6,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33526
6
20
611
255