revert fb8e77bb68
Local Build and Deploy / deploy (push) Successful in 1m11s
Local Build and Deploy / deploy (push) Successful in 1m11s
revert style: clean up code with prettier and eslint
This commit is contained in:
1 parent
27de078f54
commit
e85e4d74ea
378 files changed
+20710
-22428
No files matched your search
@@ -7,21 +7,8 @@ export interface MissingLocalImport {
|
||||
}
|
||||
|
||||
const sourceExtensions = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"]);
|
||||
const resolutionSuffixes = [
|
||||
".ts",
|
||||
".tsx",
|
||||
".js",
|
||||
".jsx",
|
||||
".mjs",
|
||||
".cjs",
|
||||
".css",
|
||||
"/index.ts",
|
||||
"/index.tsx",
|
||||
"/index.js",
|
||||
"/index.jsx",
|
||||
];
|
||||
const importPattern =
|
||||
/(?:import|export)\s+(?:[^"']*?\s+from\s+)?["']([^"']+)["']|import\(\s*["']([^"']+)["']\s*\)|require\(\s*["']([^"']+)["']\s*\)/g;
|
||||
const resolutionSuffixes = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".css", "/index.ts", "/index.tsx", "/index.js", "/index.jsx"];
|
||||
const importPattern = /(?:import|export)\s+(?:[^"']*?\s+from\s+)?["']([^"']+)["']|import\(\s*["']([^"']+)["']\s*\)|require\(\s*["']([^"']+)["']\s*\)/g;
|
||||
|
||||
async function collectSourceFiles(directory: string): Promise<string[]> {
|
||||
const entries = await readdir(directory, { withFileTypes: true });
|
||||
@@ -62,8 +49,7 @@ export async function findMissingLocalImports(root: string): Promise<MissingLoca
|
||||
const source = await readFile(importer, "utf8");
|
||||
for (const match of source.matchAll(importPattern)) {
|
||||
const specifier = match[1] ?? match[2] ?? match[3];
|
||||
if (!specifier?.startsWith("@/") && !specifier?.startsWith("./") && !specifier?.startsWith("../"))
|
||||
continue;
|
||||
if (!specifier?.startsWith("@/") && !specifier?.startsWith("./") && !specifier?.startsWith("../")) continue;
|
||||
const base = specifier.startsWith("@/")
|
||||
? resolve(src, specifier.slice(2))
|
||||
: resolve(dirname(importer), specifier);
|
||||
@@ -76,7 +62,7 @@ export async function findMissingLocalImports(root: string): Promise<MissingLoca
|
||||
}
|
||||
}
|
||||
|
||||
return missing.sort(
|
||||
(a, b) => a.importer.localeCompare(b.importer) || a.specifier.localeCompare(b.specifier),
|
||||
return missing.sort((a, b) =>
|
||||
a.importer.localeCompare(b.importer) || a.specifier.localeCompare(b.specifier),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user