@plugjs/eslint-plugin 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/eslint-plugin-import-x.cjs +24 -103
- package/bundles/stylistic-eslint-plugin.cjs +641 -359
- package/package.json +11 -12
|
@@ -180,7 +180,7 @@ var require_package = __commonJS({
|
|
|
180
180
|
"node_modules/eslint-plugin-import-x/package.json"(exports2, module2) {
|
|
181
181
|
module2.exports = {
|
|
182
182
|
name: "eslint-plugin-import-x",
|
|
183
|
-
version: "3.0
|
|
183
|
+
version: "3.1.0",
|
|
184
184
|
description: "Import with sanity.",
|
|
185
185
|
repository: "git+https://github.com/un-ts/eslint-plugin-import-x",
|
|
186
186
|
author: "JounQin <admin@1stg.me> (https://www.1stG.me)",
|
|
@@ -228,7 +228,6 @@ var require_package = __commonJS({
|
|
|
228
228
|
eslint: "^8.56.0 || ^9.0.0-0"
|
|
229
229
|
},
|
|
230
230
|
dependencies: {
|
|
231
|
-
"@rtsao/scc": "^1.1.0",
|
|
232
231
|
"@typescript-eslint/utils": "^7.4.0",
|
|
233
232
|
debug: "^4.3.4",
|
|
234
233
|
doctrine: "^3.0.0",
|
|
@@ -955,7 +954,7 @@ var require_export_map = __commonJS({
|
|
|
955
954
|
"node_modules/eslint-plugin-import-x/lib/utils/export-map.js"(exports2) {
|
|
956
955
|
"use strict";
|
|
957
956
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
958
|
-
exports2.
|
|
957
|
+
exports2.recursivePatternCapture = exports2.ExportMap = void 0;
|
|
959
958
|
var tslib_12 = require("tslib");
|
|
960
959
|
var node_fs_1 = tslib_12.__importDefault(require("node:fs"));
|
|
961
960
|
var node_path_1 = tslib_12.__importDefault(require("node:path"));
|
|
@@ -1643,7 +1642,6 @@ var require_export_map = __commonJS({
|
|
|
1643
1642
|
filename: "physicalFilename" in context ? context.physicalFilename : context.filename
|
|
1644
1643
|
};
|
|
1645
1644
|
}
|
|
1646
|
-
exports2.childContext = childContext;
|
|
1647
1645
|
function makeContextCacheKey(context) {
|
|
1648
1646
|
var _a, _b, _c;
|
|
1649
1647
|
const { settings, parserPath, parserOptions, languageOptions } = context;
|
|
@@ -2068,86 +2066,6 @@ var require_module_visitor = __commonJS({
|
|
|
2068
2066
|
}
|
|
2069
2067
|
});
|
|
2070
2068
|
|
|
2071
|
-
// node_modules/eslint-plugin-import-x/lib/utils/scc.js
|
|
2072
|
-
var require_scc = __commonJS({
|
|
2073
|
-
"node_modules/eslint-plugin-import-x/lib/utils/scc.js"(exports2) {
|
|
2074
|
-
"use strict";
|
|
2075
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2076
|
-
exports2.StronglyConnectedComponents = void 0;
|
|
2077
|
-
var tslib_12 = require("tslib");
|
|
2078
|
-
var scc_1 = tslib_12.__importDefault(require("@rtsao/scc"));
|
|
2079
|
-
var export_map_1 = require_export_map();
|
|
2080
|
-
var resolve_1 = require_resolve();
|
|
2081
|
-
var cache = /* @__PURE__ */ new Map();
|
|
2082
|
-
exports2.StronglyConnectedComponents = {
|
|
2083
|
-
clearCache() {
|
|
2084
|
-
cache.clear();
|
|
2085
|
-
},
|
|
2086
|
-
get(source, context) {
|
|
2087
|
-
const path = (0, resolve_1.resolve)(source, context);
|
|
2088
|
-
if (path == null) {
|
|
2089
|
-
return null;
|
|
2090
|
-
}
|
|
2091
|
-
return exports2.StronglyConnectedComponents.for((0, export_map_1.childContext)(path, context));
|
|
2092
|
-
},
|
|
2093
|
-
for(context) {
|
|
2094
|
-
const cacheKey = context.cacheKey;
|
|
2095
|
-
if (cache.has(cacheKey)) {
|
|
2096
|
-
return cache.get(cacheKey);
|
|
2097
|
-
}
|
|
2098
|
-
const scc = exports2.StronglyConnectedComponents.calculate(context);
|
|
2099
|
-
cache.set(cacheKey, scc);
|
|
2100
|
-
return scc;
|
|
2101
|
-
},
|
|
2102
|
-
calculate(context) {
|
|
2103
|
-
const exportMap = export_map_1.ExportMap.for(context);
|
|
2104
|
-
const adjacencyList = exports2.StronglyConnectedComponents.exportMapToAdjacencyList(exportMap);
|
|
2105
|
-
const calculatedScc = (0, scc_1.default)(adjacencyList);
|
|
2106
|
-
return exports2.StronglyConnectedComponents.calculatedSccToPlainObject(calculatedScc);
|
|
2107
|
-
},
|
|
2108
|
-
exportMapToAdjacencyList(initialExportMap) {
|
|
2109
|
-
const adjacencyList = /* @__PURE__ */ new Map();
|
|
2110
|
-
function visitNode(exportMap) {
|
|
2111
|
-
if (!exportMap) {
|
|
2112
|
-
return;
|
|
2113
|
-
}
|
|
2114
|
-
for (const [importedPath, v] of exportMap.imports.entries()) {
|
|
2115
|
-
const from = exportMap.path;
|
|
2116
|
-
const to = importedPath;
|
|
2117
|
-
if (!adjacencyList.has(from)) {
|
|
2118
|
-
adjacencyList.set(from, /* @__PURE__ */ new Set());
|
|
2119
|
-
}
|
|
2120
|
-
const set = adjacencyList.get(from);
|
|
2121
|
-
if (set.has(to)) {
|
|
2122
|
-
continue;
|
|
2123
|
-
}
|
|
2124
|
-
set.add(to);
|
|
2125
|
-
visitNode(v.getter());
|
|
2126
|
-
}
|
|
2127
|
-
}
|
|
2128
|
-
visitNode(initialExportMap);
|
|
2129
|
-
adjacencyList.forEach((values) => {
|
|
2130
|
-
values.forEach((value) => {
|
|
2131
|
-
if (!adjacencyList.has(value)) {
|
|
2132
|
-
adjacencyList.set(value, /* @__PURE__ */ new Set());
|
|
2133
|
-
}
|
|
2134
|
-
});
|
|
2135
|
-
});
|
|
2136
|
-
return adjacencyList;
|
|
2137
|
-
},
|
|
2138
|
-
calculatedSccToPlainObject(sccs) {
|
|
2139
|
-
const obj = {};
|
|
2140
|
-
for (const [index, scc] of sccs.entries()) {
|
|
2141
|
-
for (const node of scc) {
|
|
2142
|
-
obj[node] = index;
|
|
2143
|
-
}
|
|
2144
|
-
}
|
|
2145
|
-
return obj;
|
|
2146
|
-
}
|
|
2147
|
-
};
|
|
2148
|
-
}
|
|
2149
|
-
});
|
|
2150
|
-
|
|
2151
2069
|
// node_modules/eslint-plugin-import-x/lib/utils/static-require.js
|
|
2152
2070
|
var require_static_require = __commonJS({
|
|
2153
2071
|
"node_modules/eslint-plugin-import-x/lib/utils/static-require.js"(exports2) {
|
|
@@ -2186,7 +2104,6 @@ var require_utils = __commonJS({
|
|
|
2186
2104
|
tslib_12.__exportStar(require_pkg_up(), exports2);
|
|
2187
2105
|
tslib_12.__exportStar(require_read_pkg_up(), exports2);
|
|
2188
2106
|
tslib_12.__exportStar(require_resolve(), exports2);
|
|
2189
|
-
tslib_12.__exportStar(require_scc(), exports2);
|
|
2190
2107
|
tslib_12.__exportStar(require_static_require(), exports2);
|
|
2191
2108
|
tslib_12.__exportStar(require_unambiguous(), exports2);
|
|
2192
2109
|
tslib_12.__exportStar(require_visit(), exports2);
|
|
@@ -4294,7 +4211,6 @@ var require_no_cycle = __commonJS({
|
|
|
4294
4211
|
const options = context.options[0] || {};
|
|
4295
4212
|
const maxDepth = typeof options.maxDepth === "number" ? options.maxDepth : Number.POSITIVE_INFINITY;
|
|
4296
4213
|
const ignoreModule = options.ignoreExternal ? (name) => (0, utils_1.isExternalModule)(name, (0, utils_1.resolve)(name, context), context) : () => false;
|
|
4297
|
-
const scc = utils_1.StronglyConnectedComponents.get(filename, context);
|
|
4298
4214
|
return Object.assign(Object.assign({}, (0, utils_1.moduleVisitor)(function checkSourceValue(sourceNode, importer) {
|
|
4299
4215
|
if (ignoreModule(sourceNode.value)) {
|
|
4300
4216
|
return;
|
|
@@ -4312,12 +4228,6 @@ var require_no_cycle = __commonJS({
|
|
|
4312
4228
|
if (imported.path === filename) {
|
|
4313
4229
|
return;
|
|
4314
4230
|
}
|
|
4315
|
-
if (scc) {
|
|
4316
|
-
const hasDependencyCycle = scc[filename] === scc[imported.path];
|
|
4317
|
-
if (!hasDependencyCycle) {
|
|
4318
|
-
return;
|
|
4319
|
-
}
|
|
4320
|
-
}
|
|
4321
4231
|
const untraversed = [{ mget: () => imported, route: [] }];
|
|
4322
4232
|
function detectCycle({ mget, route }) {
|
|
4323
4233
|
const m = mget();
|
|
@@ -6471,24 +6381,25 @@ var require_no_unused_modules = __commonJS({
|
|
|
6471
6381
|
var { AST_NODE_TYPES } = utils_1.TSESTree;
|
|
6472
6382
|
function forEachDeclarationIdentifier(declaration, cb) {
|
|
6473
6383
|
if (declaration) {
|
|
6474
|
-
|
|
6475
|
-
|
|
6384
|
+
const isTypeDeclaration = declaration.type === AST_NODE_TYPES.TSInterfaceDeclaration || declaration.type === AST_NODE_TYPES.TSTypeAliasDeclaration || declaration.type === AST_NODE_TYPES.TSEnumDeclaration;
|
|
6385
|
+
if (declaration.type === AST_NODE_TYPES.FunctionDeclaration || declaration.type === AST_NODE_TYPES.ClassDeclaration || isTypeDeclaration) {
|
|
6386
|
+
cb(declaration.id.name, isTypeDeclaration);
|
|
6476
6387
|
} else if (declaration.type === AST_NODE_TYPES.VariableDeclaration) {
|
|
6477
6388
|
for (const { id } of declaration.declarations) {
|
|
6478
6389
|
if (id.type === AST_NODE_TYPES.ObjectPattern) {
|
|
6479
6390
|
(0, utils_2.recursivePatternCapture)(id, (pattern) => {
|
|
6480
6391
|
if (pattern.type === AST_NODE_TYPES.Identifier) {
|
|
6481
|
-
cb(pattern.name);
|
|
6392
|
+
cb(pattern.name, false);
|
|
6482
6393
|
}
|
|
6483
6394
|
});
|
|
6484
6395
|
} else if (id.type === AST_NODE_TYPES.ArrayPattern) {
|
|
6485
6396
|
for (const el of id.elements) {
|
|
6486
6397
|
if ((el === null || el === void 0 ? void 0 : el.type) === AST_NODE_TYPES.Identifier) {
|
|
6487
|
-
cb(el.name);
|
|
6398
|
+
cb(el.name, false);
|
|
6488
6399
|
}
|
|
6489
6400
|
}
|
|
6490
6401
|
} else {
|
|
6491
|
-
cb(id.name);
|
|
6402
|
+
cb(id.name, false);
|
|
6492
6403
|
}
|
|
6493
6404
|
}
|
|
6494
6405
|
}
|
|
@@ -6718,6 +6629,10 @@ var require_no_unused_modules = __commonJS({
|
|
|
6718
6629
|
unusedExports: {
|
|
6719
6630
|
description: "report exports without any usage",
|
|
6720
6631
|
type: "boolean"
|
|
6632
|
+
},
|
|
6633
|
+
ignoreUnusedTypeExports: {
|
|
6634
|
+
description: "ignore type exports without any usage",
|
|
6635
|
+
type: "boolean"
|
|
6721
6636
|
}
|
|
6722
6637
|
},
|
|
6723
6638
|
anyOf: [
|
|
@@ -6755,7 +6670,7 @@ var require_no_unused_modules = __commonJS({
|
|
|
6755
6670
|
},
|
|
6756
6671
|
defaultOptions: [],
|
|
6757
6672
|
create(context) {
|
|
6758
|
-
const { src, ignoreExports = [], missingExports, unusedExports } = context.options[0] || {};
|
|
6673
|
+
const { src, ignoreExports = [], missingExports, unusedExports, ignoreUnusedTypeExports } = context.options[0] || {};
|
|
6759
6674
|
if (unusedExports) {
|
|
6760
6675
|
doPreparation(src, ignoreExports, context);
|
|
6761
6676
|
}
|
|
@@ -6765,6 +6680,9 @@ var require_no_unused_modules = __commonJS({
|
|
|
6765
6680
|
if (!missingExports) {
|
|
6766
6681
|
return;
|
|
6767
6682
|
}
|
|
6683
|
+
if (ignoreUnusedTypeExports) {
|
|
6684
|
+
return;
|
|
6685
|
+
}
|
|
6768
6686
|
if (ignoredFiles.has(filename)) {
|
|
6769
6687
|
return;
|
|
6770
6688
|
}
|
|
@@ -6782,10 +6700,13 @@ var require_no_unused_modules = __commonJS({
|
|
|
6782
6700
|
exportCount.set(AST_NODE_TYPES.ExportAllDeclaration, exportAll);
|
|
6783
6701
|
exportCount.set(AST_NODE_TYPES.ImportNamespaceSpecifier, namespaceImports);
|
|
6784
6702
|
};
|
|
6785
|
-
const checkUsage = (node, exportedValue) => {
|
|
6703
|
+
const checkUsage = (node, exportedValue, isTypeExport) => {
|
|
6786
6704
|
if (!unusedExports) {
|
|
6787
6705
|
return;
|
|
6788
6706
|
}
|
|
6707
|
+
if (isTypeExport && ignoreUnusedTypeExports) {
|
|
6708
|
+
return;
|
|
6709
|
+
}
|
|
6789
6710
|
if (ignoredFiles.has(filename)) {
|
|
6790
6711
|
return;
|
|
6791
6712
|
}
|
|
@@ -7131,14 +7052,14 @@ var require_no_unused_modules = __commonJS({
|
|
|
7131
7052
|
checkExportPresence(node);
|
|
7132
7053
|
},
|
|
7133
7054
|
ExportDefaultDeclaration(node) {
|
|
7134
|
-
checkUsage(node, AST_NODE_TYPES.ImportDefaultSpecifier);
|
|
7055
|
+
checkUsage(node, AST_NODE_TYPES.ImportDefaultSpecifier, false);
|
|
7135
7056
|
},
|
|
7136
7057
|
ExportNamedDeclaration(node) {
|
|
7137
7058
|
for (const specifier of node.specifiers) {
|
|
7138
|
-
checkUsage(specifier, (0, utils_2.getValue)(specifier.exported));
|
|
7059
|
+
checkUsage(specifier, (0, utils_2.getValue)(specifier.exported), false);
|
|
7139
7060
|
}
|
|
7140
|
-
forEachDeclarationIdentifier(node.declaration, (name) => {
|
|
7141
|
-
checkUsage(node, name);
|
|
7061
|
+
forEachDeclarationIdentifier(node.declaration, (name, isTypeExport) => {
|
|
7062
|
+
checkUsage(node, name, isTypeExport);
|
|
7142
7063
|
});
|
|
7143
7064
|
}
|
|
7144
7065
|
};
|