🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

eslint-plugin-import-x

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-import-x - npm Package Compare versions

Comparing version

to
3.1.0

1

lib/index.d.ts

@@ -144,2 +144,3 @@ import type { TSESLint } from '@typescript-eslint/utils';

unusedExports?: boolean | undefined;
ignoreUnusedTypeExports?: boolean | undefined;
}[], TSESLint.RuleListener>;

@@ -146,0 +147,0 @@ 'no-commonjs': TSESLint.RuleModule<"import" | "export", [(({

7

lib/rules/no-cycle.js

@@ -59,3 +59,2 @@ "use strict";

: () => false;
const scc = utils_1.StronglyConnectedComponents.get(filename, context);
return Object.assign(Object.assign({}, (0, utils_1.moduleVisitor)(function checkSourceValue(sourceNode, importer) {

@@ -84,8 +83,2 @@ if (ignoreModule(sourceNode.value)) {

}
if (scc) {
const hasDependencyCycle = scc[filename] === scc[imported.path];
if (!hasDependencyCycle) {
return;
}
}
const untraversed = [{ mget: () => imported, route: [] }];

@@ -92,0 +85,0 @@ function detectCycle({ mget, route }) {

@@ -6,2 +6,3 @@ type Options = {

unusedExports?: boolean;
ignoreUnusedTypeExports?: boolean;
};

@@ -8,0 +9,0 @@ type MessageId = 'notFound' | 'unused';

@@ -20,8 +20,9 @@ "use strict";

if (declaration) {
const isTypeDeclaration = declaration.type === AST_NODE_TYPES.TSInterfaceDeclaration ||
declaration.type === AST_NODE_TYPES.TSTypeAliasDeclaration ||
declaration.type === AST_NODE_TYPES.TSEnumDeclaration;
if (declaration.type === AST_NODE_TYPES.FunctionDeclaration ||
declaration.type === AST_NODE_TYPES.ClassDeclaration ||
declaration.type === AST_NODE_TYPES.TSInterfaceDeclaration ||
declaration.type === AST_NODE_TYPES.TSTypeAliasDeclaration ||
declaration.type === AST_NODE_TYPES.TSEnumDeclaration) {
cb(declaration.id.name);
isTypeDeclaration) {
cb(declaration.id.name, isTypeDeclaration);
}

@@ -33,3 +34,3 @@ else if (declaration.type === AST_NODE_TYPES.VariableDeclaration) {

if (pattern.type === AST_NODE_TYPES.Identifier) {
cb(pattern.name);
cb(pattern.name, false);
}

@@ -41,3 +42,3 @@ });

if ((el === null || el === void 0 ? void 0 : el.type) === AST_NODE_TYPES.Identifier) {
cb(el.name);
cb(el.name, false);
}

@@ -47,3 +48,3 @@ }

else {
cb(id.name);
cb(id.name, false);
}

@@ -288,2 +289,6 @@ }

},
ignoreUnusedTypeExports: {
description: 'ignore type exports without any usage',
type: 'boolean',
},
},

@@ -325,3 +330,3 @@ anyOf: [

create(context) {
const { src, ignoreExports = [], missingExports, unusedExports, } = context.options[0] || {};
const { src, ignoreExports = [], missingExports, unusedExports, ignoreUnusedTypeExports, } = context.options[0] || {};
if (unusedExports) {

@@ -336,2 +341,5 @@ doPreparation(src, ignoreExports, context);

}
if (ignoreUnusedTypeExports) {
return;
}
if (ignoredFiles.has(filename)) {

@@ -354,6 +362,9 @@ return;

};
const checkUsage = (node, exportedValue) => {
const checkUsage = (node, exportedValue, isTypeExport) => {
if (!unusedExports) {
return;
}
if (isTypeExport && ignoreUnusedTypeExports) {
return;
}
if (ignoredFiles.has(filename)) {

@@ -724,10 +735,10 @@ return;

ExportDefaultDeclaration(node) {
checkUsage(node, AST_NODE_TYPES.ImportDefaultSpecifier);
checkUsage(node, AST_NODE_TYPES.ImportDefaultSpecifier, false);
},
ExportNamedDeclaration(node) {
for (const specifier of node.specifiers) {
checkUsage(specifier, (0, utils_2.getValue)(specifier.exported));
checkUsage(specifier, (0, utils_2.getValue)(specifier.exported), false);
}
forEachDeclarationIdentifier(node.declaration, name => {
checkUsage(node, name);
forEachDeclarationIdentifier(node.declaration, (name, isTypeExport) => {
checkUsage(node, name, isTypeExport);
});

@@ -734,0 +745,0 @@ },

@@ -51,2 +51,1 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils';

export declare function recursivePatternCapture(pattern: TSESTree.Node, callback: (node: TSESTree.DestructuringPattern) => void): void;
export declare function childContext(path: string, context: RuleContext | ChildContext): ChildContext;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.childContext = exports.recursivePatternCapture = exports.ExportMap = void 0;
exports.recursivePatternCapture = exports.ExportMap = void 0;
const tslib_1 = require("tslib");

@@ -748,3 +748,2 @@ const node_fs_1 = tslib_1.__importDefault(require("node:fs"));

}
exports.childContext = childContext;
function makeContextCacheKey(context) {

@@ -751,0 +750,0 @@ var _a, _b, _c;

@@ -20,5 +20,4 @@ export * from './constants';

export * from './resolve';
export * from './scc';
export * from './static-require';
export * from './unambiguous';
export * from './visit';

@@ -23,3 +23,2 @@ "use strict";

tslib_1.__exportStar(require("./resolve"), exports);
tslib_1.__exportStar(require("./scc"), exports);
tslib_1.__exportStar(require("./static-require"), exports);

@@ -26,0 +25,0 @@ tslib_1.__exportStar(require("./unambiguous"), exports);

{
"name": "eslint-plugin-import-x",
"version": "3.0.1",
"version": "3.1.0",
"description": "Import with sanity.",

@@ -51,3 +51,2 @@ "repository": "git+https://github.com/un-ts/eslint-plugin-import-x",

"dependencies": {
"@rtsao/scc": "^1.1.0",
"@typescript-eslint/utils": "^7.4.0",

@@ -54,0 +53,0 @@ "debug": "^4.3.4",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet