Skip to content

Commit

Permalink
apply biome fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Setch <[email protected]>
  • Loading branch information
setchy committed Apr 14, 2024
1 parent 604432b commit 5e761d3
Show file tree
Hide file tree
Showing 78 changed files with 24,625 additions and 23,074 deletions.
36 changes: 18 additions & 18 deletions analyzer.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { parse } from "@babel/parser";
import traverse from "@babel/traverse";
import process from "node:process";
import { lstatSync, readFileSync, readdirSync } from "node:fs";
import { basename, isAbsolute, join, relative, resolve } from "node:path";
import process from "node:process";
import { parse } from "@babel/parser";
import traverse from "@babel/traverse";

const IGNORE_DIRS = process.env.ASTGEN_IGNORE_DIRS
? process.env.ASTGEN_IGNORE_DIRS.split(",")
Expand All @@ -26,13 +26,13 @@ const IGNORE_DIRS = process.env.ASTGEN_IGNORE_DIRS
"codemods",
"flow-typed",
"i18n",
"__tests__"
"__tests__",
];

const IGNORE_FILE_PATTERN = new RegExp(
process.env.ASTGEN_IGNORE_FILE_PATTERN ||
"(conf|config|test|spec|mock|\\.d)\\.(js|ts|tsx)$",
"i"
"i",
);

const getAllFiles = (deep, dir, extn, files, result, regex) => {
Expand Down Expand Up @@ -70,7 +70,7 @@ const getAllFiles = (deep, dir, extn, files, result, regex) => {
extn,
readdirSync(file),
result,
regex
regex,
);
} catch (error) {
continue;
Expand Down Expand Up @@ -105,8 +105,8 @@ const babelParserOptions = {
"numericSeparator",
"dynamicImport",
"jsx",
"typescript"
]
"typescript",
],
};

/**
Expand All @@ -119,7 +119,7 @@ const setFileRef = (
src,
file,
pathnode,
specifiers = []
specifiers = [],
) => {
const pathway = pathnode.value || pathnode.name;
const sourceLoc = pathnode.loc?.start;
Expand All @@ -144,7 +144,7 @@ const setFileRef = (
isExternal: true,
fileName: fileRelativeLoc,
lineNumber: sourceLoc && sourceLoc.line ? sourceLoc.line : undefined,
columnNumber: sourceLoc && sourceLoc.column ? sourceLoc.column : undefined
columnNumber: sourceLoc && sourceLoc.column ? sourceLoc.column : undefined,
};
// replace relative imports with full path
let moduleFullPath = pathway;
Expand Down Expand Up @@ -194,21 +194,21 @@ const fileToParseableCode = (file) => {
.replace(vueCommentRegex, (match) => match.replaceAll(/\S/g, " "))
.replace(
vueCleaningRegex,
(match) => match.replaceAll(/\S/g, " ").substring(1) + ";"
(match) => match.replaceAll(/\S/g, " ").substring(1) + ";",
)
.replace(
vueBindRegex,
(match, grA, grB, grC) =>
grA.replaceAll(/\S/g, " ") + grB + grC.replaceAll(/\S/g, " ")
grA.replaceAll(/\S/g, " ") + grB + grC.replaceAll(/\S/g, " "),
)
.replace(
vuePropRegex,
(match, grA, grB) => " " + grA.replace(/[.:@]/g, " ") + grB
(match, grA, grB) => " " + grA.replace(/[.:@]/g, " ") + grB,
)
.replace(
vueTemplateRegex,
(match, grA, grB, grC) =>
grA + grB.replaceAll("{{", "{ ").replaceAll("}}", " }") + grC
grA + grB.replaceAll("{{", "{ ").replaceAll("}}", " }") + grC,
);
}
return code;
Expand All @@ -229,7 +229,7 @@ const parseFileASTTree = (src, file, allImports, allExports) => {
src,
file,
path.node.source,
path.node.specifiers
path.node.specifiers,
);
}
},
Expand Down Expand Up @@ -263,10 +263,10 @@ const parseFileASTTree = (src, file, allImports, allExports) => {
src,
file,
path.node.source,
path.node.specifiers
path.node.specifiers,
);
}
}
},
});
};

Expand All @@ -282,7 +282,7 @@ const getAllSrcJSAndTSFiles = (src, deep) =>
getAllFiles(deep, src, ".ts"),
getAllFiles(deep, src, ".tsx"),
getAllFiles(deep, src, ".vue"),
getAllFiles(deep, src, ".svelte")
getAllFiles(deep, src, ".svelte"),
]);

/**
Expand Down
Loading

0 comments on commit 5e761d3

Please sign in to comment.