Socket
Socket
Sign inDemoInstall

eslint-plugin-import

Package Overview
Dependencies
Maintainers
1
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-import - npm Package Compare versions

Comparing version 0.3.6 to 0.3.8

files/umd.js

26

lib/getExports.js

@@ -37,9 +37,12 @@ "use strict";

parse(path).body.forEach(function (n) {
var ast = parse(path);
ast.body.forEach(function (n) {
m.captureDefault(n);
m.captureAll(n, path);
m.captureNamedDeclaration(n);
m.commonJs(n);
});
m.commonJs(ast);
return m;

@@ -88,21 +91,16 @@ };

// todo: capture names
ExportMap.prototype.commonJs = function (node) {
if (this.isCommon) return;
ExportMap.prototype.commonJs = function (ast) {
var map = this;
traverse(node, {
traverse(ast, {
fallback: "iteration",
enter: function (n) {
if (n.type !== "ExpressionStatement") return;
var expr = n.expression;
if (n.type !== "AssignmentExpression") return;
if (expr.type !== "AssignmentExpression") return;
if (n.operator !== "=") return;
if (n.left.type !== "MemberExpression") return;
if (expr.operator !== "=") return;
if (expr.left.type !== "MemberExpression") return;
if (n.left.object.type !== "Identifier") return;
if (expr.left.object.type !== "Identifier") return;
if (expr.left.object.name === "module" || expr.left.object.name === "exports") {
if (n.left.object.name === "module" || n.left.object.name === "exports") {
map.isCommon = true;

@@ -109,0 +107,0 @@ this.break();

{
"name": "eslint-plugin-import",
"version": "0.3.6",
"version": "0.3.8",
"description": "Import with sanity.",

@@ -10,3 +10,3 @@ "main": "index.js",

"scripts": {
"test": "mocha --recursive tests/"
"test": "mocha --reporter dot --recursive tests/"
},

@@ -13,0 +13,0 @@ "repository": {

@@ -15,2 +15,3 @@ eslint-plugin-import

* Ensure imported namespaces contain dereferenced properties as they are dereferenced. ([`namespace`](#namespace))
* Report assignments (at any scope) to imported names/namespaces. ([`no-reassign`](#no-reassign))

@@ -55,1 +56,4 @@ ## Rules

### `no-reassign`
Reports on assignment to an imported name (or a member of an imported namespace). Does not consider scope or shadowing, so failure to adhere to ESLint's `no-shadow` may result in spurious warnings.

@@ -24,4 +24,7 @@ "use strict";

test({code: "import {x} from './nested-common';",
errors: [{ message: "'./nested-common' is a CommonJS module."}]})
errors: [{ message: "'./nested-common' is a CommonJS module."}]}),
test({code: "import {x} from './umd';",
errors: [{ message: "'./umd' is a CommonJS module."}]})
]
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc