Improve method transform (#18135)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
fisker Cheungandautofix-ci[bot] authored and GitHub committed 2025-10-28 02:51:50 +08:00
1 parent b99012b48c
commit 011791fd6c
27 files changed
+273 -220

No files matched your search

+23 -20
View File
@@ -6,29 +6,32 @@ import { outdent } from "outdent";
import { PROJECT_ROOT, SOURCE_DIR } from "../../utils/index.js";
import allTransforms from "./transforms/index.js";
/* Doesn't work for dependencies, optional call, computed property, and spread arguments */
/* Doesn't work for dependencies */
function transform(original, file) {
if (
!(
file.startsWith(SOURCE_DIR) ||
file.startsWith(path.join(PROJECT_ROOT, "node_modules/camelcase/")) ||
file.startsWith(
path.join(PROJECT_ROOT, "node_modules/angular-estree-parser/"),
) ||
file.startsWith(path.join(PROJECT_ROOT, "node_modules/jest-docblock/")) ||
file.startsWith(path.join(PROJECT_ROOT, "node_modules/espree/")) ||
file.startsWith(path.join(PROJECT_ROOT, "node_modules/@babel/parser/")) ||
file.startsWith(
path.join(
PROJECT_ROOT,
"node_modules/@typescript-eslint/typescript-estree/",
),
) ||
file.startsWith(path.join(PROJECT_ROOT, "node_modules/meriyah/")) ||
file.startsWith(path.join(PROJECT_ROOT, "node_modules/@glimmer/")) ||
file.startsWith(path.join(PROJECT_ROOT, "node_modules/hermes-parser/"))
)
![
SOURCE_DIR,
...[
/* spell-checker: disable */
"camelcase",
"angular-estree-parser",
"jest-docblock",
"espree",
"@babel/parser",
"@typescript-eslint/typescript-estree",
"meriyah",
"@glimmer",
"@prettier/cli",
"hermes-parser",
"kasi",
"fast-string-truncated-width",
"fast-ignore",
/* spell-checker: enable */
].map((directory) =>
path.join(PROJECT_ROOT, `node_modules/${directory}/`),
),
].some((directory) => file.startsWith(directory))
) {
return original;
}