Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-simple-import-sort

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-simple-import-sort - npm Package Compare versions

Comparing version 8.0.0 to 9.0.0-beta.1

46

exports.js

@@ -17,17 +17,35 @@ "use strict";

},
create: (context) => ({
Program: (programNode) => {
const sourceCode = context.getSourceCode();
for (const chunk of shared.extractChunks(programNode, (node, lastNode) =>
isPartOfChunk(node, lastNode, sourceCode)
)) {
maybeReportChunkSorting(chunk, context);
create: (context) => {
const parents = new Set();
const addParent = (node) => {
if (isExportFrom(node)) {
parents.add(node.parent);
}
},
ExportNamedDeclaration: (node) => {
if (node.source == null && node.declaration == null) {
maybeReportExportSpecifierSorting(node, context);
}
},
}),
};
return {
ExportNamedDeclaration: (node) => {
if (node.source == null && node.declaration == null) {
maybeReportExportSpecifierSorting(node, context);
} else {
addParent(node);
}
},
ExportAllDeclaration: addParent,
"Program:exit": () => {
const sourceCode = context.getSourceCode();
for (const parent of parents) {
for (const chunk of shared.extractChunks(parent, (node, lastNode) =>
isPartOfChunk(node, lastNode, sourceCode)
)) {
maybeReportChunkSorting(chunk, context);
}
}
parents.clear();
},
};
},
};

@@ -34,0 +52,0 @@

@@ -51,12 +51,23 @@ "use strict";

const { groups: rawGroups = defaultGroups } = context.options[0] || {};
const outerGroups = rawGroups.map((groups) =>
groups.map((item) => RegExp(item, "u"))
);
const parents = new Set();
return {
Program: (programNode) => {
for (const chunk of shared.extractChunks(programNode, (node) =>
isImport(node) ? "PartOfChunk" : "NotPartOfChunk"
)) {
maybeReportChunkSorting(chunk, context, outerGroups);
ImportDeclaration: (node) => {
parents.add(node.parent);
},
"Program:exit": () => {
for (const parent of parents) {
for (const chunk of shared.extractChunks(parent, (node) =>
isImport(node) ? "PartOfChunk" : "NotPartOfChunk"
)) {
maybeReportChunkSorting(chunk, context, outerGroups);
}
}
parents.clear();
},

@@ -63,0 +74,0 @@ };

{
"name": "eslint-plugin-simple-import-sort",
"version": "8.0.0",
"version": "9.0.0-beta.1",
"license": "MIT",

@@ -5,0 +5,0 @@ "author": "Simon Lydell",

@@ -5,3 +5,3 @@ "use strict";

// and whitespace between.
function extractChunks(programNode, isPartOfChunk) {
function extractChunks(parentNode, isPartOfChunk) {
const chunks = [];

@@ -11,3 +11,3 @@ let chunk = [];

for (const node of programNode.body) {
for (const node of parentNode.body) {
const result = isPartOfChunk(node, lastNode);

@@ -14,0 +14,0 @@ switch (result) {

Sorry, the diff of this file is not supported yet

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