@dloizides/frontend-devtools 2.1.0 → 2.1.1
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/dist/eslint/index.mjs
CHANGED
|
@@ -2175,6 +2175,14 @@ function isExemptFile2(path2, allow) {
|
|
|
2175
2175
|
if (TEST_FILE2.test(path2) || SHARED_SOURCE.test(path2)) return true;
|
|
2176
2176
|
return allow.some((fragment) => path2.includes(fragment));
|
|
2177
2177
|
}
|
|
2178
|
+
var MODULE_DECLARATIONS = /* @__PURE__ */ new Set(["ImportDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration"]);
|
|
2179
|
+
function usesPackage(program, packageName) {
|
|
2180
|
+
return program.body.some((statement) => {
|
|
2181
|
+
if (!MODULE_DECLARATIONS.has(statement.type) || statement.source == null) return false;
|
|
2182
|
+
const source = statement.source.value;
|
|
2183
|
+
return source === packageName || typeof source === "string" && source.startsWith(`${packageName}/`);
|
|
2184
|
+
});
|
|
2185
|
+
}
|
|
2178
2186
|
function literalText(node) {
|
|
2179
2187
|
if (node.type === "Literal") return typeof node.value === "string" ? node.value : "";
|
|
2180
2188
|
return node.quasis.length === 1 ? node.quasis[0].value.cooked ?? "" : "";
|
|
@@ -2216,7 +2224,7 @@ var noReimplementedPackageRule = {
|
|
|
2216
2224
|
return {
|
|
2217
2225
|
Program(node) {
|
|
2218
2226
|
for (const entry of REIMPLEMENTED_PACKAGE_REGISTRY)
|
|
2219
|
-
if (entry.paths.some((pattern) => pattern.test(path2))) report(node, entry);
|
|
2227
|
+
if (entry.paths.some((pattern) => pattern.test(path2)) && !usesPackage(node, entry.package)) report(node, entry);
|
|
2220
2228
|
},
|
|
2221
2229
|
Literal: checkLiteral,
|
|
2222
2230
|
TemplateLiteral: checkLiteral
|