Skip to content

Commit

Permalink
refactor: Rebased changes to the new filePaths
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 committed Sep 29, 2024
1 parent 7eaf2fa commit ac5a04a
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions src/linter/fileTypes/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,10 @@ const deprecatedViewFileTypes = [
".fragment.ts",
];

export default async function lintFileTypes({workspace, context}: LinterParameters) {
let potentialDeprecatedResources: Resource[];
const pathsToLint = context.getPathsToLint();
if (pathsToLint?.length) {
potentialDeprecatedResources = [];
await Promise.all(pathsToLint.map(async (resourcePath) => {
if (!deprecatedViewFileTypes.some((type) => resourcePath.endsWith(type))) {
return;
}
const resource = await workspace.byPath(resourcePath);
if (!resource) {
throw new Error(`Resource not found: ${resourcePath}`);
}
potentialDeprecatedResources.push(resource);
}));
} else {
potentialDeprecatedResources =
await workspace.byGlob(`**/{${deprecatedViewFileTypes.map((type) => `*${type}`).join(",")}}`);
}
export default async function lintFileTypes({workspace, filePathsReader, context}: LinterParameters) {
const reader = filePathsReader ?? workspace;
const potentialDeprecatedResources =
await reader.byGlob(`**/{${deprecatedViewFileTypes.map((type) => `*${type}`).join(",")}}`);

potentialDeprecatedResources.forEach((resource: Resource) => {
const fileSuffix = resource.getPath().split(".").pop()!.toUpperCase();
Expand Down

0 comments on commit ac5a04a

Please sign in to comment.