eslint-plugin-front-require-in-package
Advanced tools
Comparing version 1.0.3-1 to 1.0.3-2
@@ -13,8 +13,17 @@ var findup = require('findup-sync'); | ||
return { | ||
"ImportDeclaration": function (node) { | ||
var requirePath = node.source.value; | ||
"CallExpression": function (node) { | ||
if (node.callee.name !== "require") | ||
return; | ||
var requirePath = node.arguments | ||
&& node.arguments.length > 0 | ||
&& node.arguments[0].value; | ||
if (!requirePath) | ||
return; | ||
// Don't worry about relative paths or built ins | ||
if (isRelativePath(requirePath) || isBuiltInModule(requirePath)) { | ||
if (isRelativePath(requirePath) || isBuiltInModule(requirePath)) | ||
return; | ||
} | ||
var pkg = getLocalPackageJson(context.getFilename()); | ||
@@ -26,3 +35,3 @@ if (pkg) { | ||
context.report(node, 'dependency not in the local package.json', { | ||
dependency: node.source.value | ||
dependency: requirePath | ||
}); | ||
@@ -29,0 +38,0 @@ } |
{ | ||
"name": "eslint-plugin-front-require-in-package", | ||
"version": "1.0.3-1", | ||
"version": "1.0.3-2", | ||
"description": "ESLint rule that validates ES6 imports are defined in local package.json", | ||
@@ -5,0 +5,0 @@ "repository": { |
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
5716
90